/* The OJ Matrix — "Ice"
 *
 * Tokens are copied from DESIGN.md and live ONLY in the :root block below.
 * Components reference tokens, never raw values — a reskin (including the
 * pending brand revamp) is an edit to :root and nothing else.
 */

@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700;800&display=swap');

:root {
  /* colour */
  --bg:         #F5F8FC;
  --surface:    #FFFFFF;
  --ink:        #18242E;
  --sub:        #6C7C89;
  --line:       #E3EAF1;
  --accent:     #335b76;
  --tint:       #E4EEFB;
  --pop:        #c0a6ca;   /* micro-details only — dots and slivers, never surfaces */
  --mobilejob:  #8FA9C4;

  --good-bg:    #E2F0E9;
  --good-ink:   #2E6B4F;
  --attn-bg:    #FFF1DC;
  --attn-ink:   #9A6A1F;

  /* shape & depth */
  --r-card:   15px;
  --r-input:  10px;
  --r-chip:   20px;
  --shadow:   0 1px 3px rgba(24,36,46,.08), 0 5px 16px rgba(24,36,46,.06);

  /* layout */
  --sidebar:  230px;
  --content:  1100px;
  --tap:      44px;        /* if Will can't hit it with a damp thumb, it's too small */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Barlow', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* Small labels: 10–12px, uppercase, wide tracking, colour sub */
.label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sub);
}


/* ── Shell ────────────────────────────────────────────────────────────────── */

.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

aside {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { margin-bottom: 16px; }
.brand .eyebrow {
  font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase;
  font-weight: 700; color: var(--accent);
}
.brand h1 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }

.ngroup {
  font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--sub); font-weight: 800; margin: 15px 8px 4px;
}

.nitem {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: var(--r-input);
  font-weight: 600; color: var(--ink); min-height: 38px;
}
.nitem .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.nitem:hover { background: var(--bg); }
.nitem.on { background: var(--tint); color: var(--accent); font-weight: 700; }
.nitem.on:hover { background: var(--tint); }

/* Unbuilt modules stay visible — the vision stays on screen */
.nitem.off { color: var(--sub); font-weight: 500; opacity: .65; cursor: default; }
.nitem.off:hover { background: transparent; }
.nitem.off .dot { background: var(--line); }
.nitem .pill {
  margin-left: auto; font-size: 8.5px; font-weight: 800;
  border: 1px dashed var(--line); color: var(--sub);
  padding: 1px 6px; border-radius: var(--r-chip);
}
.nitem .count {
  margin-left: auto; font-size: 11px; font-weight: 800; color: var(--accent);
  background: var(--tint); padding: 1px 7px; border-radius: var(--r-chip);
}
.nitem.on .count { background: var(--surface); }

.me {
  margin-top: auto; display: flex; gap: 9px; align-items: center;
  padding: 12px 10px 2px; border-top: 1px solid var(--line);
}
.me .av {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent);
  color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 12px;
}
.me small { color: var(--sub); font-size: 11px; }

main { padding: 22px 26px 90px; min-width: 0; max-width: calc(var(--content) + 52px); }


/* ── Topbar ───────────────────────────────────────────────────────────────── */

.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.topbar .sub { font-size: 12.5px; color: var(--sub); font-weight: 600; }

.search {
  flex: 1; max-width: 340px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-input); padding: 10px 13px; color: var(--ink);
  font: inherit; font-size: 14px; min-height: var(--tap);
}
.search::placeholder { color: var(--sub); }


