/* ============================================================================
   Ionix Creative Studio — flat product UI
   Matched to the Auréa Aesthetics reference: warm near-white canvas, white
   cards on hairline borders, quiet sidebar with count badges, one big bold
   page title, and near-black as the only strong colour.

   No gradients, no bezels, no drop shadows beyond a 1px lift on raised
   controls. Colour appears only where it carries meaning — status, tinted
   media, the accent dot per client.

   Class names are unchanged from earlier skins, so app.js is untouched.
   ========================================================================= */

:root {
  --bg: #F7F7F5;          /* warm off-white canvas */
  --surface: #FFFFFF;
  --raised: #FFFFFF;
  --sunken: #F1F1EF;      /* segmented-control troughs, inputs */

  --line: #E7E7E3;        /* the hairline everything is drawn with */
  --line-2: #DCDCD7;

  --ink: #1A1A18;
  --muted: #6E6E68;
  --dim: #9A9A93;

  --good: #2F8C63;
  --bad: #C0463C;
  --warn: #B07A18;
  --live: #2E93A8;
  --violet: #6F5BD0;

  /* Per-client accent: dots, tints and focus rings. Never body text — a
     mid-tone brand colour on near-white lands around 1.2–2.4:1. */
  --acc: #1A1A18;
  --acc-soft: color-mix(in srgb, var(--acc) 9%, transparent);
  --acc-line: color-mix(in srgb, var(--acc) 30%, transparent);

  --rail: 268px;
  --insp: 344px;
  --r: 12px;
  --r-lg: 14px;

  --font: Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  font-size: 14px;
  letter-spacing: -.008em;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) 0;
  transition: grid-template-columns .2s ease;
  overflow: hidden;
}
body.inspOpen { grid-template-columns: var(--rail) minmax(0, 1fr) var(--insp); }

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: var(--ink); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #D6D6D1; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #C2C2BC; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ── sidebar ────────────────────────────────────────────────────────────── */

.rail {
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 16px 16px 14px; }
.mark {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  font-weight: 600; font-size: 12px; letter-spacing: .01em;
  background: var(--ink); color: #fff;
}
.bt { font-weight: 550; font-size: 14.5px; letter-spacing: -.015em; }
.bs { font-size: 10.5px; color: var(--dim); margin-top: 1px; font-family: var(--mono); }
.bs.live { color: var(--live); }

.railScroll { flex: 1; overflow-y: auto; padding: 6px 10px 8px; min-height: 0; }
.secHead {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 8px 6px; font-size: 10px; letter-spacing: .09em;
  text-transform: uppercase; color: var(--dim); font-weight: 600;
}
.railSearch {
  width: 100%; padding: 7px 10px; margin-bottom: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; font-size: 12.5px;
}
.railSearch::placeholder { color: var(--dim); }
.railSearch:focus { outline: none; border-color: var(--line-2); }

