/* Pandora Studio.

   The product's whole claim is that nothing reaches a phone call unchecked, so
   the interface is built as a readout rather than a brochure: measurements sit
   in tabular figures, state is carried by one signal colour, and the only thing
   allowed to be loud is a number. Cards, gradients and decorative motion are
   deliberately absent — they would sell where this should report. */

:root {
  --paper:      #FBFBFA;
  --surface:    #FFFFFF;
  --ink:        #16191D;
  --muted:      #6E757E;
  --faint:      #9AA0A6;
  --line:       #E4E6E9;
  --line-soft:  #EFF0F2;
  --signal:     #1F5EFF;
  --signal-dim: #EDF2FF;
  --pass:       #0F7B54;
  --pass-dim:   #E8F5EF;
  --fail:       #B4302A;
  --fail-dim:   #FBEDEC;
  --rail:       232px;

  --step--1: 0.8125rem;
  --step-0:  0.9375rem;
  --step-1:  1.125rem;
  --step-2:  1.5rem;
  --step-3:  2.25rem;
  --step-4:  3.5rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:     #0E1013;
    --surface:   #15181C;
    --ink:       #ECEEF0;
    --muted:     #9BA2AA;
    --faint:     #6B727A;
    --line:      #262A2F;
    --line-soft: #1E2227;
    --signal:    #6C93FF;
    --signal-dim:#182338;
    --pass:      #4FC08A;
    --pass-dim:  #14251E;
    --fail:      #F0796F;
    --fail-dim:  #2A1717;
  }
}
:root[data-theme="dark"] {
  --paper:#0E1013; --surface:#15181C; --ink:#ECEEF0; --muted:#9BA2AA;
  --faint:#6B727A; --line:#262A2F; --line-soft:#1E2227; --signal:#6C93FF;
  --signal-dim:#182338; --pass:#4FC08A; --pass-dim:#14251E; --fail:#F0796F;
  --fail-dim:#2A1717;
}

* { box-sizing: border-box; }

/* `display` on a class beats the user-agent rule for [hidden], so the sign-in
   screen and the app shell — both grids — were painted on top of each other
   while the DOM said one of them was hidden. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: var(--step-0);
  line-height: 1.55;
  font-feature-settings: "ss01", "cv05";
  -webkit-font-smoothing: antialiased;
}

/* Measurements read as measurements. */
.num, .strip b, .gauge b, .stat b, td.n { font-variant-numeric: tabular-nums; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: var(--step-2); }
h2 { font-size: var(--step-1); }
p  { margin: 0; }
a  { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--step--1); }

/* ─ shell ─────────────────────────────────────────────────────────────── */

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

.rail {
  border-right: 1px solid var(--line);
  background: var(--surface);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  gap: 22px;
}

.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 0 8px; font-weight: 600; letter-spacing: -0.02em;
}
.brand svg { width: 17px; height: 17px; color: var(--signal); }

/* The agent switcher is the rail's centre of gravity: a company runs several
   agents and the one you are editing has to be unmistakable. */
.switch { position: relative; }
.switch > button {
  width: 100%; text-align: left; background: none; border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 10px; cursor: pointer; color: inherit;
  font: inherit; display: flex; align-items: center; gap: 9px;
}
.switch > button:hover { border-color: var(--faint); }
.switch .who { min-width: 0; flex: 1; }
.switch .who b { display: block; font-weight: 550; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.switch .who span { display: block; font-size: var(--step--1); color: var(--muted); }
.switch .chev { color: var(--faint); flex: none; }

.menu {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 28px rgba(16, 20, 26, .10);
  padding: 5px; overflow: hidden;
  animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-3px); } }
.menu button {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  font: inherit; color: inherit; padding: 8px 9px; border-radius: 7px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.menu button:hover { background: var(--line-soft); }
.menu .on { color: var(--signal); }
.menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 5px 2px; }

nav { display: flex; flex-direction: column; gap: 1px; }
nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; color: var(--muted);
  font-weight: 500; cursor: pointer;
}
nav a:hover { background: var(--line-soft); color: var(--ink); text-decoration: none; }
nav a.on { background: var(--signal-dim); color: var(--signal); }
nav svg { width: 16px; height: 16px; flex: none; }

/* A count on a nav item, for the one page that fills up on its own. Sits at the
   end of the row so the label never shifts when the number appears. */
.pip {
  margin-left: auto; min-width: 19px; padding: 0 5px; border-radius: 9px;
  background: var(--fail-dim); color: var(--fail);
  font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}

