/* MetricLoop dashboard — palette tuned to the Build Hours frame */
:root {
  --bg: #f6f4ee;
  --ink: #1c1a14;
  --muted: #847d6e;
  --line: #e5dfce;
  --green: #2c7a44;
  --green-2: #1a5c30;
  --red:   #c44232;
  --orange: #c66c3c;
  --rail-bg: #fbf8ef;
  --kpi-bg: #fff;
  --pill: #efe7d4;
  --conf-bg: #b8e1c1;
  --conf-text: #1a4d2a;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial; }
.hidden { display: none !important; }

.app { display: grid; grid-template-columns: 200px 1fr 360px; gap: 0; min-height: 100vh; }

/* Sidebar */
.sidebar { background: #f3eddd; padding: 18px 14px; border-right: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.brand-logo { width: 28px; height: 28px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; }
.brand-name { font-weight: 600; font-size: 14px; }
.brand-ws { font-size: 11px; color: var(--muted); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { font-size: 13px; padding: 6px 10px; border-radius: 4px; color: var(--ink); text-decoration: none; cursor: pointer; }
.sidebar nav a:hover { background: rgba(0,0,0,0.04); }
.sidebar nav a.active { font-weight: 600; background: rgba(28,26,20,0.06); }

/* Content */
.content { padding: 18px 24px 80px; overflow-y: auto; max-height: 100vh; }
.page-head .breadcrumbs { font-size: 11px; letter-spacing: 0.1em; color: var(--muted); }
.page-head h1 { font-size: 20px; margin: 4px 0 12px; }
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.tab { font-size: 13px; color: var(--muted); cursor: pointer; padding: 4px 0; border-bottom: 2px solid transparent; }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }

.update-callout { background: #fff; border-radius: 10px; padding: 14px 16px; display: flex;
  justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; border: 1px solid var(--line); }
.ut-tag { font-size: 10px; letter-spacing: 0.1em; color: var(--muted); }
.ut-title { font-size: 14px; font-weight: 600; margin: 2px 0; }
.update-callout p { margin: 0; font-size: 12px; color: var(--muted); }
.btn-pill { background: var(--green); color: #fff; border: 0; padding: 8px 14px; border-radius: 999px; font-size: 12px; cursor: pointer; }

/* Filters */
.filters { background: #fff; border-radius: 10px; padding: 14px 16px; margin: 14px 0; border: 1px solid var(--line); }
.grid-3 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.filter { display: flex; flex-direction: column; gap: 2px; }
.filter label { font-size: 10px; letter-spacing: 0.08em; color: var(--muted); }
.filter select { padding: 5px 8px; font-size: 12px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.filter-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.filter-actions label { font-size: 12px; color: var(--muted); }
.btn-primary { background: var(--green); color: #fff; border: 0; padding: 6px 12px; border-radius: 4px; font-size: 12px; cursor: pointer; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pill-row .pill { background: var(--pill); color: #4a4434; font-size: 10px; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 4px; text-transform: uppercase; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi { background: var(--kpi-bg); border-radius: 8px; padding: 10px 12px; border: 1px solid var(--line); }
.kpi-tag { font-size: 10px; letter-spacing: 0.08em; color: var(--muted); }
.kpi-value { font-size: 22px; font-weight: 700; }
.kpi-name { font-size: 14px; font-weight: 600; }
.kpi-delta { font-size: 11px; color: var(--red); }
.kpi-meta { font-size: 11px; color: var(--muted); }

/* Funnel */
.funnel-card, .release-card, .artifact-card, .vs-card, .cohort-card, .replay-card, .rail-card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-top: 10px;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.card-tag { font-size: 10px; letter-spacing: 0.08em; color: var(--muted); }
.card-head h3 { margin: 2px 0 0; font-size: 14px; font-weight: 600; }
.card-meta { font-size: 11px; color: var(--muted); }
.conf-pill { background: var(--conf-bg); color: var(--conf-text); font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }

.funnel-rows { display: flex; flex-direction: column; gap: 6px; }
.funnel-row { display: grid; grid-template-columns: 160px 1fr 60px; align-items: center; gap: 10px; font-size: 12px; }
.bar-stack { display: flex; flex-direction: column; gap: 2px; }
.bar { height: 10px; background: #c8e0ce; border-radius: 2px; }
.bar.cur  { background: #5ba968; }
.bar.prior { background: #cfd5c4; }
.delta-pct { text-align: right; font-size: 12px; font-weight: 500; }
.delta-pct.neg { color: var(--red); }
.delta-pct.pos { color: var(--green-2); }

/* Release card */
.release-rows { display: flex; flex-direction: column; gap: 4px; font-size: 11px; }
.release-row { display: grid; grid-template-columns: 60px 1fr 40px; gap: 8px; align-items: center; }
.activation-bar { background: linear-gradient(to right, #c2e3c8 0%, #c2e3c8 var(--w, 60%), #fbeacf var(--w, 60%), #fbeacf 100%); height: 8px; border-radius: 2px; }
.tickets-bar { background: linear-gradient(to right, #f1c2bb 0%, #f1c2bb var(--w, 30%), #fff 0); height: 8px; border-radius: 2px; }

.card-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.art-summary { font-size: 12px; color: var(--ink); margin-top: 6px; }
.art-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-top: 8px; font-size: 12px; }
.art-grid .rs-h { font-size: 9px; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 2px; }

.vs-card h3, .cohort-card h3, .replay-card h3 { font-size: 14px; margin: 4px 0 8px; }
.vs-row, .cohort-row { display: grid; grid-template-columns: 1.4fr 0.7fr 0.7fr 0.7fr; font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); align-items: center; }
.vs-row:last-child, .cohort-row:last-child { border-bottom: 0; }
.vs-row .top, .cohort-row .top { color: var(--muted); font-size: 11px; }
.vs-row .conv, .cohort-row .act { font-weight: 600; }
.vs-row .delta { color: var(--red); }
.vs-row .delta.pos, .cohort-row .delta.pos { color: var(--green-2); }

.replay-card h3 { font-size: 14px; }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }
.dot.ok { background: var(--green); } .dot.warn { background: #d49a30; } .dot.fail { background: var(--red); }
.replay-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.replay-row:last-child { border-bottom: 0; }
.replay-id { font-weight: 600; font-size: 12px; }
.replay-meta { font-size: 11px; color: var(--muted); }
.replay-summary { font-size: 12px; margin: 4px 0 6px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { background: #f3eddd; font-size: 10px; padding: 2px 6px; border-radius: 4px; }
.chip.last { background: #f1c2bb; color: #6c2018; }

/* Bottom bar */
.bottom-bar { position: fixed; bottom: 14px; left: 220px; right: 380px; background: #fff;
  border-radius: 10px; padding: 6px 12px; display: grid; grid-template-columns: auto auto 1fr auto auto auto auto; gap: 10px;
  align-items: center; font-size: 11px; color: var(--muted); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(20,18,12,0.12); }
.bottom-bar input { padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px; font-size: 12px; }
.bottom-bar button { background: var(--green); color: #fff; border: 0; padding: 6px 10px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.bottom-bar button.stop { background: #2a2823; }
.asst-status { color: var(--ink); font-weight: 500; }

/* Right rail */
.rail { background: var(--rail-bg); padding: 14px; border-left: 1px solid var(--line); overflow-y: auto; max-height: 100vh; }
.rail-card { padding: 14px; }
.rail-section { padding: 10px 0; border-top: 1px solid var(--line); }
.rail-section:first-of-type { border-top: 0; }
.rs-h { font-size: 10px; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px; }
.intent-row, .sess-row, .alt-row { font-size: 12px; padding: 3px 0; }
.intent-row { display: grid; grid-template-columns: 1.5fr 0.6fr; }
.intent-row .delta { text-align: right; color: var(--red); }
.sess-row { display: grid; grid-template-columns: 1fr; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.sess-row:last-child { border-bottom: 0; }
.sess-row .id { font-weight: 600; font-size: 11px; }
.sess-row .meta { color: var(--muted); font-size: 10px; }
.alt-row { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.alt-row:last-child { border-bottom: 0; }
.alt-row .h { font-weight: 600; font-size: 12px; }
.alt-row .c { font-size: 10px; color: var(--muted); text-transform: lowercase; }
.alt-row .n { font-size: 11px; color: var(--ink); }

@media (max-width: 1280px) {
  .app { grid-template-columns: 200px 1fr; }
  .rail { display: none; }
  .bottom-bar { right: 16px; }
}

/* ---------- metrics-lab additions ---------- */

.lab-pill { background: var(--green-2); color: #fff; font-size: 9px; padding: 1px 6px; border-radius: 999px; margin-left: 6px; letter-spacing: 0.04em; vertical-align: 2px; }

/* Onboarding overlay */
.onboard {
  position: fixed; inset: 0; background: rgba(20, 18, 12, 0.78);
  z-index: 9999; display: grid; place-items: start center;
  overflow-y: auto; padding: 28px 16px;
}
.onboard.hidden { display: none; }
.onboard-card {
  background: #fff; color: var(--ink); max-width: 940px; width: 100%;
  margin: 24px 0; border-radius: 14px; padding: 32px 36px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}
.onboard-card .ob-tag { font-size: 11px; letter-spacing: 0.12em; color: var(--green-2); text-transform: uppercase; font-weight: 600; }
.onboard-card h1 { font-size: 30px; margin: 8px 0 12px; line-height: 1.15; }
.onboard-card .ob-lede { font-size: 15px; color: #2a2823; line-height: 1.55; margin: 0; max-width: 740px; }
.onboard-card h3 { font-size: 12px; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; margin: 24px 0 8px; }
.onboard-card h4 { font-size: 11px; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; margin: 0 0 6px; }
.onboard-card ul, .onboard-card ol { font-size: 14px; line-height: 1.55; padding-left: 20px; margin: 4px 0 8px; }
.onboard-card .ob-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.onboard-card .ob-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; }
.onboard-card .ob-footer { display: flex; align-items: center; gap: 16px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.onboard-card .ob-tip { font-size: 13px; color: var(--muted); margin-top: 10px; }
.btn-cta-large { background: var(--green); color: #fff; border: 0; padding: 12px 22px; border-radius: 8px; font-size: 15px; font-weight: 500; cursor: pointer; }
.btn-cta-large:hover { background: var(--green-2); }
.ob-mic-note { font-size: 12px; color: var(--muted); }

/* The "stays silent" callout */
.ob-callout {
  background: #f1ecda; border-left: 4px solid var(--green-2);
  padding: 14px 16px; border-radius: 6px; margin: 18px 0;
  font-size: 14px; line-height: 1.55;
}
.ob-callout strong { color: var(--green-2); }

/* Step list with prompt + expected behavior columns */
.ob-script { list-style: none; padding: 0; margin: 0; }
.ob-script li { padding: 10px 0; border-bottom: 1px dashed var(--line); display: grid; grid-template-columns: 24px 1fr; gap: 8px; font-size: 13px; }
.ob-script li:last-child { border-bottom: 0; }
.ob-script .step-no { color: var(--green-2); font-weight: 700; grid-row: 1 / span 2; }
.ob-script .prompt { color: var(--ink); }
.ob-script .prompt em { font-style: normal; color: #2a2823; background: #f9f3df; padding: 1px 4px; border-radius: 3px; font-family: ui-sans-serif, system-ui; }
.ob-script .expect { color: var(--muted); font-size: 11px; }
.ob-script .expect.silent { color: var(--green-2); }
.ob-script .expect.speaks { color: var(--red); font-weight: 600; }

/* Stop button: red, unmistakable. */
.bottom-bar button.stop {
  background: var(--red); color: #fff; font-weight: 600;
  padding: 8px 14px; box-shadow: 0 2px 0 rgba(140, 40, 30, 0.4);
}
.bottom-bar button.stop:hover { background: #a3372a; }
.bottom-bar button.stop[disabled] { background: #b9b3a4; cursor: not-allowed; box-shadow: none; }

@media (max-width: 720px) {
  .onboard-card { padding: 22px; }
  .onboard-card .ob-cols, .onboard-card .ob-meta { grid-template-columns: 1fr; gap: 16px; }
}
