/* Beldex AI — shared styles */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500&family=Noto+Sans+Tamil:wght@400;500;600;700&display=swap');

:root {
  --ink: #121318; --ink-2: #2A2B31; --muted: #5E5D57; --faint: #8B8A83;
  --paper: #F5F4EF; --card: #FFFFFF; --line: #E6E3DA; --soft: #EFEDE6;
  --accent: #E2531D; --accent-ink: #B23E10; --accent-soft: #FCEBE3;
  --good: #11704A; --good-soft: #E1F2E9; --warn: #8A5A00; --warn-soft: #FBF0D5;
  --bad: #B3261E; --bad-soft: #FBE4E1;
  --radius: 12px; --shadow: 0 1px 0 rgba(18,19,24,.04), 0 10px 30px -18px rgba(18,19,24,.35);
  --font: 'Manrope', 'Noto Sans Tamil', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--paper); color: var(--ink); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); }
a:hover { color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
[lang="ta"], .ta { font-family: 'Noto Sans Tamil', var(--font); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600;
  text-decoration: none; color: var(--ink); transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: #CFCBC0; background: #FAF9F6; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:disabled { background: #B9B7AF; border-color: #B9B7AF; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-danger { color: var(--bad); border-color: #EBC5C0; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--soft); color: var(--ink); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input-wrap { position: relative; }
.input { width: 100%; min-height: 48px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  font-size: 15px; transition: border-color .15s, box-shadow .15s; }
.input:hover { border-color: #D4D0C5; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(18,19,24,.06); }
.input.ok { border-color: var(--good); }
.input.err { border-color: var(--bad); box-shadow: 0 0 0 4px rgba(179,38,30,.06); }
.input-wrap .input { padding-right: 46px; }
.input-wrap .suffix { position: absolute; right: 4px; top: 4px; }
.hint { font-size: 12.5px; color: var(--muted); min-height: 18px; display: flex; align-items: center; gap: 6px; }
.hint.ok { color: var(--good); } .hint.err { color: var(--bad); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rules { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, auto); gap: 4px 14px; font-size: 12.5px; color: var(--faint); justify-content: start; }
.rules li { display: flex; align-items: center; gap: 6px; transition: color .2s; }
.rules li::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #CFCBC0; flex: none; transition: all .2s; }
.rules li.met { color: var(--good); }
.rules li.met::before { background: var(--good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' stroke='white' stroke-width='2' fill='none'/%3E%3C/svg%3E") center/12px no-repeat; border-color: var(--good); }
.meter { height: 4px; border-radius: 4px; background: var(--soft); overflow: hidden; margin-top: 2px; }
.meter > i { display: block; height: 100%; width: 0; background: var(--bad); transition: width .25s, background .25s; }

/* ---------- misc ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.pill.good { background: var(--good-soft); color: var(--good); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.accent { background: var(--accent-soft); color: var(--accent-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }
.dot.live { background: #19A463; box-shadow: 0 0 0 0 rgba(25,164,99,.5); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(25,164,99,.45);} 70% { box-shadow: 0 0 0 8px rgba(25,164,99,0);} 100% { box-shadow: 0 0 0 0 rgba(25,164,99,0);} }
.seg { display: inline-flex; padding: 3px; background: var(--soft); border-radius: 10px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(18,19,24,.14); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); }
.brand img { width: 32px; height: 32px; }
.brand small { font-weight: 600; font-size: 11px; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 6px; border-radius: 5px; letter-spacing: .02em; }

.toast-box { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); animation: rise .25s ease-out; }
.toast.err { background: var(--bad); }
@keyframes rise { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.skeleton { background: linear-gradient(90deg, var(--soft), #F7F6F2, var(--soft)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- auth page ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-side { background: var(--ink); color: #EDEBE4; padding: 44px 56px; display: flex; flex-direction: column; gap: 36px; position: relative; overflow: hidden; }
.auth-side .brand { color: #fff; }
.auth-side h1 { font-size: 44px; line-height: 1.08; letter-spacing: -0.03em; margin: 0; font-weight: 800; color: #fff; }
.auth-side h1 em { font-style: normal; color: var(--accent); }
.auth-side p { color: #BDBAB1; font-size: 16px; max-width: 520px; margin: 0; }
.demo-chat { background: #1C1D23; border: 1px solid #2C2D35; border-radius: 16px; padding: 18px; max-width: 520px; display: flex; flex-direction: column; gap: 12px; }
.demo-q { align-self: flex-end; background: #2C2D35; color: #fff; border-radius: 12px 12px 4px 12px; padding: 9px 13px; font-size: 14px; min-height: 40px; }
.demo-a { color: #D9D6CD; font-size: 14px; line-height: 1.6; min-height: 70px; }
.demo-a b { color: #fff; }
.demo-cite { color: var(--accent); font-family: var(--mono); font-size: 12px; }
.demo-steps { font-family: var(--mono); font-size: 11.5px; color: #8E8B83; }
.caret { display: inline-block; width: 7px; height: 15px; background: var(--accent); vertical-align: -2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.auth-stats { display: flex; gap: 32px; margin-top: auto; }
.auth-stats div b { display: block; font-size: 26px; color: #fff; font-weight: 800; letter-spacing: -0.02em; }
.auth-stats div span { font-size: 13px; color: #9C9990; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 22px; }
.auth-card h2 { font-size: 28px; letter-spacing: -0.02em; margin: 0; font-weight: 800; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-foot { font-size: 12.5px; color: var(--faint); text-align: center; }
.admin-note { display: flex; gap: 10px; align-items: flex-start; background: var(--soft); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--muted); }
.form-error { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; }

/* ---------- user app ---------- */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr) 320px; height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; gap: 6px; min-height: 0; }
.side .brand { padding: 2px 6px 14px; }
.side h4 { font-size: 11.5px; letter-spacing: .08em; color: var(--faint); margin: 14px 8px 4px; font-weight: 700; }
.thread { display: block; padding: 9px 10px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border: 0; background: none; text-align: left; width: 100%; }
.thread:hover { background: var(--soft); }
.threads { overflow-y: auto; flex: 1; min-height: 0; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px 8px 2px; border-top: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: rgba(245,244,239,.85); backdrop-filter: blur(6px); }
.topbar h1 { font-size: 16px; margin: 0; font-weight: 700; }
.scroll { flex: 1; overflow-y: auto; min-height: 0; }
.stream { max-width: 820px; margin: 0 auto; padding: 28px 28px 12px; display: flex; flex-direction: column; gap: 22px; }
.welcome { padding-top: 6vh; display: flex; flex-direction: column; gap: 22px; animation: fade .4s; }
.welcome h2 { font-size: 34px; margin: 0; letter-spacing: -0.03em; font-weight: 800; }
.welcome h2 span { color: var(--accent); }
.topics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.topic { text-align: left; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: #fff; cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: transform .15s, box-shadow .15s, border-color .15s; }
.topic:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #D7D3C8; }
.topic .ic { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.topic b { font-size: 14.5px; } .topic span { font-size: 13px; color: var(--muted); line-height: 1.45; }
.msg-user { align-self: flex-end; max-width: 78%; background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 16px 16px 4px 16px; animation: rise .2s; }
.msg-bot { display: flex; gap: 12px; animation: rise .25s; }
.msg-bot > img { width: 30px; height: 30px; flex: none; margin-top: 2px; }
.bubble { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.steps { font-family: var(--mono); font-size: 12px; color: var(--faint); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.steps span::before { content: "✓ "; color: var(--good); }
.answer { font-size: 15.5px; line-height: 1.7; }
.answer p { margin: 0 0 8px; } .answer ul { margin: 4px 0 8px; padding-left: 20px; } .answer li { margin: 3px 0; }
.answer strong { font-weight: 700; }
.cite { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 4px; margin: 0 1px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-ink); font: 600 11px var(--mono); vertical-align: 2px; cursor: pointer; border: 0; }
.cite:hover { background: var(--accent); color: #fff; }
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.src { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.src:hover { border-color: var(--ink); color: var(--ink); }
.src.flash { box-shadow: 0 0 0 3px var(--accent); }
.src .n { font: 600 12px var(--mono); color: var(--accent-ink); }
.src b { font-size: 13px; font-weight: 600; display: block; line-height: 1.35; }
.src small { font-size: 11.5px; color: var(--faint); }
.actions { display: flex; gap: 4px; align-items: center; }
.followups { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: #fff; padding: 8px 13px; border-radius: 999px; cursor: pointer; font-size: 13.5px; font-weight: 500; transition: all .15s; text-align: left; }
.chip:hover { border-color: var(--ink); background: var(--ink); color: #fff; }
.chip::before { content: "↳ "; color: var(--accent); }
.typing { display: inline-flex; gap: 4px; padding: 8px 0; } .typing i { width: 7px; height: 7px; background: var(--faint); border-radius: 50%; animation: bounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.composer { max-width: 820px; width: 100%; margin: 0 auto; padding: 10px 28px 22px; }
.composer form { display: flex; align-items: flex-end; gap: 10px; background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 8px 8px 8px 16px; box-shadow: var(--shadow); transition: border-color .15s; }
.composer form:focus-within { border-color: var(--ink); }
.composer textarea { flex: 1; border: 0; outline: none; resize: none; min-height: 28px; max-height: 160px; padding: 8px 0; font-size: 15.5px; background: transparent; }
.send { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--ink); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none; }
.send:hover { background: var(--accent); } .send:disabled { background: #C9C6BD; cursor: default; }
.composer .note { text-align: center; font-size: 12px; color: var(--faint); margin-top: 8px; }
.rail { border-left: 1px solid var(--line); background: #FBFAF7; padding: 20px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; }
.rail h3 { font-size: 13px; margin: 0 0 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.tl { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.tl li { position: relative; font-size: 13.5px; line-height: 1.45; }
.tl li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
.tl small { display: block; font: 500 11.5px var(--mono); color: var(--faint); }
.tl a { color: var(--ink); text-decoration: none; font-weight: 600; } .tl a:hover { color: var(--accent-ink); }
.kb-stat { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kb-stat div { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.kb-stat b { font: 600 20px var(--mono); display: block; } .kb-stat span { font-size: 12px; color: var(--muted); }

/* ---------- admin ---------- */
.admin { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.a-side { background: var(--ink); color: #CFCCC3; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.a-side .brand { color: #fff; padding: 0 8px 18px; }
.a-side .brand small { background: #2C2D35; color: #F59A72; }
.nav { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px; color: #CFCCC3; text-decoration: none; font-weight: 600; font-size: 14px; cursor: pointer; border: 0; background: none; text-align: left; width: 100%; }
.nav:hover { background: #1F2027; color: #fff; }
.nav.on { background: #26272F; color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav svg { opacity: .85; }
.a-side .foot { margin-top: auto; border-top: 1px solid #2A2B33; padding: 14px 8px 0; font-size: 12.5px; display: flex; flex-direction: column; gap: 10px; }
.a-main { padding: 26px 32px 48px; min-width: 0; }
.a-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.a-head h1 { margin: 0; font-size: 28px; letter-spacing: -0.025em; font-weight: 800; }
.a-head p { margin: 4px 0 0; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi .lbl { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi .val { font: 600 30px var(--mono); letter-spacing: -0.02em; }
.kpi .sub { font-size: 12.5px; color: var(--faint); }
.kpi canvas { position: absolute; right: 12px; bottom: 12px; width: 90px !important; height: 34px !important; }
.row { display: grid; gap: 14px; margin-bottom: 14px; }
.row.r-2-1 { grid-template-columns: 2fr 1fr; } .row.r-1-1 { grid-template-columns: 1fr 1fr; } .row.r-1-1-1 { grid-template-columns: 1fr 1fr 1fr; }
.panel { padding: 18px 20px; min-width: 0; }
.panel h3 { margin: 0 0 14px; font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel h3 small { font-weight: 500; color: var(--faint); font-size: 12.5px; }
.chart-box { position: relative; height: 240px; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--soft); font-size: 13.5px; align-items: flex-start; }
.feed li:last-child { border-bottom: 0; }
.feed .ic { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: none; font-size: 13px; }
.feed time { margin-left: auto; color: var(--faint); font: 500 11.5px var(--mono); white-space: nowrap; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 4px 10px; font-size: 13px; }
.bar-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row b { font-family: var(--mono); text-align: right; font-weight: 500; }
.bar-row i { grid-column: 1 / -1; height: 6px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.bar-row i::after { content: ""; display: block; height: 100%; width: var(--w); background: var(--ink); border-radius: 4px; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.gauge { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 13px; }
.gauge div { display: flex; justify-content: space-between; } .gauge b { font-family: var(--mono); font-weight: 500; }
.gauge i { height: 8px; border-radius: 6px; background: var(--soft); overflow: hidden; } .gauge i::after { content: ""; display: block; height: 100%; width: var(--w); background: var(--good); border-radius: 6px; transition: width .8s; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .input { min-height: 40px; width: 280px; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
.t th.num, .t td.num { text-align: right; font-family: var(--mono); }
.t td { padding: 11px 12px; border-bottom: 1px solid var(--soft); vertical-align: middle; }
.t tbody tr { cursor: pointer; transition: background .1s; } .t tbody tr:hover { background: #FAF9F5; }
.who { display: flex; align-items: center; gap: 10px; } .who b { display: block; font-weight: 700; } .who small { color: var(--faint); font-size: 12px; }
.drawer-bg { position: fixed; inset: 0; background: rgba(18,19,24,.35); z-index: 40; animation: fade .2s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--paper); z-index: 41; overflow-y: auto; box-shadow: -20px 0 50px -20px rgba(0,0,0,.4); animation: slide .25s ease-out; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer header { position: sticky; top: 0; background: var(--paper); padding: 20px 24px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 14px; align-items: center; z-index: 1; }
.drawer section { padding: 18px 24px; }
.mini-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.mini-kpis div { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.mini-kpis b { font: 600 18px var(--mono); display: block; } .mini-kpis span { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button { border: 0; background: none; padding: 9px 12px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-color: var(--accent); }
details.q { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
details.q summary { cursor: pointer; display: flex; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 14px; list-style: none; }
details.q summary::-webkit-details-marker { display: none; }
details.q .answer { font-size: 14px; margin-top: 10px; }
.sess { display: grid; grid-template-columns: 120px 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--soft); font-size: 13px; align-items: center; }
.sess .bar { height: 8px; border-radius: 5px; background: var(--ink); min-width: 4px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.progress { height: 6px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 40%; background: var(--accent); animation: indet 1.2s infinite ease-in-out; }
@keyframes indet { from { transform: translateX(-100%);} to { transform: translateX(260%);} }

@media (max-width: 1180px) { .app { grid-template-columns: 240px minmax(0, 1fr); } .rail { display: none; } .kpis { grid-template-columns: repeat(2, 1fr); } .row.r-2-1, .row.r-1-1-1 { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-side { display: none; } .app { grid-template-columns: 1fr; } .side { display: none; } .topics { grid-template-columns: 1fr 1fr; } .admin { grid-template-columns: 1fr; } .a-side { display: none; } .row.r-1-1 { grid-template-columns: 1fr; } }

/* =================== motion & colour layer =================== */
.bg-fx { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: var(--paper); }
.bg-fx i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; animation: drift 22s ease-in-out infinite alternate; }
.bg-fx i:nth-child(1) { width: 520px; height: 520px; background: #FFC9A8; top: -160px; right: -80px; }
.bg-fx i:nth-child(2) { width: 460px; height: 460px; background: #D9D1FF; bottom: -180px; left: 10%; animation-duration: 28s; animation-delay: -6s; }
.bg-fx i:nth-child(3) { width: 380px; height: 380px; background: #BFEBDD; top: 35%; left: 45%; animation-duration: 25s; animation-delay: -12s; opacity: .4; }
@keyframes drift { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(60px, 40px) scale(1.08); } 100% { transform: translate(-40px, 70px) scale(.95); } }
.grad-text { background: linear-gradient(90deg, #E2531D, #F59E0B, #C2410C, #E2531D); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 6s linear infinite; }
@keyframes shine { to { background-position: 300% 0; } }
.stagger > * { animation: rise .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 70ms); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* auth: live network canvas */
#net { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }
.auth-side > *:not(canvas) { position: relative; z-index: 1; }
.auth-side::after { content: ""; position: absolute; width: 520px; height: 520px; right: -200px; top: -160px; border-radius: 50%; background: radial-gradient(circle, rgba(226,83,29,.35), transparent 65%); animation: drift 18s ease-in-out infinite alternate; }
.auth-main { position: relative; }

/* topic cards: spotlight follows the mouse */
.topic { position: relative; overflow: hidden; background: rgba(255,255,255,.85); backdrop-filter: blur(6px); }
.topic::after { content: ""; position: absolute; inset: 0; background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), var(--glow, rgba(226,83,29,.14)), transparent 60%); opacity: 0; transition: opacity .25s; pointer-events: none; }
.topic:hover::after { opacity: 1; }
.topic .ic { transition: transform .25s; } .topic:hover .ic { transform: scale(1.12) rotate(-6deg); }
.topic .go { position: absolute; right: 14px; top: 14px; opacity: 0; transform: translateX(-6px); transition: all .2s; color: var(--muted); }
.topic:hover .go { opacity: 1; transform: none; }

.voice-cta { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: 16px; background: linear-gradient(120deg, #121318, #2A1F1A 60%, #3B2216); color: #fff; border: 0; cursor: pointer; text-align: left; box-shadow: var(--shadow); transition: transform .2s; }
.voice-cta:hover { transform: translateY(-2px); }
.voice-cta .orb { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; position: relative; }
.voice-cta .orb::before, .voice-cta .orb::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); animation: ring 2.2s ease-out infinite; }
.voice-cta .orb::after { animation-delay: 1.1s; }
@keyframes ring { from { transform: scale(1); opacity: .8; } to { transform: scale(1.9); opacity: 0; } }
.voice-cta b { display: block; font-size: 15px; } .voice-cta span { font-size: 13px; color: #CFCBC2; }

/* thinking: cycling steps */
.think { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.think div { display: flex; align-items: center; gap: 8px; color: var(--faint); transition: color .3s; }
.think div.on { color: var(--ink); font-weight: 600; } .think div.done { color: var(--good); }
.think div::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #D4D0C5; flex: none; }
.think div.on::before { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.think div.done::before { border-color: var(--good); background: var(--good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' stroke='white' stroke-width='2' fill='none'/%3E%3C/svg%3E") center/11px no-repeat; }
@keyframes spin { to { transform: rotate(360deg); } }
.answer.streaming > *:last-child::after { content: ""; display: inline-block; width: 8px; height: 16px; margin-left: 2px; background: var(--accent); vertical-align: -2px; animation: blink 1s steps(2) infinite; }
.reveal > * { animation: rise .45s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 90ms); }

/* mic + recorder */
.mic { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none; transition: all .15s; position: relative; }
.mic:hover { border-color: var(--accent); color: var(--accent); }
.rec-bar { display: none; align-items: center; gap: 12px; flex: 1; min-height: 44px; }
.composer form.recording .rec-bar { display: flex; }
.composer form.recording textarea, .composer form.recording .mic { display: none; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #E5484D; flex: none; animation: pulseRed 1.2s infinite; }
@keyframes pulseRed { 0% { box-shadow: 0 0 0 0 rgba(229,72,77,.55);} 70% { box-shadow: 0 0 0 10px rgba(229,72,77,0);} 100% { box-shadow: 0 0 0 0 rgba(229,72,77,0);} }
.rec-bar canvas { flex: 1; height: 40px; min-width: 0; }
.rec-time { font: 600 13px var(--mono); color: var(--ink-2); min-width: 42px; }
.composer form.recording { border-color: #E5484D; box-shadow: 0 0 0 4px rgba(229,72,77,.08), var(--shadow); }
.composer form.transcribing .rec-bar canvas { opacity: .3; }
.rec-status { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* listen button + equalizer */
.listen { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); transition: all .15s; }
.listen:hover { border-color: var(--ink); }
.listen.playing { background: var(--ink); color: #fff; border-color: var(--ink); }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.eq i { width: 3px; height: 30%; background: currentColor; border-radius: 2px; }
.listen.playing .eq i { animation: eq .9s ease-in-out infinite; }
.listen.playing .eq i:nth-child(2) { animation-delay: .15s; } .listen.playing .eq i:nth-child(3) { animation-delay: .3s; } .listen.playing .eq i:nth-child(4) { animation-delay: .45s; }
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }
.listen.loading .eq i { animation: eq 1.4s ease-in-out infinite; opacity: .5; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 600; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: #D4D0C5; position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--accent); } .switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* glass surfaces over the coloured background */
.app .main { background: transparent; }
.topbar { background: rgba(245,244,239,.7); }
.side { background: rgba(255,255,255,.88); backdrop-filter: blur(10px); }
.rail { background: rgba(251,250,247,.8); backdrop-filter: blur(10px); }
.src { transition: transform .15s, border-color .15s, box-shadow .15s; } .src:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.chip { animation: pop .35s cubic-bezier(.2,.9,.3,1.3) both; animation-delay: calc(var(--i, 0) * 80ms + .2s); }
@keyframes pop { from { opacity: 0; transform: scale(.85) translateY(6px); } to { opacity: 1; transform: none; } }

/* admin colour accents */
.admin .a-main { position: relative; }
.kpi { transition: transform .2s, box-shadow .2s; }
.kpi:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -22px rgba(18,19,24,.45); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--kc, var(--ink)); }
.kpi .lbl .kic { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--kc, #121318) 14%, white); color: var(--kc, #121318); }
.hero-band { border-radius: 18px; padding: 22px 26px; margin-bottom: 18px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(120deg, #121318 0%, #2B1A14 55%, #5A2410 100%); }
.hero-band::after { content: ""; position: absolute; width: 420px; height: 420px; right: -120px; top: -200px; border-radius: 50%; background: radial-gradient(circle, rgba(226,83,29,.55), transparent 65%); animation: drift 16s ease-in-out infinite alternate; }
.hero-band > * { position: relative; z-index: 1; }
.hero-band h1 { color: #fff; } .hero-band p { color: #D6D2C8 !important; }
.hero-band .seg { background: rgba(255,255,255,.1); } .hero-band .seg button { color: #D6D2C8; } .hero-band .seg button.on { background: #fff; color: var(--ink); }
.hero-stats { display: flex; gap: 28px; margin-top: 14px; flex-wrap: wrap; }
.hero-stats div b { font: 600 22px var(--mono); display: block; } .hero-stats div span { font-size: 12.5px; color: #BDB9AF; }
.card.panel { transition: box-shadow .2s; } .card.panel:hover { box-shadow: 0 18px 40px -26px rgba(18,19,24,.4); }
.via { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; }