/* The index, as a person reads it: the number the agent sends, then the line. */
.idx { display: grid; gap: 1px; }
.idx-row {
  display: grid; grid-template-columns: 62px 1fr; gap: 12px; align-items: baseline;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
}
.idx-row:hover { background: var(--line-soft); }
.idx-row code {
  font-size: var(--step--1); color: var(--signal); font-variant-numeric: tabular-nums;
}
.idx h3 {
  font-size: var(--step--1); font-weight: 600; color: var(--muted);
  margin: 14px 0 4px; padding: 0 8px;
}
.idx h3:first-child { margin-top: 0; }

.rail footer { margin-top: auto; font-size: var(--step--1); color: var(--faint);
  padding: 0 8px; display: flex; justify-content: space-between; align-items: center; }
.rail footer button { background: none; border: 0; color: inherit; cursor: pointer;
  font: inherit; padding: 2px 4px; }
.rail footer button:hover { color: var(--ink); }

main { padding: 34px 40px 80px; max-width: 1100px; }
.page { display: none; }
.page.on { display: block; animation: enter .18s ease-out; }
@keyframes enter { from { opacity: 0; } }

.head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; margin-bottom: 26px; }
.head p { color: var(--muted); margin-top: 5px; max-width: 62ch; }

/* ─ controls ──────────────────────────────────────────────────────────── */

button, .btn {
  font: inherit; font-weight: 500; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: 8px 13px;
  transition: border-color .12s, background .12s, opacity .12s;
}
button:hover { border-color: var(--faint); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--signal); outline-offset: 2px;
}
button.go { background: var(--signal); border-color: var(--signal); color: #fff; }
button.go:hover { filter: brightness(1.06); }
button.bad { color: var(--fail); border-color: var(--line); }
button.bad:hover { background: var(--fail-dim); border-color: var(--fail); }
button[disabled] { opacity: .5; cursor: default; }
button.sm { padding: 5px 10px; font-size: var(--step--1); }

input, select, textarea {
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; width: 100%;
}
input::placeholder { color: var(--faint); }
label.field { display: block; margin-bottom: 13px; }
label.field span { display: block; font-size: var(--step--1); color: var(--muted);
  margin-bottom: 5px; }

.row { display: flex; align-items: center; gap: 9px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ─ the readout: the one loud thing in the product ────────────────────── */

.readout { border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  overflow: hidden; margin-bottom: 22px; }
.readout .top { display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding: 18px 20px 15px; border-bottom: 1px solid var(--line-soft); }
.readout .top h2 { font-size: var(--step-1); }
.readout .version { font-size: var(--step-3); font-weight: 600; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; line-height: 1; }

.strips { display: grid; grid-template-columns: repeat(4, 1fr); }
.strip { padding: 15px 20px; border-right: 1px solid var(--line-soft); }
.strip:last-child { border-right: 0; }
.strip .name { font-weight: 550; text-transform: capitalize; }
.strip b { display: block; font-size: var(--step-2); font-weight: 600;
  letter-spacing: -0.02em; margin: 3px 0 1px; }
.strip .sub { font-size: var(--step--1); color: var(--muted); }
.strip .state { font-size: var(--step--1); font-weight: 550; }
.strip .state.ok { color: var(--pass); }
.strip .state.no { color: var(--fail); }

/* ─ ledger: coverage, gates, records ──────────────────────────────────── */

.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  margin-bottom: 18px; overflow: hidden; }
.panel > header { display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.panel > header h2 { font-size: var(--step-0); font-weight: 600; }
.panel .body { padding: 16px 18px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 18px; border-bottom: 1px solid var(--line-soft); }
th { font-size: var(--step--1); font-weight: 550; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.n { text-align: right; color: var(--muted); white-space: nowrap; }
tbody tr:hover { background: var(--line-soft); }

.mark { font-weight: 600; }
.mark.ok { color: var(--pass); }
.mark.no { color: var(--fail); }

.tag { display: inline-flex; align-items: center; gap: 5px; font-size: var(--step--1);
  font-weight: 550; padding: 2px 8px; border-radius: 999px;
  background: var(--line-soft); color: var(--muted); }
.tag.ok { background: var(--pass-dim); color: var(--pass); }
.tag.no { background: var(--fail-dim); color: var(--fail); }
.tag.live { background: var(--signal-dim); color: var(--signal); }

.gauge { display: flex; align-items: baseline; gap: 8px; }
.gauge b { font-size: var(--step-2); font-weight: 600; letter-spacing: -0.02em; }
.bar { height: 4px; border-radius: 3px; background: var(--line-soft); overflow: hidden;
  margin-top: 10px; }
.bar i { display: block; height: 100%; background: var(--signal);
  transition: width .5s cubic-bezier(.2,.7,.2,1); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0; }
.stat { padding: 14px 18px; border-right: 1px solid var(--line-soft); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font-size: var(--step-2); font-weight: 600; letter-spacing: -0.02em; }
.stat small { color: var(--muted); font-size: var(--step--1); }

.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; font-weight: 550; }

/* ─ upload drawer ─────────────────────────────────────────────────────── */

.scrim { position: fixed; inset: 0; background: rgba(16,20,26,.34);
  backdrop-filter: blur(2px); z-index: 50; animation: enter .14s ease-out; }
.sheet {
  position: fixed; z-index: 51; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
  background: var(--paper); border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  animation: slide .2s cubic-bezier(.2,.7,.2,1);
}
@keyframes slide { from { transform: translateX(14px); opacity: .6; } }
.sheet > header { display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line); }
.sheet .scroll { overflow: auto; padding: 20px 22px; flex: 1; }
.sheet > footer { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface); }

