/* Feedback Agent dashboard. Tokens first; light and dark are both chosen, not flipped. */
:root {
  color-scheme: light;
  --page: #f6f5f2;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --line: #e1e0d9;
  --line-strong: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --accent: #a81217;          /* Lite Bite Foods red */
  --accent-ink: #ffffff;
  --accent-soft: #fbe9ea;
  --sidebar: #16151a;
  --sidebar-ink: #c9c7d1;
  --sidebar-active: #2a2830;
  --sidebar-accent: #f0525a;  /* brand red, lightened to read on the dark sidebar */
  --good: #0ca30c;
  --good-ink: #006300;
  --good-soft: #e6f4e6;
  --warning: #fab219;
  --critical: #d03b3b;
  --critical-soft: #fbeaea;
  --series-1: #2a78d6;
  --seq-track: #cde2fb;
  --shadow: 0 1px 2px rgba(16, 16, 20, 0.04), 0 4px 16px rgba(16, 16, 20, 0.05);
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --line: #2c2c2a;
    --line-strong: #383835;
    --ring: rgba(255, 255, 255, 0.10);
    --accent: #e5484d;
    --accent-soft: #3a1517;
    --sidebar: #111113;
    --sidebar-active: #232329;
    --good-ink: #0ca30c;
    --good-soft: #15291a;
    --critical-soft: #3a1c1c;
    --series-1: #3987e5;
    --seq-track: #184f95;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --ink: #f0efec; --ink-2: #c3c2b7;
  --line: #2c2c2a; --line-strong: #383835; --ring: rgba(255, 255, 255, 0.10); --accent: #e5484d;
  --accent-soft: #3a1517; --sidebar: #111113; --sidebar-active: #232329; --good-ink: #0ca30c;
  --good-soft: #15291a; --critical-soft: #3a1c1c; --series-1: #3987e5; --seq-track: #184f95; --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 650; }
p { margin: 0 0 0.75rem; }
small, .small { font-size: 0.82rem; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
code { background: var(--surface-2); padding: 0.1rem 0.35rem; border-radius: 6px; font-size: 0.85em; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-ink); display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; font-weight: 700; font-size: 1rem; }
.logo-mark { width: 40px; height: 40px; border-radius: 10px; background: #fff; display: grid; place-items: center; padding: 3px; flex: none; }
.logo-mark img { width: 100%; height: 100%; object-fit: contain; }
.logo small { display: block; color: var(--sidebar-ink); font-weight: 450; font-size: 0.75rem; }
.nav-group { margin-top: 14px; }
.nav-title { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: #77757f; padding: 0 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--sidebar-ink); padding: 8px 10px; border-radius: 9px; font-weight: 500; font-size: 0.92rem; }
.nav a:hover { background: var(--sidebar-active); color: #fff; text-decoration: none; }
.nav a[aria-current="page"] { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--sidebar-accent); }
.nav .badge-count { margin-left: auto; background: var(--critical); color: #fff; font-size: 0.72rem; border-radius: 99px; padding: 0 7px; font-weight: 600; }
.sidebar-foot { margin-top: auto; border-top: 1px solid #2a2830; padding-top: 12px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 6px 8px; color: #fff; }
.user-card small { display: block; color: var(--sidebar-ink); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 0.8rem; background: #3a3842; color: #fff; flex: none; }
.foot-links { display: flex; gap: 4px; padding: 6px 4px 0; }
.foot-links a { color: var(--sidebar-ink); font-size: 0.82rem; padding: 4px 6px; border-radius: 6px; display: inline-flex; gap: 6px; align-items: center; }
.foot-links a:hover { background: var(--sidebar-active); color: #fff; text-decoration: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 22px 32px 6px; flex-wrap: wrap; }
.topbar h1 { font-size: 1.45rem; font-weight: 700; }
.topbar .subtitle { color: var(--muted); font-size: 0.88rem; margin-top: 2px; }
.menu-btn { display: none; }
.content { padding: 14px 32px 48px; max-width: 1400px; width: 100%; }

/* ---------- filters ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.filters select { min-width: 150px; }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.segmented a { padding: 5px 11px; border-radius: 7px; color: var(--ink-2); font-size: 0.85rem; font-weight: 550; }
.segmented a:hover { text-decoration: none; color: var(--ink); }
.segmented a.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--ring); }

/* ---------- cards & grid ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow), 0 0 0 1px var(--ring); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head .sub { color: var(--muted); font-size: 0.82rem; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 18px; }
.section { margin-top: 18px; }

/* ---------- stat tiles ---------- */
.tiles { display: grid; grid-template-columns: 1.35fr repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow), 0 0 0 1px var(--ring); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tile .label { color: var(--ink-2); font-size: 0.84rem; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.tile .value { font-size: 1.7rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
.tile .note { color: var(--muted); font-size: 0.8rem; }
.tile.hero .value { font-size: 3.1rem; }
.tile.hero .value .of { font-size: 1.1rem; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.tile.alert .label .icon { color: var(--critical); }

/* ---------- charts ---------- */
.chart-box { position: relative; height: 240px; }
.chart-box.short { height: 200px; }
details.table-view { margin-top: 10px; }
details.table-view summary { cursor: pointer; color: var(--muted); font-size: 0.8rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; font-weight: 550; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; 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; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
tr.attention td:first-child { box-shadow: inset 3px 0 0 var(--critical); }
td.actions { text-align: right; white-space: nowrap; }
.cell-title { font-weight: 550; }
.cell-sub { color: var(--muted); font-size: 0.8rem; }
.row-link { color: inherit; }
.row-link:hover { text-decoration: none; }

/* ---------- chips, badges, ratings ---------- */
.brand-chip { display: inline-flex; align-items: center; gap: 7px; font-weight: 550; white-space: nowrap; }
.brand-chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); box-shadow: 0 0 0 2px var(--surface); flex: none; }
.brand-chip .outlet { color: var(--muted); font-weight: 450; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 0.76rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge .icon { width: 13px; height: 13px; }
.badge.good { background: var(--good-soft); color: var(--good-ink); }
.badge.critical { background: var(--critical-soft); color: var(--critical); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); margin: 0 6px 8px 0; }
.tag b { color: var(--ink); font-weight: 650; }
.stars { white-space: nowrap; letter-spacing: 1px; color: var(--line-strong); font-size: 0.95rem; }
.stars .on { color: #f2a10a; }
.stars .n { color: var(--ink); font-weight: 650; margin-left: 4px; letter-spacing: 0; font-size: 0.85rem; }
.meter { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.meter .track { flex: 1; height: 8px; border-radius: 99px; background: var(--seq-track); overflow: hidden; }
.meter .fill { height: 100%; border-radius: 99px; background: var(--series-1); }
.meter .val { font-weight: 650; min-width: 2.2em; text-align: right; font-variant-numeric: tabular-nums; }
.rank { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 650; font-size: 0.8rem; background: var(--surface-2); color: var(--ink-2); }

/* ---------- forms & buttons ---------- */
label { display: block; font-size: 0.84rem; font-weight: 550; color: var(--ink-2); margin-bottom: 14px; }
label .hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.78rem; margin-top: 4px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 12px; width: 100%; margin-top: 6px; }
textarea { min-height: 86px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type="checkbox"] { width: auto; margin: 0 8px 0 0; accent-color: var(--accent); }
input[type="color"] { padding: 2px; height: 40px; width: 56px; }
.filters select, .filters input { margin-top: 0; width: auto; padding: 7px 10px; }
.check { display: flex; align-items: center; font-weight: 500; color: var(--ink); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: 0.9rem; border: 0; border-radius: 10px; padding: 9px 16px; cursor: pointer; background: var(--accent); color: var(--accent-ink); text-decoration: none; }
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.danger { background: var(--critical); }
.btn.sm { padding: 5px 11px; font-size: 0.82rem; border-radius: 8px; }
.btn .icon { width: 16px; height: 16px; }
.inline-form { display: inline; margin: 0; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.swatches label { margin: 0; }
.swatches input { display: none; }
.swatches span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px transparent; }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }

/* ---------- flash, empty, misc ---------- */
.flash { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-radius: 12px; margin-bottom: 12px; font-size: 0.9rem; }
.flash.ok { background: var(--good-soft); color: var(--good-ink); }
.flash.error { background: var(--critical-soft); color: var(--critical); }
.banner { display: flex; gap: 10px; align-items: center; background: var(--accent-soft); color: var(--ink); padding: 10px 14px; border-radius: 12px; font-size: 0.88rem; margin-bottom: 16px; }
.banner .icon { color: var(--accent); }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .icon { width: 34px; height: 34px; color: var(--line-strong); margin-bottom: 8px; }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 9px 18px; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.status-list li:last-child { border-bottom: 0; }
.ok-ico { color: var(--good); } .bad-ico { color: var(--critical); } .warn-ico { color: #c98500; }

/* ---------- conversation bubbles ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 16px; font-size: 0.92rem; line-height: 1.45; }
.bubble .who { display: block; font-size: 0.72rem; font-weight: 650; color: var(--muted); margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.04em; }
.bubble.assistant { background: var(--surface-2); align-self: flex-start; border-bottom-left-radius: 5px; }
.bubble.user { background: var(--accent-soft); align-self: flex-end; border-bottom-right-radius: 5px; }

/* ---------- brand cards ---------- */
.brand-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.brand-card { position: relative; overflow: hidden; }
.brand-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.brand-card .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-2); font-size: 0.84rem; margin: 10px 0 14px; }
.brand-card .meta span { display: inline-flex; gap: 6px; align-items: center; }
.greeting-preview { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-size: 0.9rem; color: var(--ink-2); }
.greeting-preview b { color: var(--ink); }

/* ---------- test call ---------- */
.call-panel { text-align: center; padding: 28px 20px; }
.mic-orb { width: 96px; height: 96px; border-radius: 50%; margin: 6px auto 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); transition: background 0.2s; }
.mic-orb .icon { width: 38px; height: 38px; }
.mic-orb.live { background: var(--accent); color: #fff; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(168, 18, 23, 0.45); } 70% { box-shadow: 0 0 0 22px rgba(168, 18, 23, 0); } 100% { box-shadow: 0 0 0 0 rgba(168, 18, 23, 0); } }
@media (prefers-reduced-motion: reduce) { .mic-orb.live { animation: none; } }
#live-transcript { max-height: 460px; overflow-y: auto; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { background: radial-gradient(circle at 20% 20%, #4a1014, #16151a 62%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-logo { background: #fff; border-radius: 16px; padding: 14px 18px; width: 210px; }
.login-logo img { display: block; width: 100%; height: auto; }
.login-hero h1 { font-size: 2.2rem; line-height: 1.15; max-width: 14ch; margin-top: 40px; }
.login-hero p { color: #c9c7d1; max-width: 42ch; margin-top: 14px; }
.login-hero ul { list-style: none; padding: 0; margin: 28px 0 0; color: #e7e5ee; }
.login-hero li { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.login-hero li .icon { color: var(--sidebar-accent); }
.login-form { display: grid; place-items: center; padding: 32px; }
.login-form .card { width: 100%; max-width: 400px; padding: 32px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-main, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform 0.2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 16px 16px 4px; }
  .content { padding: 10px 16px 40px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile.hero { grid-column: 1 / -1; }
  .grid-2, .form-row { grid-template-columns: minmax(0, 1fr); }
  .filters { margin-left: 0; width: 100%; }
  .filters select { flex: 1; min-width: 0; }
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 32px 24px; }
  .login-hero h1 { margin-top: 18px; font-size: 1.7rem; }
  .bubble { max-width: 92%; }
  .table-wrap { margin: 0 -20px; }
}
