/* RETAIN-PH — staff portal layout (ASCOT deep green sidebar, gold accents) */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 256px; flex: none; background: linear-gradient(180deg, var(--brand-700) 0%, var(--deep) 100%); color: #d6e9dc; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 14px; color: #fff !important; text-decoration: none !important; }
.brand-logo { width: 42px; height: 42px; border-radius: 50%; background: #fff; padding: 2px; flex: none; object-fit: contain; }
.brand-name { font-weight: 800; font-size: 16px; line-height: 1.1; letter-spacing: .02em; }
.brand-name small { display: block; font-weight: 500; font-size: 11px; color: var(--on-deep); letter-spacing: 0; margin-top: 2px; }
.side-nav { padding: 4px 12px 20px; flex: 1; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: #d6e9dc; font-size: 14px; font-weight: 500; text-decoration: none !important; margin-bottom: 2px; }
.side-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side-nav a.active { background: rgba(var(--gold-rgb),  .14); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.side-nav a.active .ic { color: var(--gold); }
.side-nav a .pill { margin-left: auto; }
.side-nav .ic { color: var(--on-deep); }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--on-deep); font-weight: 700; padding: 16px 12px 6px; }
.side-foot { padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 13px; display: grid; gap: 8px; }
.side-foot a { color: var(--gold-soft); display: flex; gap: 8px; align-items: center; }
.side-foot .soit { display: flex; align-items: center; gap: 8px; color: var(--on-deep); font-size: 11.5px; }
.side-foot .soit img { width: 26px; height: 26px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, var(--gold), var(--orange) 40%, transparent 80%); opacity: .7; }
.topbar .page-title { font-size: 17px; margin: 0; font-weight: 700; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .who { line-height: 1.2; font-size: 13.5px; font-weight: 600; }
.user-chip .who small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); } }
.icon-btn { display: none; background: none; border: 0; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--ink-2); }
.content { padding: 24px 28px 48px; max-width: 1360px; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 1.45rem; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: inline-flex; gap: 6px; align-items: center; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .kpis { grid-template-columns: 1fr; } }
.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .k-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .k-label .ic { color: var(--brand); }
.kpi .k-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.alert .k-value { color: var(--red); }
.kpi.gold { background: linear-gradient(135deg, #fffbe0, #fff); border-color: #f3e08a; }
.kpi.gold .k-label .ic { color: #b38f00; }
a.kpi { color: inherit; text-decoration: none !important; transition: border-color .15s; }
a.kpi:hover { border-color: var(--brand); }

.queue { list-style: none; margin: 0; padding: 0; }
.queue li { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--line-2); }
.queue li:last-child { border-bottom: 0; }
.queue .q-main { flex: 1; min-width: 0; }
.queue .q-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue .q-meta { font-size: 12.5px; color: var(--muted); }
.queue li.fresh { animation: fresh 2.5s ease-out; }
@keyframes fresh { from { background: #fff8c9; } to { background: transparent; } }
.q-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: none; }
.q-ic.out { background: #f1f3f1; color: var(--muted); }
.q-ic.bad { background: var(--red-bg); color: var(--red); }
.q-ic.warn { background: var(--amber-bg); color: var(--amber); }
.feed { max-height: 520px; overflow-y: auto; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; display: inline-flex; gap: 8px; align-items: center; }
.tabs a.active { color: var(--brand-700); border-bottom-color: var(--gold); }
.tabs a .count { background: var(--line-2); color: var(--ink-2); border-radius: 999px; padding: 0 7px; font-size: 12px; }
.tabs a.active .count { background: var(--gold-soft); color: var(--gold-ink); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters input[type=search] { max-width: 300px; }
.filters select, .filters input[type=date] { width: auto; }

.chart { width: 100%; height: auto; display: block; }
.chart text { font: 12px var(--font); fill: var(--muted); }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.5; }
.chart .area { fill: url(#gArea); }
.chart .dot { fill: #fff; stroke: var(--brand); stroke-width: 2; }
.chart .bar { fill: var(--brand); }
.chart .bar.low { fill: var(--orange); }
.chart .target { stroke: var(--gold); stroke-width: 2; stroke-dasharray: 5 4; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* weekly engagement score strip */
.scores { display: flex; gap: 4px; align-items: flex-end; height: 64px; }
.scores .s { flex: 1; min-width: 14px; border-radius: 4px 4px 0 0; background: var(--brand); position: relative; }
.scores .s[data-v="1"], .scores .s[data-v="2"] { background: #e25b4a; }
.scores .s[data-v="3"] { background: var(--orange); }
.scores .s.none { background: repeating-linear-gradient(45deg, #e5e9e5, #e5e9e5 3px, #f4f6f4 3px, #f4f6f4 6px); height: 100% !important; opacity: .6; }
.scores-labels { display: flex; gap: 4px; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.scores-labels span { flex: 1; min-width: 14px; text-align: center; }

/* heatmap */
.heat { display: grid; gap: 3px; font-size: 11px; }
.heat .hd { color: var(--muted); text-align: center; }
.heat .rl { color: var(--muted); padding-right: 6px; text-align: right; }
.heat .c { height: 22px; border-radius: 4px; background: #eef2ee; display: grid; place-items: center; font-size: 10.5px; color: transparent; }
.heat .c:hover { color: var(--ink); outline: 2px solid var(--gold); }

/* AI insight */
.insight { font-size: 14px; line-height: 1.55; }
.insight h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-700); margin: 14px 0 6px; }
.insight h4:first-child { margin-top: 0; }
.insight ul { margin: 0 0 8px; padding-left: 18px; }
.insight li { margin-bottom: 3px; }
.insight p { margin: 0 0 8px; }
.ai-head { display: flex; align-items: center; gap: 10px; }
.ai-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, var(--gold), var(--orange)); color: var(--deep); flex: none; }

.support-note { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); padding: 10px 14px; border: 1px dashed #c9d8cd; border-radius: 10px; background: #fbfdfb; }
.flag-row td { vertical-align: top; }
.sev { width: 8px; border-radius: 4px; display: inline-block; height: 34px; margin-right: 2px; }
.sev.high { background: #dc2626; } .sev.medium { background: var(--orange); } .sev.low { background: #9ca3af; }
.evidence { font-size: 12.5px; color: var(--muted); }
.mini-stat { display: flex; flex-direction: column; padding: 10px 14px; border-radius: 10px; background: var(--line-2); }
.mini-stat b { font-size: 1.15rem; }
.mini-stat span { font-size: 12px; color: var(--muted); }
.card-scan { display: flex; gap: 8px; }
.card-scan input { font-family: ui-monospace, Consolas, monospace; letter-spacing: .04em; }
.card-scan.listening input { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(var(--gold-rgb),  .35); }

/* auth */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: radial-gradient(900px 520px at -10% -10%, var(--brand-light) 0%, var(--brand) 30%, var(--brand-700) 70%, var(--deep) 100%); color: #e6f2ea; padding: 44px 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px; border-radius: 50%; border: 36px solid rgba(var(--gold-rgb),  .12); }
.auth-side h1 { color: #fff; font-size: 2rem; max-width: 480px; }
.auth-side h1 em { color: var(--gold); font-style: normal; }
.auth-side ul { list-style: none; padding: 0; margin: 24px 0 0; }
.auth-side li { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.auth-side li .ic { color: var(--gold); }
.auth-logos { display: flex; align-items: center; gap: 12px; }
.auth-logos img { height: 54px; width: 54px; border-radius: 50%; background: #fff; padding: 2px; }
.auth-logos .t { line-height: 1.2; font-weight: 700; }
.auth-logos .t small { display: block; font-weight: 500; color: var(--on-deep); font-size: 12.5px; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: min(420px, 100%); }
.demo-creds { margin-top: 18px; font-size: 13px; }
.demo-creds table { width: 100%; border-collapse: collapse; }
.demo-creds td { padding: 5px 0; border-bottom: 1px dashed var(--line); }
.demo-creds button { font: inherit; background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font-weight: 700; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }

@media (max-width: 960px) {
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar-backdrop.open { position: fixed; inset: 0; background: rgba(var(--deep-rgb),  .4); z-index: 40; }
  .icon-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .content { padding: 18px 16px 40px; }
  .user-chip .who, .live-dot { display: none; }
}

/* print layout */
.print-page { max-width: 960px; margin: 0 auto; padding: 32px 28px; background: #fff; }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--brand); padding-bottom: 12px; margin-bottom: 18px; gap: 16px; }
.print-head img { width: 56px; height: 56px; }
.print-head h1 { font-size: 1.2rem; margin: 0; }
.print-actions { position: sticky; top: 0; background: #f4f7f4; border-bottom: 1px solid var(--line); padding: 10px; text-align: center; }
