/* Nabz: shared styles. Light theme, indigo brand (us), orange accent (them / alerts). */
:root {
  --brand: #4F46E5;
  --brand-600: #4338CA;
  --brand-50: #EEF2FF;
  --brand-100: #E0E7FF;
  --them: #F97316;
  --them-50: #FFF7ED;
  --them-100: #FFEDD5;
  --ok: #059669;
  --ok-50: #ECFDF5;
  --warn: #D97706;
  --warn-50: #FFFBEB;
  --bad: #DC2626;
  --bad-50: #FEF2F2;
  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #64748B;
  --line: #E2E8F0;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.25rem;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #7C3AED);
  display: grid; place-items: center; flex: none;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .35);
}
.brand-name { font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; }
.brand-tag { font-size: .72rem; color: var(--muted); display: block; margin-top: -3px; }
.nav { display: flex; gap: .25rem; margin-left: 1rem; }
.nav a {
  padding: .4rem .75rem; border-radius: 10px; color: var(--ink-2); font-weight: 500; font-size: .92rem;
}
.nav a:hover { background: var(--brand-50); text-decoration: none; }
.nav a.active { background: var(--brand-50); color: var(--brand); }
.spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand-100); color: var(--brand-600);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none;
}
.role-pill {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  padding: .12rem .45rem; border-radius: 999px; background: var(--brand-50); color: var(--brand-600);
}
.role-pill.manager { background: var(--them-50); color: #C2410C; }
.role-pill.admin { background: #F1F5F9; color: var(--ink-2); }

/* ---------- layout ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.container.narrow { max-width: 560px; }
.container.mid { max-width: 1100px; }
.page-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head .sub { color: var(--muted); }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 980px) {
  .grid.cols-3, .grid.cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}
@media (max-width: 560px) {
  .nav { display: none; }
  .brand-tag { display: none; }
  .container { padding: 1rem .85rem 2.5rem; }
  .userbox .uname { display: none; }
}

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.15rem 1.2rem;
}
.card + .card { margin-top: 1rem; }
.grid > .card + .card { margin-top: 0; }
.grid { align-items: start; }
.card-title { display: flex; align-items: center; gap: .5rem; margin-bottom: .8rem; }
.card-title h2, .card-title h3 { margin: 0; }
.card-title .right { margin-left: auto; }
.section-label {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  margin: 1rem 0 .45rem;
}

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: .8rem; }
label.field > span { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: .3rem; }
input[type=text], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.row { display: flex; gap: .75rem; }
.row > * { flex: 1; min-width: 0; }
.radio-group { display: grid; gap: .45rem; }
.radio, .check {
  display: flex; align-items: flex-start; gap: .55rem; padding: .6rem .7rem; border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer; background: #fff; font-size: .92rem;
}
.radio:has(input:checked), .check:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.radio input, .check input { margin-top: .2rem; accent-color: var(--brand); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: inherit; font-weight: 600; font-size: .92rem;
  padding: .6rem 1rem; border-radius: 12px; border: 1px solid transparent; cursor: pointer;
  background: var(--brand); color: #fff; transition: background .15s, transform .05s, opacity .15s;
}
.btn:hover { background: var(--brand-600); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: #F1F5F9; }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: #F1F5F9; }
.btn.danger { background: #fff; color: var(--bad); border-color: #FECACA; }
.btn.danger:hover { background: var(--bad-50); }
.btn.ok { background: var(--ok); }
.btn.ok:hover { background: #047857; }
.btn.block { width: 100%; }
.btn.sm { padding: .35rem .65rem; font-size: .82rem; border-radius: 9px; }

/* ---------- chips, badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .76rem; font-weight: 600; padding: .18rem .55rem; border-radius: 999px;
  background: #F1F5F9; color: var(--ink-2); white-space: nowrap;
}
.chip.brand { background: var(--brand-50); color: var(--brand-600); }
.chip.them { background: var(--them-50); color: #C2410C; }
.chip.ok { background: var(--ok-50); color: var(--ok); }
.chip.warn { background: var(--warn-50); color: var(--warn); }
.chip.bad { background: var(--bad-50); color: var(--bad); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.pulse .dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }

.score-badge {
  min-width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; font-size: 1.05rem; flex: none;
}
.score-badge.hi { background: var(--ok-50); color: var(--ok); }
.score-badge.mid { background: var(--warn-50); color: var(--warn); }
.score-badge.lo { background: var(--bad-50); color: var(--bad); }

/* ---------- lists ---------- */
.list { display: grid; gap: .55rem; }
.list-item {
  display: flex; align-items: center; gap: .8rem; padding: .75rem .85rem; border: 1px solid var(--line);
  border-radius: 14px; background: #fff; color: inherit; transition: border-color .15s, box-shadow .15s;
}
.list-item:hover { border-color: var(--brand-100); box-shadow: var(--shadow); text-decoration: none; }
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .meta { font-size: .8rem; color: var(--muted); }
.empty {
  text-align: center; color: var(--muted); padding: 2rem 1rem; border: 1.5px dashed var(--line); border-radius: 14px;
}
.empty .big { font-size: 1.8rem; display: block; margin-bottom: .3rem; }

/* ---------- recorder ---------- */
.recorder { display: grid; justify-items: center; gap: .9rem; padding: 1rem 0 .4rem; }
.rec-btn {
  width: 116px; height: 116px; border-radius: 50%; border: none; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #818CF8, var(--brand) 60%, #3730A3);
  box-shadow: 0 10px 30px rgba(79, 70, 229, .45), inset 0 -4px 10px rgba(0, 0, 0, .15);
  display: grid; place-items: center; color: #fff; transition: transform .1s, box-shadow .2s, filter .2s;
  position: relative;
}
.rec-btn:hover:not(:disabled) { transform: scale(1.03); }
.rec-btn:disabled { filter: grayscale(1); opacity: .35; cursor: not-allowed; box-shadow: none; }
.rec-btn.recording { background: radial-gradient(circle at 35% 30%, #FDBA74, var(--them) 60%, #C2410C); box-shadow: 0 10px 30px rgba(249, 115, 22, .5); }
.rec-btn.recording::after {
  content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 3px solid rgba(249, 115, 22, .45);
  animation: ring 1.4s ease-out infinite;
}
@keyframes ring { from { transform: scale(.92); opacity: 1; } to { transform: scale(1.18); opacity: 0; } }
.rec-timer { font-variant-numeric: tabular-nums; font-size: 1.6rem; font-weight: 700; letter-spacing: .02em; }
.rec-hint { font-size: .85rem; color: var(--muted); text-align: center; }
.meter { width: 220px; height: 8px; border-radius: 999px; background: #F1F5F9; overflow: hidden; }
.meter > div { height: 100%; width: 0%; background: linear-gradient(90deg, var(--brand), var(--them)); transition: width .08s; }
.progress { width: 100%; height: 8px; border-radius: 999px; background: #F1F5F9; overflow: hidden; }
.progress > div { height: 100%; width: 0%; background: var(--brand); transition: width .15s; }
.divider { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .8rem; margin: .9rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.notice {
  background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 12px; padding: .75rem .85rem;
  font-size: .92rem; color: var(--ink-2); margin-bottom: .7rem;
}
.notice .q { font-style: italic; color: var(--ink); }
.alert { border-radius: 12px; padding: .7rem .85rem; font-size: .9rem; margin: .6rem 0; }
.alert.error { background: var(--bad-50); color: var(--bad); border: 1px solid #FECACA; }
.alert.ok { background: var(--ok-50); color: var(--ok); border: 1px solid #A7F3D0; }
.alert.info { background: var(--brand-50); color: var(--brand-600); border: 1px solid var(--brand-100); }

/* ---------- visit page ---------- */
.visit-head { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.visit-head h1 { margin-bottom: .2rem; }
.meta-line { display: flex; flex-wrap: wrap; gap: .35rem .9rem; color: var(--muted); font-size: .88rem; }
.steps { display: flex; gap: .4rem; flex-wrap: wrap; margin: .2rem 0; }
.step {
  display: flex; align-items: center; gap: .4rem; font-size: .82rem; font-weight: 600; color: var(--muted);
  padding: .35rem .65rem; border-radius: 999px; background: #F1F5F9;
}
.step.done { background: var(--ok-50); color: var(--ok); }
.step.active { background: var(--brand-50); color: var(--brand); }
.step.active .dot { animation: pulse 1.1s infinite; }
.step .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.step.error { background: var(--bad-50); color: var(--bad); }

.score-wrap { display: flex; gap: 1.2rem; align-items: center; }
.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .val b { font-size: 1.9rem; display: block; line-height: 1; }
.ring .val span { font-size: .7rem; color: var(--muted); }

.debrief {
  background: linear-gradient(135deg, var(--brand), #7C3AED); color: #fff; border: none;
}
.debrief .muted, .debrief small { color: rgba(255, 255, 255, .8); }
.debrief audio { width: 100%; margin-top: .6rem; }
.debrief .script { font-size: .9rem; background: rgba(255, 255, 255, .12); border-radius: 10px; padding: .6rem .75rem; margin-top: .6rem; }

.checklist { display: grid; gap: .4rem; }
.check-row { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem .6rem; border-radius: 10px; background: #F8FAFC; }
.check-row .ic { font-size: 1.05rem; flex: none; width: 1.4rem; text-align: center; }
.check-row .q { font-size: .88rem; }
.check-row .k { font-weight: 650; text-transform: capitalize; }

.quote {
  display: inline; cursor: pointer; color: var(--ink-2); font-style: italic;
  border-bottom: 1px dashed var(--brand-100); background: none; padding: 0;
}
.quote:hover { color: var(--brand); border-bottom-color: var(--brand); }
.quote-btn {
  font: inherit; border: none; background: none; text-align: left; cursor: pointer; padding: 0; color: inherit;
}
.item { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: none; }
.item .t { font-weight: 600; }
.item .q { font-size: .88rem; margin-top: .15rem; }
.flags-box { border: 1px solid #FECACA; background: var(--bad-50); }
.flags-box h3 { color: var(--bad); }
.verified { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; font-weight: 650; color: var(--ok); background: var(--ok-50); padding: .3rem .65rem; border-radius: 999px; }
.verified.partial { color: var(--warn); background: var(--warn-50); }

.bar2 { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: #F1F5F9; }
.bar2 .us { background: var(--brand); }
.bar2 .them { background: var(--them); }
.legend { display: flex; gap: .9rem; font-size: .8rem; color: var(--muted); margin-top: .35rem; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.stat-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .7rem; }
.stat-mini div { background: #F8FAFC; border-radius: 10px; padding: .5rem .6rem; }
.stat-mini b { display: block; font-size: 1.1rem; }
.stat-mini span { font-size: .75rem; color: var(--muted); }

.transcript { max-height: 640px; overflow: auto; display: grid; gap: .5rem; padding-right: .3rem; scroll-behavior: smooth; }
.bubble { max-width: 86%; padding: .55rem .75rem; border-radius: 14px; font-size: .92rem; transition: box-shadow .3s, background .3s; }
.bubble .who { font-size: .72rem; font-weight: 700; margin-bottom: .1rem; display: flex; gap: .4rem; }
.bubble .who .ts { color: var(--muted); font-weight: 500; }
.bubble.us { background: var(--brand-50); border: 1px solid var(--brand-100); justify-self: start; }
.bubble.us .who { color: var(--brand-600); }
.bubble.them { background: var(--them-50); border: 1px solid var(--them-100); justify-self: end; }
.bubble.them .who { color: #C2410C; }
.bubble.other { background: #F1F5F9; border: 1px solid var(--line); justify-self: start; }
.bubble.hl { box-shadow: 0 0 0 3px #FDE047; background: #FEFCE8; }
.redact { display: inline-flex; align-items: center; gap: .2rem; font-size: .75rem; font-weight: 600; background: #E2E8F0; color: var(--ink-2); padding: .05rem .45rem; border-radius: 999px; font-style: normal; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
details.audit summary { cursor: pointer; font-weight: 600; }
.audit-row { font-size: .8rem; display: grid; grid-template-columns: 150px 110px 1fr; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
@media (max-width: 560px) { .audit-row { grid-template-columns: 1fr; gap: 0; } }

/* ---------- dashboard ---------- */
.kpi { padding: 1rem 1.1rem; }
.kpi .label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; margin-top: .1rem; }
.kpi .hint { font-size: .75rem; color: var(--muted); }
.kpi.accent .value { color: var(--brand); }
.kpi.alert .value { color: var(--bad); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-left: auto; }
.filters select { width: auto; padding: .45rem .7rem; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 300px; }
.voc { display: grid; gap: .6rem; max-height: 560px; overflow: auto; padding-right: .3rem; }
.voc-card { border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; background: #fff; display: block; color: inherit; }
.voc-card:hover { border-color: var(--brand-100); text-decoration: none; box-shadow: var(--shadow); }
.voc-card .text { font-weight: 600; font-size: .92rem; margin: .3rem 0 .15rem; }
.voc-card .quote-text { font-style: italic; color: var(--ink-2); font-size: .88rem; }
.voc-card .src { font-size: .75rem; color: var(--muted); margin-top: .3rem; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: .5rem .55rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: .6rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #F8FAFC; }
.table-wrap { overflow-x: auto; }
.trust-row { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.trust-row:last-child { border-bottom: none; }
.trust-row .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--ok-50); color: var(--ok); flex: none; }
.trust-row .ic.bad { background: var(--bad-50); color: var(--bad); }
.trust-row .v { margin-left: auto; font-weight: 650; text-align: right; }
.seg-tabs { display: flex; gap: .3rem; flex-wrap: wrap; }
.seg-tabs button { font: inherit; font-size: .78rem; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--ink-2); padding: .25rem .6rem; border-radius: 999px; cursor: pointer; }
.seg-tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- login ---------- */
.login-hero { text-align: center; padding: 2.5rem 1rem 1.5rem; }
.login-hero .brand-mark { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto .8rem; }
.login-hero h1 { font-size: 2.1rem; margin-bottom: .2rem; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .8rem; }
.person {
  display: flex; gap: .75rem; align-items: center; text-align: left; font: inherit; color: inherit;
  padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer;
  box-shadow: var(--shadow); transition: border-color .15s, transform .1s;
}
.person:hover { border-color: var(--brand); transform: translateY(-1px); }
.person .avatar { width: 42px; height: 42px; font-size: 1rem; }
.person .n { font-weight: 700; }
.person .r { font-size: .8rem; color: var(--muted); }

/* ---------- footer ---------- */
.footer { text-align: center; font-size: .78rem; color: var(--muted); padding: 1.5rem 1rem 2rem; }
.footer b { color: var(--ink-2); font-weight: 600; }

.hidden { display: none !important; }
.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 12px; font-size: .9rem; box-shadow: var(--shadow);
}

/* Security/honesty additions */
.chip.synthetic { background: #F5F3FF; color: #6D28D9; border: 1px dashed #A78BFA; }
.banner-synthetic { background: #F5F3FF; border: 1px dashed #A78BFA; color: #5B21B6; border-radius: 12px; padding: .6rem .9rem; margin: 0 0 1rem; font-size: .9rem; }
.alert.warn-box { background: var(--warn-50); color: #92400E; border: 1px solid #FCD34D; border-radius: 12px; padding: .75rem 1rem; }
.pin-form { margin-top: .5rem; } .pin-form label { display: block; margin-bottom: .4rem; }
.pin-row { display: flex; gap: .5rem; flex-wrap: wrap; } .pin-row input { width: 9rem; font-size: 1.2rem; letter-spacing: .3em; padding: .55rem .7rem; border-radius: 10px; border: 1px solid var(--line, #E2E8F0); }
tr.rowlink { cursor: pointer; } tr.rowlink:focus-visible { outline: 3px solid var(--brand-600, #4F46E5); outline-offset: -3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }
