/* portal.css — the back office.
   Same bone, charcoal and brass as the landing page, but built for a thumb
   rather than a mouse: tap targets are 44px, the tab strip scrolls, and every
   action a person needs while standing up is reachable without a scroll. */

:root {
  --bone:   #faf7f3;
  --sand:   #f0e9e0;
  --ink:    #1c1a19;
  --ink-2:  #2a2725;
  --muted:  #6d645d;
  --brass:  #8a6a2f;
  --brass-l:#c9a961;
  --line:   #e0d6c9;
  --white:  #fff;
  --good:   #2f6d4a;
  --bad:    #a2432c;
  --r:      3px;
  --shadow: 0 18px 44px -26px rgba(28, 26, 25, .40);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bone);
  color: var(--ink);
  font: 400 16px/1.5 Inter, system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body.locked, body.sheeted { overflow: hidden; }

h1, h2, h3 { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; margin: 0; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ── the lock ───────────────────────────────────────────────────────────── */

.lock {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--bone);
  padding: 24px;
}

.lock-in { width: min(340px, 100%); display: grid; gap: 12px; }
.lock-in h1 { font-size: 32px; color: var(--brass-l); }
.lock-in p { margin: 0; color: #cfc7bd; font-size: 14px; }

.lock-in input {
  font: inherit;
  font-size: 22px;
  letter-spacing: .3em;
  text-align: center;
  padding: 14px;
  border: 1px solid #4a4540;
  border-radius: var(--r);
  background: #262320;
  color: var(--bone);
}

/* ── frame ──────────────────────────────────────────────────────────────── */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.top-in {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  max-width: 1080px;
  margin: 0 auto;
}

.mark { border-radius: 50%; object-fit: cover; }
.who { display: grid; margin-right: auto; }
.who b { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 22px; line-height: 1.1; }
.who i { font-style: normal; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 12px 8px;
  max-width: 1080px;
  margin: 0 auto;
}
.tabs::-webkit-scrollbar { display: none; }

.tabs a {
  flex: 0 0 auto;
  padding: 9px 13px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tabs a.here { background: var(--ink); color: var(--bone); }

.badge {
  background: var(--brass);
  color: var(--white);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
}
.tabs a.here .badge { background: var(--brass-l); color: var(--ink); }

.status {
  margin: 0;
  padding: 9px 16px;
  background: var(--sand);
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 13px;
  text-align: center;
}
.status.warn { background: #f6e6df; color: var(--bad); }

.view { max-width: 1080px; margin: 0 auto; padding: 16px 16px 64px; }
.stack { display: grid; gap: 16px; }

.foot {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px calc(32px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 12px;
}

/* ── panels ─────────────────────────────────────────────────────────────── */

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px 16px;
}

.ph {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.ph h2 { font-size: 22px; }
.grow { flex: 1 1 auto; }

.note { margin: 4px 0 12px; color: var(--muted); font-size: 13.5px; }
.note.quote { border-left: 2px solid var(--brass-l); padding-left: 10px; color: var(--ink-2); }
.none { color: var(--line); margin: 0; }

.plain { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
.plain li { margin-bottom: 8px; }

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--r);
  padding: 22px 18px;
  text-align: center;
  background: var(--bone);
}
.empty h3 { font-size: 20px; margin-bottom: 4px; }
.empty p { margin: 0; color: var(--muted); font-size: 14px; max-width: 46ch; margin-inline: auto; }

/* ── the dashboard numbers ──────────────────────────────────────────────── */

.cards { display: grid; gap: 10px; }
.cards.four { grid-template-columns: repeat(2, 1fr); }
.cards.three { grid-template-columns: repeat(2, 1fr); }

.stat {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 13px;
  display: grid;
  gap: 1px;
}
.stat b { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 34px; line-height: 1; }
/* For a figure that is a phrase rather than a number — "overdue by 12 days". */
.stat b.small { font-size: 22px; line-height: 1.15; }
.stat span { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--brass); font-weight: 600; }
.stat i { font-style: normal; font-size: 11.5px; color: var(--muted); line-height: 1.35; }

/* ── row lists ──────────────────────────────────────────────────────────── */

.rows { list-style: none; margin: 0; padding: 0; }

.rows li {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.rows li:first-child { border-top: 0; }

.rowmain { display: grid; gap: 1px; flex: 1 1 220px; min-width: 0; }
.rowmain b { font-size: 15.5px; }
.sub { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.sub.strong { color: var(--brass); font-weight: 500; }

.acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.acts.big { margin-bottom: 12px; }
.amt { font-variant-numeric: tabular-nums; font-size: 14px; }

.mini {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink-2);
  font: 500 13px Inter, sans-serif;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.mini:hover { border-color: var(--brass-l); color: var(--brass); }

.chip {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--sand);
  color: var(--ink-2);
}
.chip.good { background: #e2efe7; color: var(--good); }
.chip.bad { background: #f6e6df; color: var(--bad); }
.chip.dim { background: var(--bone); color: var(--muted); }

.search {
  font: inherit;
  font-size: 14px;
  padding: 8px 11px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bone);
  min-width: 0;
  flex: 1 1 120px;
  max-width: 220px;
}

/* ── pipeline boards ────────────────────────────────────────────────────── */

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 78vw;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}

.col { scroll-snap-align: start; display: grid; gap: 8px; align-content: start; }
.col h3 {
  font-size: 13px;
  font-family: Inter, sans-serif;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brass);
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.col h3 span { color: var(--muted); font-weight: 400; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bone);
  padding: 11px 12px;
  display: grid;
  gap: 3px;
}
.card b { font-size: 15px; }
.card .acts { margin-top: 5px; }

.move select {
  font: inherit;
  font-size: 12.5px;
  width: 100%;
  margin-top: 4px;
  padding: 7px 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--white);
}

/* ── buttons ────────────────────────────────────────────────────────────── */

.btn {
  font: 500 14.5px Inter, sans-serif;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: var(--r);
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn.solid { background: var(--ink); color: var(--bone); }
.btn.line { background: var(--white); }
.btn.danger { border-color: var(--bad); color: var(--bad); background: var(--white); }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn:hover { border-color: var(--brass); }
.btn.solid:hover { background: var(--ink-2); }

/* ── the editor sheet ───────────────────────────────────────────────────── */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(28, 26, 25, .5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-in {
  background: var(--white);
  width: min(560px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 12px 12px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.sheet-in header { display: flex; align-items: center; gap: 10px; }
.sheet-in header h2 { font-size: 24px; margin-right: auto; }

.x {
  border: 0;
  background: var(--sand);
  color: var(--ink);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.sheet-in footer { display: flex; gap: 8px; justify-content: flex-end; }
.sheet-in footer .btn { flex: 1 1 auto; }

.fields { display: grid; gap: 11px; }

.fields label { display: grid; gap: 4px; }
.fields label > span { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.fields label > i { font-style: normal; font-size: 12px; color: var(--muted); }

.fields label.row {
  grid-template-columns: 1fr auto;
  align-items: center;
}
.fields label.row input { width: 22px; height: 22px; }

.fields input, .fields select, .fields textarea {
  font: inherit;
  font-size: 16px; /* 16px or iOS zooms the whole page on focus */
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bone);
  color: var(--ink);
  width: 100%;
}
.fields textarea { min-height: 72px; resize: vertical; }
.fields input:focus, .fields select:focus, .fields textarea:focus {
  outline: 2px solid var(--brass-l);
  outline-offset: 1px;
}

.err { margin: 0; color: var(--bad); font-size: 13.5px; }

/* ── toast ──────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 200%);
  z-index: 50;
  margin: 0;
  max-width: min(460px, calc(100% - 32px));
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bone);
  font-size: 13.5px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .22s ease;
}
.toast.show { transform: translate(-50%, 0); }
.toast.warn { background: var(--bad); }

.back { margin: 0; }

/* ── wider screens ──────────────────────────────────────────────────────── */

@media (min-width: 700px) {
  .cards.four { grid-template-columns: repeat(4, 1fr); }
  .cards.three { grid-template-columns: repeat(3, 1fr); }
  .board { grid-auto-columns: 300px; }
  .view { padding: 22px 20px 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