.drops { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.drop { display: block; border: 1px dashed var(--line); border-radius: 10px;
  padding: 13px; cursor: pointer; background: var(--surface);
  transition: border-color .12s, background .12s; }
.drop:hover, .drop.over { border-color: var(--signal); background: var(--signal-dim); }
.drop.has { border-style: solid; border-color: var(--pass); }
.drop .dt { font-weight: 550; display: block; }
.drop small { color: var(--muted); font-size: var(--step--1); }
.drop input[type=file] { display: none; }

/* How to write the file, on the card that takes it. Sits quiet until the card
   is hovered or holds a file — present when wanted, never shouting. */
.drop .how {
  margin: 9px 0 0; padding-left: 15px; list-style: none;
  font-size: var(--step--1); color: var(--faint); line-height: 1.45;
}
.drop .how li { position: relative; margin-top: 3px; }
.drop .how li::before {
  content: ""; position: absolute; left: -11px; top: .62em;
  width: 4px; height: 1px; background: currentColor;
}
.drop:hover .how, .drop.over .how, .drop.has .how { color: var(--muted); }
.drop .fname { display: block; font-size: var(--step--1); color: var(--pass);
  margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crows { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.crow { display: flex; align-items: center; gap: 6px; }
.crow .brand-in { flex: 0 0 48%; padding: 5px 8px; font-size: var(--step--1); }
.crow .cfile { flex: 1; font-size: var(--step--1); color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow .x { border: 0; background: none; color: var(--faint); cursor: pointer;
  font-size: 15px; padding: 0 3px; }
.crow .x:hover { color: var(--fail); }

/* The one orchestrated moment: the gates tick through after a build. */
.steps { margin-top: 18px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.step { display: flex; align-items: center; gap: 9px; padding: 5px 0;
  color: var(--muted); font-size: var(--step--1); }
.step.done { color: var(--ink); }
.step .dot { width: 14px; height: 14px; flex: none; display: grid; place-items: center; }
.step.done .dot::after { content: "✓"; color: var(--pass); font-weight: 600; }
.step.wait .dot::after { content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--line); }
.step.fail { color: var(--fail); }
.step.fail .dot::after { content: "✗"; color: var(--fail); font-weight: 600; }
.step.go .dot::after { content: ""; width: 11px; height: 11px; border-radius: 50%;
  border: 1.5px solid var(--line); border-top-color: var(--signal);
  animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─ transcript ────────────────────────────────────────────────────────── */

.turn { display: grid; grid-template-columns: 62px 1fr; gap: 12px; padding: 7px 0;
  border-bottom: 1px solid var(--line-soft); }
.turn .who { font-size: var(--step--1); color: var(--muted); font-weight: 550; }
.turn.agent .who { color: var(--signal); }

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

.toast { position: fixed; z-index: 70; right: 22px; bottom: 22px;
  background: var(--ink); color: var(--paper); padding: 11px 15px;
  border-radius: 9px; max-width: 420px; box-shadow: 0 10px 30px rgba(16,20,26,.22);
  animation: rise .16s ease-out; }
.toast.bad { background: var(--fail); color: #fff; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ─ sign in ───────────────────────────────────────────────────────────── */

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate .box { width: min(380px, 100%); }
.gate .brand { justify-content: center; margin-bottom: 6px; }
.gate .lede { text-align: center; color: var(--muted); margin-bottom: 20px; }
.gate .field { margin-bottom: 10px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { flex-direction: row; align-items: center; gap: 12px; overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .rail nav { flex-direction: row; }
  .rail footer { display: none; }
  .switch { min-width: 190px; }
  main { padding: 22px 16px 60px; }
  .strips { grid-template-columns: 1fr 1fr; }
  .strip:nth-child(2n) { border-right: 0; }
  .strip:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  .drops { grid-template-columns: 1fr; }
  .head { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important;
    transition-duration: .001ms !important; }
}