.clients, .threads { display: flex; flex-direction: column; gap: 1px; }
.clientRow, .threadRow, .navItem {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 8px; text-align: left;
  color: var(--muted); font-size: 13.5px;
  border: 1px solid transparent;
  transition: background .12s ease, color .12s ease;
}
.clientRow:hover, .threadRow:hover, .navItem:hover { background: #EFEFEC; color: var(--ink); }
.clientRow[aria-current="true"], .threadRow[aria-current="true"], .navItem[aria-current="true"] {
  background: var(--surface); border-color: var(--line); color: var(--ink); font-weight: 550;
}
.dot { width: 7px; height: 7px; border-radius: 99px; flex: none; }
.clientRow .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clientRow .ct, .threadRow .ct { font-size: 11.5px; color: var(--dim); flex: none; font-variant-numeric: tabular-nums; }

.clientRow.loc { padding-left: 20px; position: relative; font-size: 13px; }
.clientRow.loc::before { content: ''; position: absolute; left: 14px; top: 4px; bottom: 4px; border-left: 1px solid var(--line); }
.clientRow.loc .dot { width: 5px; height: 5px; }

.threadRow { font-size: 13px; }
.threadRow .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.railHint { padding: 2px 10px 8px; font-size: 12px; color: var(--dim); }

.navList { display: flex; flex-direction: column; gap: 1px; }
.navItem i { font-style: normal; width: 16px; text-align: center; font-size: 13px; color: var(--dim); }
.navItem[aria-current="true"] i { color: var(--ink); }
.badge {
  margin-left: auto; background: var(--live); color: #fff; font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 99px; font-variant-numeric: tabular-nums;
}

.railFoot { padding: 10px 12px 12px; }
.whoami { margin-top: 8px; }
.me {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border-radius: 10px; text-align: left; background: var(--surface); border: 1px solid var(--line);
  transition: border-color .12s ease;
}
.me:hover { border-color: var(--line-2); }
.av {
  width: 26px; height: 26px; border-radius: 99px; flex: none; display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: #fff; background: var(--violet);
}
.av.sm { width: 30px; height: 30px; font-size: 12.5px; }
.me .who { min-width: 0; line-height: 1.35; }
.me .who .n { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who .r { display: block; font-size: 11px; color: var(--dim); }

.health { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.hchip {
  font-size: 10px; font-family: var(--mono); padding: 2px 7px; border-radius: 6px;
  color: var(--dim); background: var(--surface); border: 1px solid var(--line);
}
.hchip.ok { color: var(--good); }
.hchip.no { color: var(--bad); }

/* ── buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 0 14px; height: 34px; border-radius: 9px;
  font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 1px 1px rgba(20, 20, 16, .03);
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: #FBFBFA; border-color: var(--line-2); }
.btn:active { background: #F4F4F2; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 500; }
.btn.primary:hover { background: #2C2C28; border-color: #2C2C28; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
.btn.ghost:hover { background: #EFEFEC; color: var(--ink); }
.btn.danger { color: var(--bad); border-color: var(--line); }
.btn.danger:hover { background: #FDF5F4; border-color: #E9CBC8; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn.block { width: 100%; }

.mini {
  width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  font-size: 14px; line-height: 1; color: var(--dim); padding: 0;
}
.mini:hover { background: #EFEFEC; color: var(--ink); }

/* ── main ───────────────────────────────────────────────────────────────── */

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  padding: 20px 26px 16px; background: var(--bg);
}
.top h1 { margin: 0; font-size: 27px; font-weight: 650; letter-spacing: -.035em; line-height: 1.1; }
.crumb { font-size: 12.5px; color: var(--dim); margin-bottom: 5px; order: -1; }
.topL { display: flex; flex-direction: column; }
.topR { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.stage { flex: 1; overflow-y: auto; padding: 4px 26px 60px; min-height: 0; }

/* ── command palette ────────────────────────────────────────────────────── */

.topMid { flex: 1; display: flex; justify-content: center; max-width: 420px; }
.palTrigger {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; padding: 0 12px;
  border-radius: 9px; background: var(--surface); border: 1px solid var(--line);
  color: var(--dim); font-size: 13px; transition: border-color .12s ease;
}
.palTrigger:hover { border-color: var(--line-2); }
.palTrigger .t { flex: 1; text-align: left; }
.palIcon { font-size: 14px; color: var(--dim); }
.kbd {
  font-family: var(--mono); font-size: 10.5px; color: var(--dim);
  background: var(--sunken); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
}

.pal { position: fixed; inset: 0; z-index: 85; display: grid; place-items: start center; padding: 12vh 24px 24px; }
.palBack { position: absolute; inset: 0; background: rgba(26, 26, 24, .28); }
.palBox {
  position: relative; width: min(620px, 100%); background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: 0 20px 60px -16px rgba(20, 20, 16, .3);
}
.palIn { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.palIn input { flex: 1; border: 0; outline: none; font-size: 15px; background: none; color: var(--ink); }
.palIn input::placeholder { color: var(--dim); }
.palHint { font-family: var(--mono); font-size: 10.5px; color: var(--dim); background: var(--sunken); border-radius: 5px; padding: 2px 6px; }

.palList { max-height: 54vh; overflow-y: auto; padding: 6px; }
.palGroup { font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--dim); font-weight: 600; padding: 10px 10px 5px; }
.palRow {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border-radius: 8px; text-align: left; font-size: 13.5px; color: var(--ink);
}
.palRow[aria-selected="true"] { background: var(--sunken); }
.palRowIcon { width: 18px; text-align: center; color: var(--dim); font-size: 12px; flex: none; }
.palRowT { flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palRowH { margin-left: auto; font-size: 11.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palEmpty { padding: 22px 12px; text-align: center; color: var(--dim); font-size: 13px; }

/* ── filters ────────────────────────────────────────────────────────────── */

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.seg { display: flex; padding: 3px; border-radius: 10px; background: var(--sunken); }
.seg button {
  padding: 5px 12px; border-radius: 7px; font-size: 12.5px; color: var(--muted);
  border: 1px solid transparent; transition: .12s ease;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] {
  color: var(--ink); font-weight: 550; background: var(--surface);
  border-color: var(--line); box-shadow: 0 1px 2px rgba(20, 20, 16, .05);
}
.fInput {
  padding: 7px 12px; border-radius: 9px; font-size: 12.5px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); min-width: 180px;
}
.fInput::placeholder { color: var(--dim); }
.fInput:focus { outline: none; border-color: var(--line-2); }
select.fInput { min-width: 0; padding-right: 8px; }

/* ── gallery ────────────────────────────────────────────────────────────── */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 14px; align-items: start; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; transition: border-color .12s ease, box-shadow .12s ease;
}
.card:hover { border-color: var(--line-2); box-shadow: 0 2px 6px rgba(20, 20, 16, .05); }
.card[data-sel="true"] { border-color: var(--ink); }
/* Media wells stay dark: a creative has to be judged against neutral. */
.card .shot { position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; overflow: hidden; background: #1A1A18; cursor: zoom-in; }
.card .shot img, .card .shot video { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .shot .miss { display: grid; place-items: center; height: 100%; color: rgba(255,255,255,.38); font-size: 11px; font-family: var(--mono); }
.card .pill {
  position: absolute; top: 8px; left: 8px; font-size: 10px; font-family: var(--mono);
  padding: 2px 7px; border-radius: 6px; color: var(--ink); background: rgba(255,255,255,.94);
}
.card .pill.r { left: auto; right: 8px; }
.card .pill.loc { max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .play { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.card .play span {
  width: 40px; height: 40px; border-radius: 99px; display: grid; place-items: center;
  color: var(--ink); font-size: 13px; padding-left: 3px; background: rgba(255,255,255,.94);
}
.card .meta { padding: 11px 12px 12px; }
.card .t { font-size: 13px; font-weight: 550; letter-spacing: -.015em; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .s { font-size: 11.5px; color: var(--dim); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .perf {
  margin-top: 9px; font-size: 11px; line-height: 1.4; color: var(--muted);
  padding: 5px 8px; border-radius: 8px; background: var(--sunken);
  font-variant-numeric: tabular-nums;
}
.card .perf.win { color: var(--good); background: #EDF7F2; }
.card .perf.lose { color: var(--bad); background: #FCF1F0; }
.card .perf.thin { color: var(--dim); }
.card[data-grade="winner"] { border-color: #BFE0CF; }

.card .acts { display: flex; gap: 6px; margin-top: 10px; }
.tick {
  flex: 1; border-radius: 8px; padding: 6px 0; font-size: 12px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); transition: .12s ease;
}
.tick:hover { background: #FBFBFA; color: var(--ink); }
.tick.yes[data-on="true"] { color: #fff; background: var(--good); border-color: var(--good); font-weight: 550; }
.tick.no[data-on="true"] { color: #fff; background: var(--bad); border-color: var(--bad); font-weight: 550; }
.star { flex: none; width: 32px; }
.star[data-on="true"] { color: var(--warn); border-color: #E8D5AE; background: #FDF8EE; }

/* ── surfaces ───────────────────────────────────────────────────────────── */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.panel + .panel { margin-top: 14px; }
.panel h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.panel .hint { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; line-height: 1.6; }

.empty { text-align: center; padding: 72px 20px; color: var(--muted); }
.empty .big { font-size: 30px; margin-bottom: 12px; color: var(--dim); }
.empty p { margin: 0 0 18px; font-size: 13.5px; max-width: 460px; margin-inline: auto; line-height: 1.65; }
.empty strong { color: var(--ink); }

.rows { display: flex; flex-direction: column; gap: 6px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  text-align: left; transition: border-color .12s ease;
}
.row:hover { border-color: var(--line-2); }
.row .g { flex: 1; min-width: 0; }
.row .n { display: block; font-size: 13px; font-weight: 550; letter-spacing: -.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .d { display: block; font-size: 12px; color: var(--dim); margin-top: 2px; line-height: 1.5; }
.row .d.wrap { white-space: normal; }

/* Stat tiles — micro uppercase label over a value, exactly as in the reference. */
.stat {
  font-size: 11px; padding: 3px 9px; border-radius: 7px; color: var(--muted); white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.stat.run { color: var(--live); border-color: #BFDFE6; background: #F0F8FA; }
.stat.done { color: var(--good); border-color: #BFE0CF; background: #F1F9F5; }
.stat.fail { color: var(--bad); border-color: #E9CBC8; background: #FDF5F4; }
.stat.queued { color: var(--warn); border-color: #E8D5AE; background: #FDF8EE; }
.stat.acc { color: var(--ink); }

/* ── forms ──────────────────────────────────────────────────────────────── */

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field .sub { font-size: 11.5px; color: var(--dim); margin-top: 5px; line-height: 1.5; }
.inp {
  width: 100%; padding: 9px 12px; border-radius: 9px; font-size: 13px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
}
.inp:focus { outline: none; border-color: var(--ink); }
.inp::placeholder { color: var(--dim); }
textarea.inp { resize: vertical; min-height: 86px; line-height: 1.6; }
textarea.code { font-family: var(--mono); font-size: 11.5px; line-height: 1.65; min-height: 420px; background: var(--sunken); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 11px; border-radius: 99px; font-size: 12.5px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); transition: .12s ease;
}
.chip:hover { color: var(--ink); border-color: var(--line-2); }
.chip[aria-pressed="true"] { color: var(--ink); font-weight: 550; border-color: var(--ink); }
.swatch { width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: none; }

.switch { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); cursor: pointer; flex: none; }
.switch input {
  appearance: none; width: 40px; height: 23px; border-radius: 99px; position: relative; cursor: pointer;
  background: #D9D9D4; transition: background .16s ease;
}
.switch input::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 99px;
  background: #fff; box-shadow: 0 1px 2px rgba(20,20,16,.2); transition: transform .16s ease;
}
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(17px); }

/* ── billing ────────────────────────────────────────────────────────────── */

.planHead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.planName { font-size: 17px; font-weight: 600; letter-spacing: -.025em; display: flex; align-items: center; gap: 9px; }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.meter { }
.meterHead { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }
.meterHead b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.meterHead b.over { color: var(--bad); }
.meterBar { height: 6px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.meterBar i { display: block; height: 100%; background: var(--ink); border-radius: 99px; transition: width .3s ease; }
.meterBar i.over { background: var(--bad); }
.meterNote { font-size: 11.5px; color: var(--dim); }

/* ── API keys ───────────────────────────────────────────────────────────── */

.brokerBox { border: 1px solid var(--line); border-radius: var(--r); background: var(--sunken); padding: 14px 15px; margin-bottom: 14px; }
.brokerHead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brokerHead .n { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.brokerCols { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.brokerCols label { display: block; font-size: 11px; color: var(--dim); margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }

.keyList { display: flex; flex-direction: column; gap: 10px; }
.keyRow { padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.keyHead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.keyName { font-size: 13.5px; font-weight: 550; letter-spacing: -.015em; }
.keyId { color: var(--dim); font-weight: 400; margin-left: 8px; font-size: 11px; }
.keyState {
  font-size: 11.5px; color: var(--dim); font-family: var(--mono); white-space: nowrap;
  max-width: 46%; overflow: hidden; text-overflow: ellipsis;
}
.keyState.on { color: var(--muted); }
.keyState.ok { color: var(--good); }
.keyState.bad { color: var(--bad); white-space: normal; }
.keyIn { display: flex; gap: 7px; align-items: center; }
.keyIn .inp { flex: 1; }
.keyRow .sub { font-size: 11.5px; color: var(--dim); margin-top: 8px; line-height: 1.5; }

/* ── inspector ──────────────────────────────────────────────────────────── */

.inspector { background: var(--bg); border-left: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
body:not(.inspOpen) .inspector { display: none; }
.inspHead { display: flex; align-items: center; justify-content: space-between; padding: 15px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; font-weight: 600; }
.inspBody { flex: 1; overflow-y: auto; padding: 15px 16px 40px; min-height: 0; }
.inspShot { border-radius: var(--r); overflow: hidden; background: #1A1A18; border: 1px solid var(--line); margin-bottom: 14px; }
.inspShot img, .inspShot video { width: 100%; display: block; }
.kv { display: grid; grid-template-columns: 88px 1fr; gap: 6px 10px; font-size: 12px; margin-bottom: 14px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; color: var(--ink); word-break: break-word; font-family: var(--mono); font-size: 11px; }

/* ── job console ────────────────────────────────────────────────────────── */

.console {
  border: 1px solid var(--line); border-radius: var(--r); background: var(--sunken);
  font-family: var(--mono); font-size: 11.5px; line-height: 1.65;
  padding: 12px 14px; height: 100%; min-height: 260px; overflow-y: auto;
}
.console.tall { height: calc(100vh - 268px); }
.ln { display: flex; gap: 9px; padding: 1.5px 0; }
.ln .tag { flex: none; width: 62px; color: var(--dim); font-size: 10px; padding-top: 2px; text-align: right; }
.ln .tx { flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word; color: var(--muted); }
.ln.tool .tag, .ln.tool .tx { color: var(--live); }
.ln.text .tx { color: var(--ink); }
.ln.err .tag, .ln.err .tx { color: var(--bad); }
.ln.status .tag, .ln.status .tx { color: var(--ink); }
.ln.result .tx { color: var(--good); }
.ln.tres .tx { color: var(--dim); }

.pulse { display: inline-block; width: 6px; height: 6px; border-radius: 99px; background: var(--live); animation: p 1.2s ease-in-out infinite; }
@keyframes p { 0%, 100% { opacity: .35 } 50% { opacity: 1 } }

/* ── chat ───────────────────────────────────────────────────────────────── */

body[data-view="chat"] .stage { padding: 0; overflow: hidden; }
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.stream { flex: 1; overflow-y: auto; padding: 20px 26px 8px; min-height: 0; }
.stream > * { max-width: 780px; margin-inline: auto; }

.chatIntro { padding: 32px 4px; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.chatIntro em { color: var(--ink); font-style: normal; }
.chatIntro p { margin: 0 0 12px; }

.bubble { margin-bottom: 22px; }
.bubble .bd { font-size: 14px; line-height: 1.65; }
.bubble .bd p { margin: 0 0 10px; }
.bubble .bd p:last-child { margin-bottom: 0; }
.bubble .bd ul { margin: 6px 0 10px; padding-left: 20px; }
.bubble .bd li { margin-bottom: 4px; }
.bubble .bd h4 { margin: 14px 0 6px; font-size: 13px; font-weight: 600; }
.bubble .bd code { background: var(--sunken); padding: 1px 5px; border-radius: 5px; font-family: var(--mono); font-size: 11.5px; }
.bubble .bd pre { background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; overflow-x: auto; font-family: var(--mono); font-size: 11.5px; line-height: 1.65; }
.bubble .bd.err { color: var(--bad); }
.bubble.user .bd {
  padding: 11px 14px; border-radius: var(--r-lg); margin-left: auto; width: fit-content; max-width: 88%;
  white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line);
}
.bubble.assistant .who { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.bubble.assistant .who .stopBtn { margin-left: auto; }
.bubble.assistant.failed { border-left: 2px solid var(--bad); padding-left: 13px; }
.bubble .mline { font-size: 11px; color: var(--dim); margin-top: 10px; }
.bubble .mline a { color: var(--dim); }
.bubble .mline a:hover { color: var(--ink); }

.live { border-left: 2px solid var(--line-2); padding-left: 13px; font-family: var(--mono); font-size: 11px; color: var(--dim); line-height: 1.7; }
.liveLn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.liveLn .tn { color: var(--live); }

.inlineGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; align-items: start; }
.ic { margin: 0; border-radius: var(--r); overflow: hidden; background: #1A1A18; border: 1px solid var(--line); cursor: zoom-in; transition: border-color .12s ease; }
.ic:hover { border-color: var(--line-2); }
.ic img, .ic video { display: block; width: 100%; height: auto; }
.ic figcaption { padding: 8px 10px; font-size: 11.5px; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; background: var(--surface); color: var(--ink); }
.ic figcaption span { color: var(--dim); font-size: 10px; flex: none; }

.composer { border-top: 1px solid var(--line); padding: 12px 26px 16px; background: var(--bg); }
.composer > * { max-width: 780px; margin-inline: auto; }
.compTools { display: flex; gap: 8px; align-items: center; margin-bottom: 9px; }
.compRefs { font-size: 11.5px; color: var(--muted); }
.compRow { display: flex; gap: 9px; align-items: flex-end; }
.compRow textarea {
  flex: 1; resize: none; border-radius: var(--r); padding: 11px 14px; font-size: 14px; line-height: 1.55;
  max-height: 220px; overflow-y: auto; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
}
.compRow textarea:focus { outline: none; border-color: var(--ink); }
.compRow .send { height: 42px; border-radius: var(--r); padding: 0 20px; }
.compHint { display: flex; gap: 10px; font-size: 11px; color: var(--dim); margin-top: 8px; }

/* ── modal + dialog ─────────────────────────────────────────────────────── */

.modalWrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; }
.modalBack { position: absolute; inset: 0; background: rgba(26, 26, 24, .28); }
.modal {
  position: relative; width: min(720px, 100%); max-height: 88vh; overflow-y: auto;
  border-radius: 16px; padding: 22px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 12px 40px -12px rgba(20, 20, 16, .22);
}
.modal.wide { width: min(1080px, 100%); }
.modal h2 { margin: 0 0 5px; font-size: 18px; font-weight: 600; letter-spacing: -.025em; }
.modal .lead { color: var(--muted); font-size: 12.5px; margin: 0 0 18px; line-height: 1.6; }
.modalFoot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

.dlgWrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; }
.dlg {
  position: relative; width: min(430px, 100%); border-radius: 16px; padding: 20px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 16px 48px -12px rgba(20, 20, 16, .3);
}
.dlg h2 { margin: 0 0 6px; font-size: 16.5px; font-weight: 600; letter-spacing: -.02em; }
.dlg .lead { color: var(--muted); font-size: 12.5px; margin: 0; line-height: 1.6; }
.dlg .modalFoot { margin-top: 18px; }

/* ── lightbox ───────────────────────────────────────────────────────────── */

.lb { position: fixed; inset: 0; z-index: 80; background: rgba(20, 20, 18, .9); display: flex; align-items: center; justify-content: center; }
.lbStage { max-width: 90vw; max-height: 82vh; display: grid; place-items: center; }
.lbStage img, .lbStage video { max-width: 90vw; max-height: 82vh; border-radius: 10px; display: block; }
.lbClose, .lbNav { position: absolute; color: var(--ink); border-radius: 99px; background: var(--surface); border: 1px solid var(--line); }
.lbClose { top: 18px; right: 20px; width: 34px; height: 34px; }
.lbNav { top: 50%; transform: translateY(-50%); width: 42px; height: 42px; font-size: 19px; line-height: 1; }
.lbNav.prev { left: 20px; } .lbNav.next { right: 20px; }
.lbBar { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; padding: 8px 15px; border-radius: 99px; font-size: 12.5px; background: var(--surface); border: 1px solid var(--line); }
.lbBar .m { color: var(--dim); font-size: 11px; }

/* ── toasts ─────────────────────────────────────────────────────────────── */

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  border-radius: var(--r); padding: 11px 15px; font-size: 13px; max-width: 380px; line-height: 1.55;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 6px 20px -8px rgba(20, 20, 16, .2);
  animation: tin .18s ease;
}
.toast.good { border-color: #BFE0CF; }
.toast.bad { border-color: #E9CBC8; }
@keyframes tin { from { opacity: 0; transform: translateY(6px) } }

/* ── misc ───────────────────────────────────────────────────────────────── */

.note { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.warnBox { border-radius: var(--r); padding: 11px 13px; font-size: 12.5px; color: #7A5A14; line-height: 1.6; background: #FDF8EE; border: 1px solid #EFE0BE; }
.flagBox { border-radius: var(--r); padding: 10px 12px; font-size: 12.5px; color: #7A5A14; margin-top: 11px; line-height: 1.55; background: #FDF8EE; border: 1px solid #EFE0BE; }
.flagBox ul { margin: 6px 0 0; padding-left: 18px; }
.flagBox li { margin-bottom: 3px; }
.mono { font-family: var(--mono); font-size: 11.5px; }
.sep { height: 1px; background: var(--line); margin: 16px 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 15px; }
.tabs button { border-bottom: 2px solid transparent; padding: 9px 12px; color: var(--muted); font-size: 13px; }
.tabs button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 550; }
.split { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 16px; align-items: start; }
.scrollList { max-height: calc(100vh - 214px); overflow-y: auto; padding-right: 4px; }

@media (max-width: 1180px) {
  body { grid-template-columns: 62px minmax(0, 1fr) 0; }
  body.inspOpen { grid-template-columns: 62px minmax(0, 1fr) var(--insp); }
  .rail .bt, .rail .bs, .clientRow .nm, .clientRow .ct, .navItem span:not(.badge),
  .railSearch, .secHead, .railFoot .btn, .health, .threads, .railHint, .whoami { display: none; }
  .navItem { justify-content: center; }
  /* The rail collapses, so ⌘K becomes the main way to navigate — keep it, but
     let it shrink rather than squeeze the page actions out. */
  .topMid { max-width: 200px; }
  .palTrigger .t, .palTrigger .kbd { display: none; }
}
@media (max-width: 900px) {
  .topMid { display: none; }
}

/* ── storage / retention ─────────────────────────────────────────────────── */
.stList { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.stRow { display: grid; grid-template-columns: minmax(0, 1fr) 110px 84px; gap: 12px; align-items: start;
  padding: 12px 13px; border-bottom: 1px solid var(--line); }
.stRow:last-child { border-bottom: 0; }
/* NB: not .empty — that is the global empty-state class (centred, 72px pad).
   A group with nothing in it still earns its row — "nothing to reclaim" is the
   answer people came for. It just shouldn't compete for attention. */
.stRow.quiet { opacity: .55; }
.stLabel { font-size: 13px; font-weight: 550; color: var(--ink); }
.stRow .tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 99px; font-size: 10px;
  font-weight: 600; letter-spacing: .02em; color: var(--muted); background: var(--bg); border: 1px solid var(--line); }
.stFiles { margin-top: 6px; color: var(--dim); line-height: 1.7; word-break: break-all; }
.stSize { text-align: right; font-size: 13px; }
.stFoot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 13px; }
.stFoot b { font-size: 15px; }
@media (max-width: 760px) {
  .stRow { grid-template-columns: minmax(0, 1fr) 90px; }
  .stRow > button, .stRow > span:last-child { grid-column: 2; text-align: right; }
}

/* Dialog bodies are HTML-escaped (deliberately — they carry client names and
   file paths), so a multi-line confirm has to keep its newlines in CSS rather
   than by passing <br> through the escaper. */
#dlg .lead { white-space: pre-line; }

/* ── cost & margin ───────────────────────────────────────────────────────── */
.costGrid { display: grid; grid-template-columns: minmax(0,1.6fr) repeat(7, minmax(52px, .7fr));
  gap: 0; border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; font-size: 12.5px; }
.costGrid > div { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.costGrid > div.r { text-align: right; font-variant-numeric: tabular-nums; }
.costHead { font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--muted);
  background: var(--bg); text-transform: uppercase; }
/* The totals row carries the number people quote, so it gets the emphasis. */
.costFoot { font-weight: 600; background: var(--bg); border-bottom: 0 !important; }
@media (max-width: 900px) {
  .costGrid { grid-template-columns: minmax(0,1.4fr) repeat(7, minmax(60px, auto)); min-width: 640px; }
}

/* ── share links ─────────────────────────────────────────────────────────── */
.shList { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.shList > .hint { margin: 0; padding: 14px 13px; }
.shRow { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.shRow:last-child { border-bottom: 0; }
/* NB: its own rule — .quiet alone is scoped to .stRow and would not apply here. */
.shRow.quiet { opacity: .5; }
.shRow > div:first-child { flex: 1; min-width: 0; }
.shLabel { font-size: 13px; font-weight: 550; }
.shNew { margin-top: 14px; padding: 12px 13px; border-radius: var(--r);
  background: #F3F8F4; border: 1px solid #CFE3D5; }
.shUrl { display: flex; gap: 8px; margin-top: 7px; }
.shUrl input { flex: 1; min-width: 0; font-size: 12px; }

/* ── URL onboarding ──────────────────────────────────────────────────────── */
.scanBar { display: flex; align-items: center; gap: 14px; padding: 12px 13px; margin: 14px 0 4px;
  border: 1px dashed var(--line); border-radius: var(--r); background: var(--bg); }
.scanBar > div { flex: 1; }
.scanT { font-size: 13px; font-weight: 550; }
.accRow { display: flex; flex-wrap: wrap; gap: 8px; }
.accPick { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 10px; cursor: pointer; font-size: 12px; }
.accPick input { display: none; }
.accPick:has(input:checked) { border-color: var(--ink); background: var(--bg); }
.accPick .sw { width: 16px; height: 16px; border-radius: 5px; border: 1px solid rgba(0,0,0,.12); flex: none; }
.claimList { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.claimRow { display: flex; gap: 9px; align-items: flex-start; padding: 9px 11px;
  border-bottom: 1px solid var(--line); font-size: 12.5px; cursor: pointer; }
.claimRow:last-child { border-bottom: 0; }
.claimRow .sub { display: block; word-break: break-all; }
/* A dense contact sheet: the point is to cull fast, so keep them small. */
.shotPick { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 7px;
  max-height: 260px; overflow-y: auto; padding: 3px; }
.pick { position: relative; cursor: pointer; border-radius: 9px; overflow: hidden; aspect-ratio: 1;
  border: 2px solid transparent; background: var(--bg); }
.pick img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .45; }
.pick input { position: absolute; top: 5px; left: 5px; margin: 0; z-index: 2; }
.pick:has(input:checked) { border-color: var(--ink); }
.pick:has(input:checked) img { opacity: 1; }