/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-input);
  padding: 10px 15px; font: inherit; font-weight: 700; font-size: 13.5px;
  cursor: pointer; min-height: var(--tap); white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn.go { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.go:hover { filter: brightness(1.08); }
.btn.wide { width: 100%; }
.btn.sm { padding: 7px 11px; min-height: 34px; font-size: 12.5px; }
.btn.ghost { background: transparent; border-style: dashed; color: var(--sub); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.newbtn {
  margin-left: auto; background: var(--accent); color: #fff; border: 0;
  border-radius: var(--r-input); padding: 11px 17px; font: inherit;
  font-weight: 700; cursor: pointer; min-height: var(--tap);
}


/* ── Cards & tiles ────────────────────────────────────────────────────────── */

.card {
  background: var(--surface); border-radius: var(--r-card);
  box-shadow: var(--shadow); padding: 16px;
}
.card + .card { margin-top: 14px; }
.card h3 { font-size: 13.5px; font-weight: 800; margin-bottom: 9px; }
.card h3 .n { color: var(--sub); font-weight: 700; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile {
  background: var(--surface); border-radius: var(--r-card); padding: 15px;
  box-shadow: var(--shadow); position: relative; display: block;
}
.tile h3 {
  font-size: 10.5px; font-weight: 800; color: var(--sub);
  letter-spacing: .1em; text-transform: uppercase;
}
.tile .big { font-size: 27px; font-weight: 800; margin-top: 5px; line-height: 1.1; }
.tile .sub { font-size: 11.5px; color: var(--sub); margin-top: 2px; }

/* Needs-me: accent outline + a single pop dot */
.tile.hot { outline: 2px solid var(--accent); }
.tile.hot .big { color: var(--accent); }
.dotp {
  position: absolute; top: 12px; right: 12px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--pop);
}

/* Ghost: no shadow, dashed, half-faded, "soon" pill */
.tile.ghost { opacity: .5; background: transparent; box-shadow: none; border: 1.5px dashed var(--line); }
.tile.ghost .big { color: var(--sub); }

.cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; margin-top: 16px; align-items: start; }
.cols.even { grid-template-columns: 1fr 1fr; }
/* Where the left column is what you act on and the right is reference —
   an agent's questions against its shift log — 1.5fr still left the
   questions cramped. Ollie's words: unnecessarily narrow. */
.cols.wide { grid-template-columns: 2.2fr 1fr; }


/* ── Rows & lists ─────────────────────────────────────────────────────────── */

.row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 2px; border-bottom: 1px solid var(--line);
  min-height: var(--tap);
}
.row:last-child { border-bottom: 0; }
.row .who { font-weight: 700; font-size: 14.5px; }
.row .car { font-size: 11.5px; color: var(--sub); }
.row .grow { flex: 1; min-width: 0; }
.row .trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { color: var(--sub); font-size: 13px; padding: 14px 2px; font-weight: 600; }


/* ── Status chips — the only colour coding in lists ───────────────────────── */

.chip {
  font-size: 10px; font-weight: 800; padding: 4px 9px; border-radius: var(--r-chip);
  white-space: nowrap; letter-spacing: .03em; text-transform: uppercase;
  background: var(--tint); color: var(--accent);
}
.chip.right { margin-left: auto; }
.chip.good { background: var(--good-bg); color: var(--good-ink); }
.chip.attn { background: var(--attn-bg); color: var(--attn-ink); }
.chip.quiet { background: var(--bg); color: var(--sub); }
.chip.line  { background: transparent; border: 1px solid var(--line); color: var(--sub); }

.dot-pop { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--pop); }


/* ── Needs-me queue: one-line cards, two buttons max ──────────────────────── */

.qitem { padding: 12px 2px; border-bottom: 1px solid var(--line); }
.qitem:last-child { border-bottom: 0; }
.qitem b { font-weight: 800; }
.qitem .meta { font-size: 12px; color: var(--sub); margin-top: 2px; }
.qbtns { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }

/* Agent suggestions: tint bar, small filled AGENT tag, one sentence */
.suggest {
  background: var(--tint); border-radius: var(--r-input);
  padding: 11px 13px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.suggest .tag {
  background: var(--accent); color: #fff; font-size: 9px; font-weight: 800;
  letter-spacing: .1em; padding: 3px 7px; border-radius: 5px;
}
.suggest .txt { flex: 1; font-size: 13.5px; font-weight: 600; min-width: 200px; }


/* ── Forms ────────────────────────────────────────────────────────────────── */

.field { margin-bottom: 14px; }
.field > label { display: block; margin-bottom: 5px; }
.field .hint { font-size: 11.5px; color: var(--sub); margin-top: 4px; font-weight: 500; }

input[type=text], input[type=email], input[type=number], input[type=time],
input[type=date], input[type=search], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-input); padding: 11px 13px;
  font: inherit; font-size: 15px; color: var(--ink); min-height: var(--tap);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -2px; }

