/* ============================================================================
   Adroit Pulse portal.css — CSS CONTRACT implementation
   White cards, 12px radius, grey-blue labels, phone-first (min 360px).
   Cards may use ONLY the contract classes below (plus plain elements).
   ========================================================================== */

:root {
  --p-bg: #eef1f6;
  --p-card: #ffffff;
  --p-ink: #1c2733;
  --p-label: #66788f;      /* grey-blue labels */
  --p-line: #e3e8ef;
  --p-blue: #2563eb;
  --p-green: #16a34a;
  --p-amber: #d97706;
  --p-red: #dc2626;
  --p-radius: 12px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-width: 360px;
  background: var(--p-bg);
  color: var(--p-ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }
a { color: var(--p-blue); }

/* ------------------------------------------------------------------- cards */
.card {
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(28, 39, 51, 0.07);
}

.card-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--p-label);
  margin: 0 0 10px;
}

/* -------------------------------------------------------------------- grid */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px;
}
@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; padding: 14px; }
}

/* ------------------------------------------------------------------- chips */
.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
  background: #edf0f4;
  color: var(--p-label);
  white-space: nowrap;
  vertical-align: middle;
}
.chip-green { background: #e5f5eb; color: #15803d; }
.chip-amber { background: #fdf1de; color: #b45309; }
.chip-red   { background: #fdeaea; color: #b91c1c; }
.chip-grey  { background: #edf0f4; color: #66788f; }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--p-line);
  border-radius: 10px;
  background: #fff;
  color: var(--p-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-primary { background: var(--p-blue); border-color: var(--p-blue); color: #fff; }
.btn-danger  { background: var(--p-red);  border-color: var(--p-red);  color: #fff; }
.btn-ghost   { background: transparent; border-color: transparent; color: var(--p-blue); }

/* ------------------------------------------------------------------ tables */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--p-label);
  padding: 6px 8px;
  border-bottom: 1px solid var(--p-line);
  white-space: nowrap;
}
.tbl td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--p-line);
  vertical-align: top;
}
.tbl tr:last-child td { border-bottom: none; }

/* --------------------------------------------------------- key/value rows */
.kv {
  display: grid;
  grid-template-columns: minmax(96px, auto) 1fr;
  gap: 6px 14px;
  align-items: baseline;
}
.kv > :nth-child(odd)  { color: var(--p-label); font-size: 13px; }
.kv > :nth-child(even) { font-weight: 500; overflow-wrap: anywhere; }

/* ----------------------------------------------------------------- banners */
.banner-red, .banner-amber {
  border-radius: var(--p-radius);
  border: 1px solid;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  margin: 8px 0;
}
.banner-red   { background: #fdeaea; border-color: #f5c2c2; color: #991b1b; }
.banner-amber { background: #fdf1de; border-color: #f2d9ae; color: #92400e; }

/* ------------------------------------------------------------------ modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 38, 0.45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}
@media (min-width: 720px) {
  .modal-backdrop { align-items: center; }
}
.modal {
  background: #fff;
  border-radius: var(--p-radius);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow: auto;
  padding: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

/* ------------------------------------------------------------------ inputs */
.input, .select {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--p-line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
  color: var(--p-ink);
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--p-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ------------------------------------------------------------------- misc */
.badge-manual {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #ede9fe;
  color: #6d28d9;
  border-radius: 6px;
  padding: 1px 6px;
  vertical-align: middle;
}

.muted { color: var(--p-label); font-size: 13px; }

.num-big {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------- toasts (used by P.toast only) */
#p-toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
  padding: 0 12px;
}
.toast {
  background: #1c2733;
  color: #fff;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  max-width: 480px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast-err { background: var(--p-red); }
