/* Vidhvaa admin panel */
:root {
  --bg: #f4f6fa; --panel: #fff; --ink: #1e293b; --muted: #64748b; --line: #e5e9f0;
  --brand: #ef7b00; --brand-ink: #b34a00; --navy: #141a33;
  --good: #047857; --good-bg: #ecfdf5; --mid: #a16207; --mid-bg: #fefce8; --low: #be123c; --low-bg: #fff1f3;
  --radius: 12px;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', 'Noto Sans Tamil', sans-serif;
}
* { box-sizing: border-box; }
/* `hidden` must win over display:grid/flex on badges (no "0" pills). */
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; display: flex; min-height: 100vh; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; }
h2 { font-size: 16px; margin-bottom: 12px; }
small { font-size: 12px; }
.muted { color: var(--muted); }
.pad { padding: 16px; }

/* layout */
.sidebar { width: 220px; flex: 0 0 220px; background: var(--navy); color: #cbd5e1; padding: 18px 12px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; color: #fff; padding: 0 8px 18px; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; }
.sidebar nav a { display: block; padding: 10px 12px; border-radius: 8px; color: #cbd5e1; font-weight: 600; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.sidebar nav a.active { background: rgba(239,123,0,.18); color: #fff; }
.nav-group { margin: 6px 12px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7c8aa5; }
.sidebar-foot { margin-top: auto; padding: 0 12px; font-size: 12px; color: #7c8aa5; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 18px; flex: 1; }
.content { padding: 20px; }
.menu-btn { display: none; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(.95); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: #f8fafc; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; min-height: 44px; }
.btn:disabled { opacity: .6; cursor: progress; }
.icon-btn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; font-size: 18px; }
.link-btn { border: 0; background: none; color: var(--brand-ink); font: inherit; font-weight: 600; cursor: pointer; padding: 4px; }
:focus-visible { outline: 3px solid rgba(239,123,0,.5); outline-offset: 2px; }

/* bell + notifications */
.bell-wrap { position: relative; }
.badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: #e11d48; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; }
.live-dot.on { background: #10b981; box-shadow: 0 0 0 4px rgba(16,185,129,.18); }
.dropdown { position: absolute; right: 0; top: 46px; width: min(380px, 92vw); max-height: 70vh; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(15,23,42,.16); }
.dropdown-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li a { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--ink); }
.notif-list li a:hover { background: #f8fafc; text-decoration: none; }
.notif-list li.unread a { background: #fff8ef; border-left: 3px solid var(--brand); }
.notif-title { font-weight: 700; }
.notif-body { color: var(--muted); font-size: 13px; }
.notif-time { color: #94a3b8; font-size: 12px; }
.notif-list .empty { padding: 16px; color: var(--muted); }
.notif-enable { display: block; width: 100%; padding: 10px; border-top: 1px solid var(--line); }
.user-menu { display: flex; align-items: center; gap: 10px; color: var(--muted); }

/* cards / panels */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.card span { color: var(--muted); font-weight: 600; font-size: 13px; }
.card strong { font-size: 26px; }
.card small { color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.panel-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .panel { margin-bottom: 16px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 8px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar i { display: block; width: 100%; max-width: 28px; min-height: 2px; border-radius: 6px 6px 0 0; background: var(--brand); }
.bar span { font-size: 10px; color: var(--muted); }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:hover td { background: #fafbfd; }
.table.compact td, .table.compact th { padding: 6px 8px; }
.score { display: inline-block; padding: 2px 8px; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.score.good, .big-score.good strong { color: var(--good); } .score.good { background: var(--good-bg); }
.score.mid, .big-score.mid strong { color: var(--mid); } .score.mid { background: var(--mid-bg); }
.score.low, .big-score.low strong { color: var(--low); } .score.low { background: var(--low-bg); }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eef2f7; color: var(--ink); white-space: nowrap; }
.chip-issued { background: #fff4e5; color: var(--brand-ink); }
.chip-redeemed, .chip-correct { background: var(--good-bg); color: var(--good); }
.chip-expired, .chip-wrong { background: var(--low-bg); color: var(--low); }
.chip-skipped { background: #f1f5f9; color: var(--muted); }
.chip-new { background: #e0f2fe; color: #0369a1; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.filters input, .filters select { min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; }
.filters input[name="q"] { min-width: 220px; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 8px 0 24px; color: var(--muted); }

/* result detail */
.back { display: inline-block; margin-bottom: 12px; font-weight: 600; }
.result-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.result-head p { margin: 6px 0; }
.big-score { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 180px; padding: 12px; border-radius: var(--radius); background: #f8fafc; text-align: center; gap: 4px; }
.big-score strong { font-size: 34px; }
.big-score span { font-size: 18px; font-weight: 700; }
.questions { display: grid; gap: 12px; }
.q-card { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid #cbd5e1; border-radius: var(--radius); padding: 14px 16px; }
.q-card.q-correct { border-left-color: #10b981; }
.q-card.q-wrong { border-left-color: #e11d48; }
.q-top { display: flex; gap: 10px; align-items: center; font-weight: 800; }
.q-text { font-size: 15px; font-weight: 600; margin: 8px 0; }
.opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.opts li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.opts li b { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 50%; background: #f1f5f9; font-size: 12px; }
.opts li em { color: var(--muted); font-style: normal; font-size: 12px; }
.opts li.is-correct { border-color: #a7f3d0; background: var(--good-bg); }
.opts li.is-wrong { border-color: #fecdd3; background: var(--low-bg); }
.explain { margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: #f8fafc; color: var(--muted); }
.alert { padding: 12px 14px; border-radius: 10px; background: var(--low-bg); color: var(--low); }

/* login */
.login-page { align-items: center; justify-content: center; background: linear-gradient(135deg, var(--navy), #263063); }
.login-card { width: min(380px, 92vw); background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.login-card .brand { color: var(--ink); padding: 0 0 14px; }
.login-card h1 { font-size: 22px; margin-bottom: 16px; }
.login-card label { display: block; font-weight: 600; margin: 12px 0 6px; }
.login-card input { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.login-card .btn { margin-top: 18px; }
.form-error { margin: 12px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--low-bg); color: var(--low); }

/* small screens */
@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  .menu-btn { display: grid; }
  .user-menu span { display: none; }
  .content { padding: 12px; }
}

/* ---- telecaller additions ---- */
.sound-btn.on { border-color: var(--brand); background: #fff8ef; }
.notif-icon { margin-right: 2px; }
.notif-list li.tone-warn.unread a { border-left-color: #e11d48; background: #fff5f6; }
.notif-list li.tone-good.unread a { border-left-color: #10b981; background: #f3fdf8; }
.notif-list.full li a { padding: 12px 16px; }

.funnel { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.step { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fbfcfe; }
.step:hover { border-color: var(--brand); text-decoration: none; background: #fff8ef; }
.step-icon { font-size: 20px; }
.step-label { font-weight: 600; color: var(--muted); font-size: 13px; }
.step strong { font-size: 26px; }
.step small { color: var(--muted); }

.stage-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.stage-tab { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; font-size: 13px; }
.stage-tab b { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: #eef2f7; font-size: 12px; }
.stage-tab:hover { text-decoration: none; border-color: var(--brand); }
.stage-tab.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.stage-tab.on b { background: rgba(255,255,255,.2); }
.stage-hint { margin: 0 0 8px; padding: 8px 12px; border-radius: 8px; background: #f8fafc; }
.chip.stage.tone-info, .stage-hint.tone-info { background: #e0f2fe; color: #0369a1; }
.chip.stage.tone-warn, .stage-hint.tone-warn { background: var(--low-bg); color: var(--low); }
.chip.stage.tone-mid, .stage-hint.tone-mid { background: var(--mid-bg); color: var(--mid); }
.chip.stage.tone-hot, .stage-hint.tone-hot { background: #ffedd5; color: #c2410c; }
.chip.stage.tone-good, .stage-hint.tone-good { background: var(--good-bg); color: var(--good); }
.stage-tab.tone-hot:not(.on) { border-color: #fdba74; }
.stage-tab.tone-warn:not(.on) { border-color: #fecdd3; }
.call { font-weight: 700; white-space: nowrap; }
.table.leads td { vertical-align: middle; }


/* ---- pop-up alerts: top-right, slide in, countdown bar ---- */
.toasts { position: fixed; top: 72px; right: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 60; width: 380px; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: 12px; padding: 14px 40px 16px 14px;
  border-radius: 14px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-left: 5px solid var(--brand);
  box-shadow: 0 18px 40px rgba(15,23,42,.18); animation: toast-in .45s cubic-bezier(.2,.9,.25,1.15) both; }
.toast.tone-warn { border-left-color: #e11d48; }
.toast.tone-good { border-left-color: #10b981; }
.toast.tone-info { border-left-color: #0ea5e9; }
.toast-icon { flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #f1f5f9; font-size: 20px; animation: toast-pop .6s .15s both; }
.toast.tone-warn .toast-icon { background: #fff1f3; }
.toast.tone-good .toast-icon { background: #ecfdf5; }
.toast-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; color: var(--ink); }
.toast-body:hover { text-decoration: none; }
.toast-body small { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.toast.tone-warn .toast-body small { color: #be123c; }
.toast.tone-good .toast-body small { color: #047857; }
.toast-body strong { font-size: 14px; line-height: 1.3; }
.toast-body span { font-size: 13px; color: var(--muted); line-height: 1.35; }
.toast-close { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.toast-close:hover { background: #f1f5f9; color: var(--ink); }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; color: var(--brand); transform-origin: left; animation: toast-bar var(--stay, 8s) linear forwards; opacity: .55; }
.toast.tone-warn .toast-bar { color: #e11d48; }
.toast.tone-good .toast-bar { color: #10b981; }
.toast.tone-info .toast-bar { color: #0ea5e9; }
.toast.paused .toast-bar { animation-play-state: paused; }
.toast.hide { animation: toast-out .35s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(110%) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(110%); } }
@keyframes toast-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.bell.ring svg { animation: bell-ring .9s ease-in-out; transform-origin: top center; }
@keyframes bell-ring { 0%,100% { transform: rotate(0); } 15% { transform: rotate(18deg); } 30% { transform: rotate(-16deg); } 45% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 75% { transform: rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .toast, .toast-icon, .toast.hide, .bell.ring svg { animation: none; } .toast-bar { animation: none; display: none; } }
@media (max-width: 600px) { .toasts { top: 64px; right: 8px; left: 8px; width: auto; max-width: none; } }

/* ---- friendlier layout ---- */
body { font-size: 15px; }
.sidebar { width: 240px; flex-basis: 240px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 2px; }
.n-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.06); font-size: 17px; flex: 0 0 auto; }
.n-text { display: flex; flex-direction: column; line-height: 1.2; flex: 1; }
.n-text small { font-weight: 500; font-size: 12px; color: #7c8aa5; }
.sidebar nav a.active .n-icon { background: var(--brand); }
.sidebar nav a.active .n-text small { color: #fcd9b6; }
.n-count { min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; background: #e11d48; color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.nav-backdrop { display: none; }
.page-sub { margin: -4px 0 14px; color: var(--muted); }

/* lead groups */
.groups { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.group-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; color: var(--ink); transition: border-color .15s, transform .15s, box-shadow .15s; }
.group-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15,23,42,.08); }
.group-card .g-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: #f1f5f9; font-size: 22px; flex: 0 0 auto; }
.g-text { display: flex; flex-direction: column; min-width: 0; }
.g-text strong { font-size: 26px; line-height: 1; }
.g-text span { font-weight: 700; margin-top: 2px; }
.g-text small { color: var(--muted); font-size: 12px; line-height: 1.3; margin-top: 2px; }
.group-card.tone-hot .g-icon { background: #ffedd5; }
.group-card.tone-mid .g-icon { background: var(--mid-bg); }
.group-card.tone-info .g-icon { background: #e0f2fe; }
.group-card.tone-good .g-icon { background: var(--good-bg); }
.group-card.on { border-color: var(--navy); box-shadow: 0 8px 22px rgba(20,26,51,.14); }
.group-card.tone-hot.on { border-color: #f97316; background: #fff7ed; }
.group-card.tone-mid.on { border-color: #eab308; background: #fefce8; }
.group-card.tone-info.on { border-color: #0ea5e9; background: #f0f9ff; }
.group-card.tone-good.on { border-color: #10b981; background: #f0fdf4; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.search { display: flex; gap: 8px; flex: 1 1 320px; max-width: 520px; }
.search input { flex: 1; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
.toggle { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; font-size: 14px; }
.toggle:hover { text-decoration: none; border-color: var(--brand); }
.toggle .knob { position: relative; width: 34px; height: 20px; border-radius: 999px; background: #cbd5e1; transition: background .15s; }
.toggle .knob::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle.on .knob { background: #10b981; }
.toggle.on .knob::after { transform: translateX(14px); }

.reasons { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.reason { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 600; }
.reason b { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; background: #eef2f7; font-size: 12px; display: grid; place-items: center; }
.reason:hover { text-decoration: none; border-color: var(--brand); }
.reason.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.reason.on b { background: rgba(255,255,255,.2); }

.panel.flush { padding: 0; overflow: hidden; }
.table.leads td small, .table.leads td .who { display: block; }
.table.leads td small { margin-top: 3px; }
.table.leads tbody tr:hover td { background: #fffaf3; }
.empty-state { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty-state span { font-size: 34px; }

@media (max-width: 1200px) { .groups { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(15,23,42,.45); }
  .g-text small { display: none; }
}

/* ===== v3 sidebar: brand, line icons, active pill, account card ===== */
.sidebar { width: 252px; flex-basis: 252px; padding: 18px 14px 14px; gap: 6px; color: #aeb8cc;
  background: radial-gradient(120% 60% at 0% 0%, rgba(239,123,0,.16), transparent 60%), linear-gradient(180deg, #161c38 0%, #0f1429 100%);
  border-right: 1px solid rgba(255,255,255,.04); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { gap: 12px; padding: 4px 6px 18px; margin-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; font-size: 20px; font-weight: 900;
  background: linear-gradient(135deg, #fdc52e, #f47b20 60%, #e53a26); box-shadow: 0 6px 18px rgba(244,123,32,.45); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; font-size: 18px; letter-spacing: .2px; }
.brand-text small { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #fdc52e; margin-top: 3px; }
.nav-group { margin: 14px 10px 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; color: #66728d; }
.sidebar nav a, .nav-soon { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 10px; margin-bottom: 4px;
  border-radius: 12px; color: #c3cbdc; font-weight: 600; transition: background .15s, color .15s; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar nav a:hover .n-icon { color: #fff; }
.n-icon { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.06); color: #9aa6bf; transition: background .15s, color .15s; }
.n-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.n-text { font-size: 14.5px; }
.n-text small { font-size: 11.5px; color: #6f7c97; margin-top: 2px; }
.sidebar nav a.active { background: #fff; color: var(--navy); box-shadow: 0 8px 22px rgba(0,0,0,.25); }
.sidebar nav a.active::before { content: ''; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
.sidebar nav a.active .n-icon { background: linear-gradient(135deg, #fdc52e, #f47b20); color: #fff; }
.sidebar nav a.active .n-text small { color: #64748b; }
.n-count { min-width: 24px; height: 22px; font-size: 11.5px; box-shadow: 0 0 0 3px rgba(225,29,72,.18); }
.nav-soon { opacity: .45; cursor: default; }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07); }
.su-avatar { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #0ea5e9); color: #fff; font-weight: 800; font-size: 13px; }
.su-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.su-text strong { color: #fff; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.su-text small { color: #7c89a3; font-size: 11.5px; }
.su-out { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; color: #9aa6bf; cursor: pointer; }
.su-out svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.su-out:hover { background: rgba(225,29,72,.18); color: #fecdd3; }
.topbar { padding: 12px 24px; }
.topbar h1 { font-size: 19px; font-weight: 800; color: var(--navy); }
.content { padding: 22px 24px; }
@media (max-width: 900px) { .sidebar { position: fixed; height: auto; } .content { padding: 14px 12px; } .topbar { padding: 10px 12px; } }

/* ===== lead cards ===== */
.list-count { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.lead-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; margin-bottom: 16px; }
.lead-card { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: 16px; background: #fff;
  border: 1px solid var(--line); box-shadow: 0 2px 6px rgba(15,23,42,.04); overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s; }
.lead-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: #cbd5e1; }
.lead-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15,23,42,.1); border-color: #d6dce6; }
.lead-card.tone-hot::before { background: linear-gradient(90deg, #f97316, #fb923c); }
.lead-card.tone-warn::before { background: linear-gradient(90deg, #e11d48, #fb7185); }
.lead-card.tone-mid::before { background: linear-gradient(90deg, #eab308, #facc15); }
.lead-card.tone-info::before { background: linear-gradient(90deg, #0ea5e9, #38bdf8); }
.lead-card.tone-good::before { background: linear-gradient(90deg, #10b981, #34d399); }
.lc-head { display: flex; align-items: center; gap: 12px; }
.lc-avatar { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px; font-weight: 800; font-size: 15px; background: #eef2f7; color: #334155; }
.tone-hot .lc-avatar { background: #ffedd5; color: #c2410c; }
.tone-warn .lc-avatar { background: var(--low-bg); color: var(--low); }
.tone-mid .lc-avatar { background: var(--mid-bg); color: var(--mid); }
.tone-info .lc-avatar { background: #e0f2fe; color: #0369a1; }
.tone-good .lc-avatar { background: var(--good-bg); color: var(--good); }
.lc-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lc-who a { color: var(--navy); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-who small { color: var(--muted); margin-top: 2px; }
.lc-head .chip { flex: none; }
.lc-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.lc-facts > div { min-width: 0; padding: 10px; border-radius: 12px; background: #f8fafc; border: 1px solid #eef1f6; }
.lc-facts dt { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #94a3b8; margin-bottom: 6px; }
.lc-facts dd { margin: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 13px; }
.lc-facts dd small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.lc-facts dd .chip, .lc-facts dd .score { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.lc-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.lc-call { display: inline-flex; align-items: center; gap: 8px; flex: 1; justify-content: center; min-height: 40px; padding: 0 12px; border-radius: 10px;
  background: linear-gradient(90deg, #f97216, #ff5a20); color: #fff; font-weight: 800; letter-spacing: .02em; box-shadow: 0 6px 14px rgba(255,90,32,.25); }
.lc-call:hover { text-decoration: none; filter: brightness(1.05); }
.lc-foot .btn { min-height: 40px; }
.lc-seen { font-size: 12px; color: var(--muted); white-space: nowrap; }
@media (max-width: 420px) { .lead-grid { grid-template-columns: 1fr; } .lc-facts { grid-template-columns: 1fr 1fr; } .lc-facts > div:last-child { grid-column: 1 / -1; } }
/* facts as labelled rows: nothing gets truncated */
.lc-facts { grid-template-columns: 1fr; gap: 0; padding: 4px 12px; border-radius: 12px; background: #f8fafc; border: 1px solid #eef1f6; }
.lc-facts > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border: 0; border-radius: 0; background: none; }
.lc-facts > div + div { border-top: 1px dashed #e2e8f0; }
.lc-facts dt { margin: 0; flex: none; }
.lc-facts dd { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 8px; text-align: right; min-width: 0; }
@media (max-width: 420px) { .lc-facts { grid-template-columns: 1fr; } .lc-facts > div:last-child { grid-column: auto; } }
@media (min-width: 901px) { .topbar .menu-btn { display: none; } }

/* ---------- Read Q (#/read-questions) ---------- */
.rq-help { margin: -4px 0 14px; line-height: 1.5; }
.rq-cards .rq-card-out { border-color: var(--low); background: var(--low-bg); }
.rq-cards .rq-card-low { border-color: var(--mid); background: var(--mid-bg); }
.rq-alert { margin: 0 0 16px; padding: 12px 16px; border: 1px solid #fecaca; border-left: 4px solid var(--low); border-radius: var(--radius); background: var(--low-bg); color: #7f1d1d; }
.rq-alert ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.7; }
.rq-alert a { margin-left: 6px; font-weight: 700; }
.rq-cell { min-width: 150px; }
.rq-bar { display: inline-block; width: 110px; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; vertical-align: middle; }
.rq-bar i { display: block; height: 100%; border-radius: inherit; background: var(--good); transition: width .4s; }
.rq-bar.is-low i { background: var(--mid); }
.rq-bar.is-out i { background: var(--low); }
.rq-num { margin-left: 8px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rq-chip { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.rq-out { background: var(--low-bg); color: var(--low); }
.rq-low { background: var(--mid-bg); color: var(--mid); }
.rq-small { background: #eef2ff; color: #4338ca; }
.rq-ok { background: var(--good-bg); color: var(--good); }
.rq-warn { color: var(--low); font-weight: 700; }
.rq-actions { white-space: nowrap; }
.rq-actions .btn + .btn { margin-left: 4px; }
.rq-right { float: right; }
.rq-sel td { background: #fff7ed; }

.rq-sub > td { padding: 0 12px 14px; background: #fffaf3; }
.rq-sub .table { margin: 0; }

/* Read Q: questions per chapter (books only, minimum 10, no alerts) */
.rqc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.rqc-head h2 { margin-bottom: 4px; }
.rqc-head p { margin: 0; line-height: 1.5; }
.rqc-pill { display: inline-flex; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.rqc-pill.is-low { background: var(--mid-bg); color: var(--mid); }
.rqc-pill.is-ok { background: var(--good-bg); color: var(--good); }
.rqc-book { border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; background: #fff; }
.rqc-book summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; cursor: pointer; list-style: none; }
.rqc-book summary::-webkit-details-marker { display: none; }
.rqc-book summary::before { content: '▸'; color: var(--muted); transition: transform .2s; }
.rqc-book[open] summary::before { transform: rotate(90deg); }
.rqc-meta { margin-left: auto; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.rqc-list { display: grid; grid-template-columns: 1fr; margin: 0; padding: 0 14px 12px; list-style: none; }
.rqc-list li, .rqc-cols { display: grid; grid-template-columns: 26px minmax(0, 1fr) 120px 56px 56px 84px; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--line); }
.rqc-cols { padding: 2px 14px 4px; border-top: 0; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rqc-cols span:nth-child(4), .rqc-cols span:nth-child(5) { text-align: right; }
.rqc-un { text-align: right; font-size: 13px; font-weight: 700; }
.rqc-warn { color: var(--mid); }
.rqc-no { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: #eef2f7; font-size: 11px; font-weight: 800; }
.rqc-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.rqc-bar { height: 7px; border-radius: 4px; background: #eef2f7; overflow: hidden; }
.rqc-bar i { display: block; height: 100%; background: #16a34a; border-radius: 4px; }
.rqc-n { font-size: 13px; text-align: right; }
.rqc-n small { color: var(--muted); font-weight: 600; }
.rqc-st { font-size: 12px; font-weight: 800; color: var(--good); }
.rqc-list li.is-low .rqc-bar i { background: #f59e0b; }
.rqc-list li.is-low .rqc-st { color: var(--mid); }
.rqc-list li.is-low .rqc-no { background: var(--mid-bg); color: var(--mid); }
@media (max-width: 760px) {
  .rqc-list li, .rqc-cols { grid-template-columns: 24px minmax(0, 1fr) 46px 46px 70px; }
  .rqc-bar, .rqc-cols span:nth-child(3) { display: none; }
  .rqc-meta { margin-left: 0; }
}

/* Read Q: chapters that need attention */
.rqx-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.rqx-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.rqx-card > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #f1f5f9; font-size: 20px; }
.rqx-card strong { display: block; font-size: 24px; color: var(--navy); line-height: 1.1; }
.rqx-card small { color: var(--muted); font-weight: 600; }
.rqx-card.is-live { border-color: #fca5a5; background: var(--low-bg); }
.rqx-card.is-live strong { color: var(--low); }
.rqx-card.is-unread { border-color: #fcd34d; background: var(--mid-bg); }
.rqx-card.is-unread strong { color: var(--mid); }
.rqx-card.is-ok > span { background: var(--good-bg); }
.rqx-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.rqx-head h2 { margin: 0; }
.rqx-std { margin-top: 14px; }
.rqx-badge { display: inline-block; margin-bottom: 8px; padding: 4px 12px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 12px; font-weight: 800; }
.rqx-subj { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.rqx-subj-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.rqx-count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); }
.rqx-table { margin: 0; }
.rqx-table td { vertical-align: middle; }
.rqx-table tr.is-live td:first-child { box-shadow: inset 3px 0 0 var(--low); }
.rqx-table tr.is-unread td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.rqx-no { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 6px; background: #eef2f7; font-size: 11px; font-weight: 800; }
.rqx-meter { display: inline-block; width: 70px; height: 7px; margin-right: 8px; border-radius: 4px; background: #eef2f7; overflow: hidden; vertical-align: middle; }
.rqx-meter i { display: block; height: 100%; border-radius: 4px; }
.rqx-meter.ok i { background: #16a34a; }
.rqx-meter.mid i { background: #f59e0b; }
.rqx-meter.low i { background: #e11d48; }
.rqx-tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.rqx-tag.is-live { background: var(--low-bg); color: var(--low); }
.rqx-tag.is-unread { background: var(--mid-bg); color: var(--mid); }
.rqx-tag.is-ok { background: var(--good-bg); color: var(--good); }
.rqx-empty { display: grid; justify-items: center; gap: 4px; padding: 30px; text-align: center; }
.rqx-empty span { font-size: 34px; }
.rqx-empty b { font-size: 16px; }