.segmented { display: flex; gap: 7px; flex-wrap: wrap; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--r-chip); padding: 9px 14px;
  font-size: 12.5px; font-weight: 700; cursor: pointer; min-height: var(--tap);
  display: inline-flex; align-items: center;
}
.segmented input:checked + label { background: var(--accent); color: #fff; border-color: var(--accent); }

.formrow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }


/* ── Tables (desktop densification — same tokens, tighter rows) ───────────── */

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 10px; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--sub);
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg); }
td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }


/* ── Filters ──────────────────────────────────────────────────────────────── */

.filters { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.filters a {
  font-size: 12px; font-weight: 700; padding: 8px 13px; border-radius: var(--r-chip);
  background: var(--surface); border: 1px solid var(--line); color: var(--sub);
  min-height: 38px; display: inline-flex; align-items: center;
}
.filters a.on { background: var(--accent); color: #fff; border-color: var(--accent); }


/* ── Charts: accent + tint + pop + line only ──────────────────────────────── */

.spark { display: block; }
.bar { fill: var(--tint); }
.bar.now { fill: var(--accent); }
.baseline { stroke: var(--line); stroke-width: 1; }


/* ── Health line ──────────────────────────────────────────────────────────── */

.health { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--sub); font-weight: 600; }
.health .ok::before   { content: "●"; color: var(--good-ink); margin-right: 5px; }
.health .bad::before  { content: "●"; color: var(--attn-ink); margin-right: 5px; }
.health .cold::before { content: "○"; color: var(--sub); margin-right: 5px; }


/* ── Agent roster ─────────────────────────────────────────────────────────── */

.agent { padding: 13px 2px; border-bottom: 1px solid var(--line); }
.agent:last-child { border-bottom: 0; }
.agent .name { font-weight: 800; font-size: 14.5px; }
.agent .owns { font-size: 12px; color: var(--sub); margin-top: 1px; }
.agent .ran  { font-size: 12px; margin-top: 6px; font-weight: 600; }
.agent .fail { background: var(--attn-bg); color: var(--attn-ink); border-radius: 8px;
               padding: 8px 10px; font-size: 12px; margin-top: 7px; font-weight: 600; }


/* ── Detail pages ─────────────────────────────────────────────────────────── */

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 7px 14px; font-size: 14px; }
.kv dt { color: var(--sub); font-weight: 700; font-size: 12px; padding-top: 2px; }
.kv dd { font-weight: 600; }

.timeline { list-style: none; }
.timeline li { padding: 9px 0 9px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 15px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--line);
}
.timeline li.key::before { background: var(--accent); }
.timeline .when { font-size: 11px; color: var(--sub); font-weight: 700; }

.backlink { font-size: 12.5px; color: var(--sub); font-weight: 700; margin-bottom: 10px; display: inline-block; }


/* ── Flash ────────────────────────────────────────────────────────────────── */

.flash {
  background: var(--good-bg); color: var(--good-ink); border-radius: var(--r-input);
  padding: 12px 14px; font-weight: 700; font-size: 13.5px; margin-bottom: 16px;
}
.flash.warn { background: var(--attn-bg); color: var(--attn-ink); }


/* ── Mobile nav + FAB ─────────────────────────────────────────────────────── */

.mobilenav, .fab, .drawer, .drawerbg, .burger { display: none; }


@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  aside { display: none; }

  main { padding: 16px 14px 104px; max-width: 480px; margin: 0 auto; }

  .topbar { gap: 10px; }
  .topbar h2 { font-size: 21px; }
  .newbtn { display: none; }
  .search { max-width: none; order: 3; width: 100%; }

  .burger {
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: auto; width: var(--tap); height: var(--tap);
    border: 1px solid var(--line); background: var(--surface);
    border-radius: var(--r-input); font-size: 17px; cursor: pointer;
  }

  .stats { grid-template-columns: 1fr 1fr; }
  .cols, .cols.even { grid-template-columns: 1fr; }
  .formrow { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 100px 1fr; }

  /* lists stay lists on mobile; tables are a desktop densification */
  .tablewrap table { min-width: 560px; }

  .mobilenav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobilenav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 9px 2px; min-height: 56px;
    font-size: 10px; font-weight: 800; letter-spacing: .04em;
    text-transform: uppercase; color: var(--sub);
  }
  .mobilenav a .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
  .mobilenav a.on { color: var(--accent); }
  .mobilenav a.on .dot { background: var(--accent); }
  .mobilenav a .badge {
    position: absolute; transform: translate(16px, -6px);
    background: var(--pop); width: 7px; height: 7px; border-radius: 50%;
  }

  .fab {
    display: grid; place-items: center;
    position: fixed; right: 16px; bottom: 76px; z-index: 41;
    width: 58px; height: 58px; border-radius: 50%;
    background: var(--accent); color: #fff; border: 0;
    font-size: 27px; font-weight: 400; line-height: 1;
    box-shadow: 0 4px 14px rgba(24,36,46,.22); cursor: pointer;
    padding-bottom: 3px;
  }

  .drawerbg {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: rgba(24,36,46,.35); opacity: 0; pointer-events: none;
    transition: opacity .18s ease;
  }
  .drawerbg.open { opacity: 1; pointer-events: auto; }
  .drawer {
    display: block; position: fixed; top: 0; right: 0; bottom: 0; z-index: 51;
    width: 280px; max-width: 86vw; background: var(--surface);
    border-left: 1px solid var(--line); padding: 20px 16px;
    overflow-y: auto; transform: translateX(100%); transition: transform .2s ease;
  }
  .drawer.open { transform: translateX(0); }
}

@media (min-width: 901px) {
  .mobileonly { display: none !important; }
}


/* ── Module panel (Progress) ──────────────────────────────────────────────
 * An in-page overlay, not a new window. Same backdrop treatment as the mobile
 * drawer so the app only ever has one way of covering itself.
 */

.sheetbg {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(24,36,46,.35);
  opacity: 0; pointer-events: none; transition: opacity .16s ease;
}
.sheetbg.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; z-index: 61; left: 50%; top: 50%;
  transform: translate(-50%, -48%) scale(.985);
  width: 620px; max-width: calc(100vw - 28px); max-height: 86vh;
  overflow-y: auto;
  background: var(--surface); border-radius: var(--r-card);
  box-shadow: 0 8px 40px rgba(24,36,46,.22);
  padding: 22px 22px 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.sheet.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }

.sheet .num {
  font-size: 10.5px; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent);
}
.sheet h2 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin: 3px 0 4px; }
.sheet .what { font-size: 14.5px; line-height: 1.5; margin: 12px 0 4px; }
.sheet h4 {
  font-size: 10.5px; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--sub); margin: 18px 0 7px;
}
.sheet ul { list-style: none; }
.sheet li {
  font-size: 13.5px; padding: 5px 0 5px 16px; position: relative; line-height: 1.45;
}
.sheet li::before {
  content: ""; position: absolute; left: 0; top: 12px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
.sheet li.wait::before { background: var(--attn-ink); }

.sheet .prompt {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-input);
  padding: 13px; font-size: 13px; line-height: 1.5; white-space: pre-wrap;
  max-height: 200px; overflow-y: auto;
}
.sheet .close {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 17px; line-height: 1; cursor: pointer; color: var(--sub);
}

.tappable { cursor: pointer; }
.tappable:hover { background: var(--bg); }

@media (max-width: 900px) {
  .sheet {
    left: 0; top: auto; bottom: 0; transform: translateY(14px);
    width: 100%; max-width: none; max-height: 90vh;
    border-radius: var(--r-card) var(--r-card) 0 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .sheet.open { transform: translateY(0); }
}


/* Task rows carry their two actions inline. On a phone they wrap under the
   title rather than squeezing the text. */
.row .rowacts { flex: none; }
@media (max-width: 900px) {
  .row { flex-wrap: wrap; }
  .row .grow { flex-basis: 100%; }
  .row .rowacts { margin-left: auto; }
  .row .rowacts form { flex-wrap: wrap; }
  .row .rowacts input { min-width: 0 !important; flex: 1; }
}


/* Task rows carry a line of what the task actually means, between the title
   and the actions. Clamped rather than truncated server-side, so a wide screen
   shows more of the same sentence instead of a different one. */
.rowctx {
  flex: 1.1;
  min-width: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--sub);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-right: 4px;
}

@media (max-width: 1100px) {
  .rowctx { -webkit-line-clamp: 3; }
}

@media (max-width: 900px) {
  /* On a phone it sits under the title rather than fighting it for width. */
  .rowctx {
    flex-basis: 100%;
    order: 3;
    -webkit-line-clamp: 2;
    margin-top: 2px;
    padding-right: 0;
  }
  .row .rowacts { order: 4; }
}


/* ── Signing in ───────────────────────────────────────────────────────────
 * Its own page rather than the browser's grey box. It's the first thing seen
 * every morning, so it should look like the rest of the Matrix.
 */

body.signin { display: grid; place-items: center; min-height: 100vh; padding: 20px; }

.signin-wrap { width: 100%; max-width: 380px; }

.signin-brand { text-align: center; margin-bottom: 26px; }
.signin-brand .eyebrow {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  font-weight: 700; color: var(--accent);
}
.signin-brand h1 {
  font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin-top: 2px;
}
.signin-brand p { font-size: 13.5px; color: var(--sub); font-weight: 600; margin-top: 6px; }

.signin-card { padding: 22px; }
.signin-card .field:last-of-type { margin-bottom: 18px; }

.signin-foot {
  text-align: center; font-size: 11.5px; color: var(--sub);
  font-weight: 500; margin-top: 20px; line-height: 1.5;
}

/* A quiet way out, in the sidebar footer and the drawer. */
.me .out {
  margin-left: auto; font-size: 11px; font-weight: 700; color: var(--sub);
  padding: 4px 8px; border-radius: var(--r-input);
}
.me .out:hover { background: var(--bg); color: var(--ink); }


/* The signature box. A real editable area rather than a textarea, so pasting
   from Outlook keeps its formatting instead of arriving as flat text. */
.sigbox {
  min-height: 120px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  padding: 13px;
  font-size: 14px;
  line-height: 1.5;
  overflow-x: auto;
}
.sigbox:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.sigbox img { max-width: 100%; height: auto; }
.sigbox:empty::before {
  content: "Paste your signature here";
  color: var(--sub);
}


/* Pages that branch off a section.
 *
 * A real tree rather than an indent: a hairline running down from the parent,
 * an elbow into each item, and the last one's line stopping at its own elbow —
 * which is what makes it read as finished rather than cut off.
 */
.nitem.child {
  position: relative;
  margin-left: 15px;
  padding-left: 26px;
  font-size: 13.5px;
  font-weight: 600;
  min-height: 34px;
  color: var(--sub);
}

/* the line coming down from the item above */
.nitem.child::before {
  content: "";
  position: absolute;
  left: 0;
  top: -4px;
  bottom: 0;
  width: 1.5px;
  background: var(--line);
}
.nitem.child.last::before { bottom: auto; height: calc(50% + 4px); }

/* the elbow into this item */
.nitem.child::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 12px;
  height: 1.5px;
  background: var(--line);
}

.nitem.child .twig { display: none; }
.nitem.child:hover { background: var(--bg); color: var(--ink); }
.nitem.child.on { background: var(--tint); color: var(--accent); font-weight: 700; }
.nitem.child.on::before,
.nitem.child.on::after { background: var(--accent); }

/* ── Signing in ───────────────────────────────────────────────────────────
 * Its own page rather than the browser's grey box. It's the first thing seen
 * every morning, so it should look like the rest of the Matrix.
 */

body.signin { display: grid; place-items: center; min-height: 100vh; padding: 20px; }

.signin-wrap { width: 100%; max-width: 380px; }

.signin-brand { text-align: center; margin-bottom: 26px; }
.signin-brand .eyebrow {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  font-weight: 700; color: var(--accent);
}
.signin-brand h1 {
  font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin-top: 2px;
}
.signin-brand p { font-size: 13.5px; color: var(--sub); font-weight: 600; margin-top: 6px; }

.signin-card { padding: 22px; }
.signin-card .field:last-of-type { margin-bottom: 18px; }

.signin-foot {
  text-align: center; font-size: 11.5px; color: var(--sub);
  font-weight: 500; margin-top: 20px; line-height: 1.5;
}

/* A quiet way out, in the sidebar footer and the drawer. */
.me .out {
  margin-left: auto; font-size: 11px; font-weight: 700; color: var(--sub);
  padding: 4px 8px; border-radius: var(--r-input);
}
.me .out:hover { background: var(--bg); color: var(--ink); }


/* The signature box. A real editable area rather than a textarea, so pasting
   from Outlook keeps its formatting instead of arriving as flat text. */
.sigbox {
  min-height: 120px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  padding: 13px;
  font-size: 14px;
  line-height: 1.5;
  overflow-x: auto;
}
.sigbox:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.sigbox img { max-width: 100%; height: auto; }
.sigbox:empty::before {
  content: "Paste your signature here";
  color: var(--sub);
}


/* A page belonging to the section above it. Indented, quieter, and only shown
   while that section is open — the sidebar stays short until it's useful. */
.nitem.child {
  margin-left: 16px;
  padding-left: 10px;
  font-size: 13.5px;
  font-weight: 600;
  min-height: 34px;
  border-left: 1.5px solid var(--line);
  border-radius: 0 var(--r-input) var(--r-input) 0;
}
.nitem.child .dot { width: 5px; height: 5px; background: var(--line); }
.nitem.child.on { background: var(--tint); color: var(--accent); }
.nitem.child.on .dot { background: var(--accent); }

/* ── The roster (4.14) ──────────────────────────────────────────────────────
 * Agents read as staff, so they're laid out like a team page — faces first,
 * seven to a row, wrapping to a new row as the roster grows. */

.roster { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
/* Full width the roster gets ~1100px, so seven faces sit at about 150px
   each — comfortable. It only needs to drop to four once a laptop is
   narrow enough that seven would start squeezing the names. */
@media (max-width: 980px)  { .roster { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 760px)  { .roster { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 420px)  { .roster { grid-template-columns: repeat(2, 1fr); } }

.mate {
  position: relative; display: block; text-decoration: none; color: inherit;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 14px 8px 12px; text-align: center;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.mate:hover { transform: translateY(-2px); box-shadow: var(--shadow);
              border-color: var(--accent); background: var(--surface); }

.mate .face {
  width: 46px; height: 46px; margin: 0 auto 8px; border-radius: 50%;
  background: var(--tint); display: flex; align-items: center;
  justify-content: center; font-size: 23px; line-height: 1;
}
.mate.acts .face { background: var(--attn-bg); }
.mate .who   { font-size: 13px; font-weight: 700; line-height: 1.25; }
.mate .job   { font-size: 11px; color: var(--sub); margin-top: 2px;
               line-height: 1.3; }

/* Status as a dot, not a word — seven words in a row is a wall of text. */
.mate .dot { position: absolute; top: 10px; right: 10px; width: 8px; height: 8px;
             border-radius: 50%; background: var(--line); }
.mate .dot.ok    { background: var(--good-ink); }
.mate .dot.failed{ background: #C0483B; }
.mate .dot.idle  { background: var(--line); }

/* ── An agent's own page ───────────────────────────────────────────────── */

.profile { display: flex; align-items: center; gap: 16px; margin-bottom: 4px; }
.profile .face {
  width: 62px; height: 62px; border-radius: 50%; background: var(--tint);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; flex: none;
}
.profile.acts .face { background: var(--attn-bg); }

.taught { border-left: 3px solid var(--tint); padding: 2px 0 2px 12px;
          margin: 0 0 14px; }
.taught:last-child { margin-bottom: 0; }
.taught.said { border-left-color: var(--accent); }
.taught .words { font-size: 14px; line-height: 1.5; }
.taught .meta  { font-size: 12px; color: var(--sub); margin-top: 4px; }
.taught .became { font-size: 12px; color: var(--sub); margin-top: 5px;
                  padding-left: 10px; border-left: 2px solid var(--line); }

.scoreline { display: flex; align-items: baseline; gap: 10px; padding: 9px 0;
             border-bottom: 1px solid var(--line); }
.scoreline:last-child { border-bottom: 0; }
.scoreline .big { font-size: 19px; font-weight: 800; min-width: 78px; }
.scoreline .big.good { color: var(--good-ink); }
.scoreline .lbl { font-size: 13px; font-weight: 600; }
.scoreline .sub { font-size: 12px; color: var(--sub); margin-top: 1px; }

.cant li { font-size: 13px; line-height: 1.55; margin-bottom: 5px; }

/* The roster also appears on Progress, inside a half-width column — seven
   across is 70px a head there, which is nobody's idea of a face. */
.roster.compact { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .roster.compact { grid-template-columns: repeat(3, 1fr); } }

/* ── The source material (4.9/4.11, and 4.8's reading pane later) ───────────
 * A task carries its evidence, not a summary of it. Reading one should feel
 * like being in the conversation, so this is styled like a message, not like a
 * field on a form. */

.msg {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-input); padding: 14px 16px; margin-bottom: 12px;
}
.msg.quiet { background: transparent; border-style: dashed; }

.msg-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.msg-who  { font-size: 14px; font-weight: 700; }
.msg-when { font-size: 12px; color: var(--sub); }
.msg-subject {
  font-size: 13px; font-weight: 600; color: var(--sub);
  margin-top: 3px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.msg-body {
  font-size: 14px; line-height: 1.6; margin-top: 10px;
  overflow-wrap: anywhere;
}
.msg-body.dim { color: var(--sub); font-size: 13px; }

/* Folded-away things: the quoted chain, older messages. Present, not shouting. */
details.quoted { margin: 4px 0 12px; }
details.quoted > summary {
  cursor: pointer; font-size: 12px; color: var(--sub);
  padding: 6px 0; list-style: none;
}
details.quoted > summary::-webkit-details-marker { display: none; }
details.quoted > summary::before { content: "▸ "; }
details.quoted[open] > summary::before { content: "▾ "; }
details.quoted > summary:hover { color: var(--accent); }

.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
         gap: 10px; }
.shot  { width: 100%; border-radius: var(--r-input); border: 1px solid var(--line);
         display: block; }

/* ── "About this page…" (4.27) ───────────────────────────────────────────────
 * Present on every screen, in the same corner every time, so it's muscle
 * memory rather than a hunt. Quiet until you want it. */

.aboutbtn { position: fixed; right: 18px; bottom: 18px; z-index: 40; margin: 0; }
.aboutbtn button {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  min-height: var(--tap); padding: 0 16px;
  background: var(--surface); color: var(--sub);
  border: 1px solid var(--line); border-radius: var(--r-chip);
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 8px;
  transition: color .12s ease, border-color .12s ease;
}
.aboutbtn button::before { content: "💬"; font-size: 15px; }
.aboutbtn button:hover { color: var(--accent); border-color: var(--accent); }

/* On a phone it goes bottom-LEFT, opposite the + button.
   It was on the right at 70px, and + is at 76px with a higher z-index — so it
   sat underneath and Ollie had to turn the phone landscape to reach it. Two
   round buttons in one corner is a collision waiting to happen; one each side
   is a pair. Same height and size as +, so they read as deliberate. */
@media (max-width: 760px) {
  .aboutbtn { left: 16px; right: auto; bottom: 76px; }
  .aboutbtn button {
    padding: 0; width: 58px; height: 58px; border-radius: 50%;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(24,36,46,.22);
  }
  .aboutbtn button span { display: none; }
  .aboutbtn button::before { font-size: 22px; }
}
