*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #07040f;
  --card: rgba(255,255,255,0.04);
  --card-2: rgba(255,255,255,0.07);
  --line: rgba(100,255,218,0.12);
  --accent: #64ffda;
  --accent-2: #7b61ff;
  --gold: #f4b942;
  --text: #ccd6f6;
  --dim: #8892b0;
  --white: #e6f1ff;
  --tax: #64ffda;
  --law: #7b61ff;
  --company: #f4b942;
  --bank: #ff8fa3;
  --audit: #5ec2ff;
  --case: #b6a3ff;
  --student: #f2a65a;
  --bar: rgba(7,4,15,.7);
  --surface: #15111f;
  --track: #2a2540;
  --chip: rgba(255,255,255,.05);
  --on-accent: #07040f;
  --glow-1: rgba(123,97,255,.16);
  --glow-2: rgba(100,255,218,.09);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", "Nirmala UI", sans-serif;
  color-scheme: dark;
}
/* Light theme: chosen in the switch, or "Auto" on a device set to light. */
:root[data-theme="light"] {
  --bg: #f5f6fa;
  --card: #ffffff;
  --card-2: #f0f2f8;
  --line: rgba(20,30,70,.13);
  --accent: #0b8f78;
  --accent-2: #5b3fe0;
  --gold: #b7791f;
  --text: #2b3245;
  --dim: #5d6680;
  --white: #0e1428;
  --tax: #0b8f78;
  --law: #5b3fe0;
  --company: #a8690f;
  --bank: #c93a5f;
  --audit: #1b72b5;
  --case: #6d4fe0;
  --student: #b4580f;
  --bar: rgba(245,246,250,.82);
  --surface: #ffffff;
  --track: #c9cdd9;
  --chip: rgba(20,30,70,.06);
  --on-accent: #ffffff;
  --glow-1: rgba(91,63,224,.08);
  --glow-2: rgba(11,143,120,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f5f6fa; --card: #ffffff; --card-2: #f0f2f8; --line: rgba(20,30,70,.13);
    --accent: #0b8f78; --accent-2: #5b3fe0; --gold: #b7791f; --text: #2b3245; --dim: #5d6680; --white: #0e1428;
    --tax: #0b8f78; --law: #5b3fe0; --company: #a8690f; --bank: #c93a5f; --audit: #1b72b5; --case: #6d4fe0; --student: #b4580f;
    --bar: rgba(245,246,250,.82); --surface: #ffffff; --track: #c9cdd9; --chip: rgba(20,30,70,.06); --on-accent: #ffffff;
    --glow-1: rgba(91,63,224,.08); --glow-2: rgba(11,143,120,.06);
    color-scheme: light;
  }
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 50% at 15% 0%, var(--glow-1), transparent 70%),
    radial-gradient(50% 40% at 90% 10%, var(--glow-2), transparent 70%),
    var(--bg);
}
.wrap { width: min(860px, 100% - 32px); margin-inline: auto; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top { position: sticky; top: 0; z-index: 5; backdrop-filter: blur(14px); background: var(--bar); border-bottom: 1px solid var(--line); }
.bar { display: flex; justify-content: space-between; align-items: center; height: 56px; }
.brand { font-weight: 800; font-size: 17px; text-decoration: none; color: var(--white); letter-spacing: .02em; }
.brand span { color: var(--accent); }

.hero { padding: 48px 0 20px; }
.label { color: var(--accent); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }
h1 { color: var(--white); font-size: clamp(34px, 6vw, 52px); line-height: 1.1; margin: 8px 0 12px; letter-spacing: -.02em; }
.lede { color: var(--dim); max-width: 62ch; }
.meta { margin-top: 12px; font-size: 13px; color: var(--dim); min-height: 20px; }
.warn { color: var(--gold); }

.controls { position: sticky; top: 56px; z-index: 4; padding: 12px 0 6px; background: linear-gradient(var(--bg) 82%, transparent); }
.row { display: flex; gap: 10px; align-items: center; }
.search { flex: 1; }
input[type=search] {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--white); font: inherit; font-size: 15px; outline: none;
  transition: border-color .2s, background .2s;
}
input[type=search]::placeholder { color: var(--dim); }
input[type=search]:focus { border-color: var(--accent); background: var(--card-2); }

.sw {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  background: none; border: 0; color: var(--dim); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 2px;
}
.sw i { position: relative; width: 34px; height: 19px; border-radius: 10px; background: var(--track); transition: background .25s; }
.sw i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 15px; height: 15px; border-radius: 50%; background: #cfd2d8; transition: transform .25s; }
.seg { display: inline-flex; flex: none; padding: 3px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.seg button {
  background: none; border: 0; border-radius: 7px; padding: 5px 10px; cursor: pointer;
  color: var(--dim); font: inherit; font-size: 13px; font-weight: 600; transition: background .2s, color .2s;
}
.seg button.on { background: var(--accent-2); color: #fff; }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tools { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; margin: 4px 0 6px; }
.tools .askall { flex: 1 1 280px; margin: 0; min-width: 0; }
.datebox { display: contents; }
.dbar { display: flex; align-items: center; gap: 8px; flex: 0 1 300px; min-width: 0; }
.dbtn {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--white); font: inherit; font-size: 14px; cursor: pointer; text-align: left;
  transition: border-color .2s, background .2s;
}
.dbtn b { color: var(--dim); font-size: 12px; font-weight: 600; flex: none; }
.dbtn span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbtn i { flex: none; width: 7px; height: 7px; border-right: 2px solid var(--dim); border-bottom: 2px solid var(--dim); transform: rotate(45deg) translateY(-2px); transition: transform .2s; }
.dbtn[aria-expanded=true] i { transform: rotate(225deg); }
.dbtn[aria-expanded=true], .dbtn.on { border-color: var(--accent); }
.dbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dclr { background: none; border: 0; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 2px; flex: none; }
.dpanel { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 8px; flex: 1 0 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.dpanel[hidden] { display: none; }
.dpanel .seg { grid-column: 1 / -1; justify-self: start; }
.dgrp { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dgrp small { color: var(--dim); font-size: 12px; font-weight: 600; }
.pick { display: flex; gap: 4px; min-width: 0; }
.pick input, .pick select {
  flex: 1; min-width: 0; width: 100%; padding: 8px; border-radius: 9px; border: 1px solid var(--line); background: var(--card-2);
  color: var(--white); font: inherit; font-size: 13px; outline: none;
}
.pick input:focus, .pick select:focus { border-color: var(--accent); }
.pick select option { background: var(--surface); color: var(--white); }
.dhint { grid-column: 1 / -1; margin: 0; font-size: 12px; line-height: 1.4; color: var(--dim); }
.dpanel.bs .dgrp { grid-column: 1 / -1; }
@media (min-width: 561px) { .dpanel { grid-template-columns: auto 1fr 1fr; align-items: end; } .dpanel .seg, .dpanel.bs .dgrp { grid-column: auto; } .dpanel .pick { max-width: 340px; } }
@media (max-width: 560px) { .dbar { flex: 1 0 100%; } }
.orig { margin: -2px 0 8px; font-size: 13px; line-height: 1.45; color: var(--dim); }
.sw.on { color: var(--white); }
.sw.on i { background: var(--accent-2); }
.sw.on i::after { transform: translateX(15px); background: #fff; }

.tabs, .chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 10px 0 2px; }
.tabs::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.tab, .chip {
  flex: none; border: 1px solid var(--line); background: var(--card); color: var(--dim); font: inherit; cursor: pointer;
  border-radius: 999px; transition: color .2s, border-color .2s, background .2s;
}
.tab { padding: 6px 14px; font-size: 14px; font-weight: 600; }
.tab small { opacity: .6; margin-left: 5px; font-weight: 500; }
.chip { padding: 3px 11px; font-size: 12px; }
.tab:hover, .chip:hover { color: var(--white); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.tab.on { color: var(--on-accent); background: var(--c, var(--accent)); border-color: transparent; }
.tab.stu { color: var(--student); border-color: var(--student); background: color-mix(in srgb, var(--student) 14%, var(--card)); font-weight: 700; }
.tab.stu.on { color: var(--on-accent); background: var(--student); }
.chip.on { color: var(--white); background: color-mix(in srgb, var(--accent-2) 28%, transparent); border-color: var(--accent-2); }

.day { margin: 26px 0 4px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.card {
  --c: var(--accent);
  position: relative; margin: 10px 0; padding: 16px 18px 14px 20px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line); overflow: hidden;
  transition: background .2s, border-color .2s, transform .2s;
}
.card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c); }
.card:hover { background: var(--card-2); border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); }
.head b { color: var(--c); font-weight: 700; letter-spacing: .04em; }
.badge { padding: 1px 7px; border-radius: 6px; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.key { background: var(--gold); color: #1a1200; }
.new { background: var(--accent); color: #04221b; }
.badge.circ { background: color-mix(in srgb, var(--tax) 22%, transparent); color: var(--tax); border: 1px solid color-mix(in srgb, var(--tax) 45%, transparent); }.title { display: block; margin: 6px 0 6px; font-size: 17px; line-height: 1.4; font-weight: 650; color: var(--white); text-decoration: none; }
.title:hover { color: var(--accent); }
.sum { font-size: 14.5px; color: var(--text); }
.acts { margin-top: 6px; font-size: 13px; color: var(--dim); }
.why {
  margin-top: 10px; padding: 8px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  background: color-mix(in srgb, var(--c) 11%, transparent); color: color-mix(in srgb, var(--c) 55%, var(--white));
}
.why b { font-weight: 700; }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.t { font-size: 12px; color: var(--dim); padding: 1px 8px; border-radius: 999px; background: var(--chip); cursor: pointer; border: 0; font-family: inherit; }
.t:hover { color: var(--white); }
.btns { margin-left: auto; display: flex; gap: 8px; }
.btn {
  font-size: 13px; font-weight: 600; text-decoration: none; padding: 5px 12px; border-radius: 9px;
  border: 1px solid var(--line); color: var(--white); transition: border-color .2s, color .2s;
}
.btn:hover { border-color: var(--c); color: var(--c); }
mark { background: rgba(244,185,66,.3); color: inherit; border-radius: 3px; padding: 0 1px; }

.empty { margin: 50px 0; text-align: center; color: var(--dim); }
.empty b { display: block; color: var(--white); font-size: 18px; margin-bottom: 6px; }
.sk { height: 120px; margin: 10px 0; border-radius: 16px; background: linear-gradient(100deg, var(--card) 30%, var(--card-2) 50%, var(--card) 70%); background-size: 300% 100%; animation: sh 1.4s linear infinite; }
@keyframes sh { to { background-position: -300% 0; } }

.morewrap { display: flex; justify-content: center; margin: 22px 0 8px; }
#more { padding: 10px 24px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--white); font: inherit; font-weight: 600; cursor: pointer; }
#more:hover { border-color: var(--accent); }
.foot { margin: 36px auto 60px; font-size: 12.5px; color: var(--dim); max-width: 70ch; border-top: 1px solid var(--line); padding-top: 18px; }
.foot p + p { margin-top: 8px; }
.foot b { color: var(--text); }
/* Paragraphs read as justified blocks; titles and controls stay left-aligned. */
.lede, .sum, .why, .orig, .ans, .foot p { text-align: justify; text-justify: inter-word; hyphens: auto; }
.noscript { padding: 40px 0; color: var(--gold); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Ask AI ---- */
.bar-r { display: flex; align-items: center; gap: 10px; }
.aibtn {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--white); font: inherit; font-size: 13px; font-weight: 650;
}
.aibtn:hover { border-color: var(--accent-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.btn { background: none; font-family: inherit; cursor: pointer; }
.btn.primary { background: var(--accent-2); border-color: transparent; color: #fff; }
.btn.primary:hover { color: #fff; filter: brightness(1.1); }
.btn:disabled { opacity: .55; cursor: wait; }
.askall { margin: 4px 0 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 10px 14px; }
.askall summary { cursor: pointer; font-size: 14px; font-weight: 650; color: var(--white); }
.askall[open] summary { margin-bottom: 10px; }
.askrow { display: flex; gap: 8px; }
.askrow input {
  flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--white); font: inherit; font-size: 14px; outline: none;
}
.askrow input:focus { border-color: var(--accent); }
.askbox { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.ans { margin-top: 10px; font-size: 14.5px; color: var(--text); white-space: pre-wrap; }
.ans.wait { color: var(--dim); font-style: italic; }
.ans.err { color: var(--bank); }
dialog { margin: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); color: var(--text); padding: 0; width: min(460px, 100% - 32px); }
dialog::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(3px); }
.dlg { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.dlg h2 { font-size: 18px; color: var(--white); }
.dlg label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--white); }
.dlg label small { font-weight: 400; color: var(--dim); }
/* native dropdown list: solid colours per theme (dark mode otherwise shows light text on a white list) */
.dlg select option { background: var(--surface); color: var(--white); }
.dlg input[type=password], .dlg input[type=text], .dlg select {
  padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--card-2); color: var(--white); font: inherit; font-size: 14px;
}
.dlg .chk { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.dlg-note { font-size: 12.5px; color: var(--dim); }
.dlg-btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.statuslink { display: inline-block; margin-top: 12px; font-size: 13px; color: var(--accent); text-decoration: none; }
.statuslink:hover { text-decoration: underline; }

/* ---- Hero numbers (fills the right side on wide screens) ---- */
.stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 18px; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line); background: var(--line); text-decoration: none; color: inherit;
}
.stats[hidden] { display: none; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--surface); }
.stat b { font-size: 26px; line-height: 1.1; color: var(--white); font-weight: 750; }
.stat small { font-size: 12px; color: var(--dim); }
.stats:hover .stat { background: color-mix(in srgb, var(--surface) 92%, var(--accent)); }

/* ---- Source status page ---- */
a.brand { text-decoration: none; }
.health { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; margin-top: 4px; }
.health .empty { grid-column: 1 / -1; }
.health .sk { height: 170px; margin: 0; }
.hrow {
  --c: var(--accent); display: flex; flex-direction: column; padding: 16px 18px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); border-left: 4px solid var(--tax); transition: border-color .2s, background .2s;
}
.hrow:hover { background: var(--card-2); }
.hrow.warn { border-left-color: var(--gold); }
.hrow.bad { border-left-color: var(--bank); }
.htop { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding-bottom: 12px; color: var(--white); }
.hname { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hname b { line-height: 1.3; }
.hcat { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--c); }
.hlink { padding-top: 12px; font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; }
.hlink:hover { text-decoration: underline; }
.hfilter { margin: 4px 0 14px; }
.ok-t { color: var(--tax); } .warn-t { color: var(--gold); } .bad-t { color: var(--bank); }
.top .btn { font-size: 13px; }
.hbadge { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; background: color-mix(in srgb, var(--tax) 18%, transparent); color: var(--tax); }
.hbadge.warn { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }
.hbadge.bad { background: color-mix(in srgb, var(--bank) 18%, transparent); color: var(--bank); }
.hnote { margin-top: -6px; padding-bottom: 12px; font-size: 13px; color: var(--text); }
.hgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.hgrid dt { font-size: 11.5px; color: var(--dim); }
.hgrid dd { font-size: 14px; color: var(--white); font-weight: 600; }

/* ---- Wide screens: sticky filter sidebar on the left, feed at a comfortable reading width on the right ---- */
@media (min-width: 1100px) {
  .wrap { width: min(1240px, 100% - 64px); }
  .hero { padding: 34px 0 22px; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: center; }
  .stats { margin-top: 0; }
  .stat { padding: 16px 20px; }
  .stat b { font-size: 30px; }
  .hero h1 { font-size: 44px; }
  .lede { max-width: 75ch; }
  .layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 40px; align-items: start; }
  .controls {
    position: sticky; top: 72px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--card);
    max-height: calc(100vh - 88px); overflow-y: auto; scrollbar-width: thin;
  }
  .controls .row { flex-wrap: wrap; }
  .controls .search { flex-basis: 100%; }
  .tabs { flex-direction: column; overflow: visible; gap: 4px; padding-top: 14px; }
  .tab { display: flex; justify-content: space-between; text-align: left; border-radius: 10px; }
  .chips { flex-wrap: wrap; overflow: visible; padding-top: 12px; }
  .feed { min-width: 0; }  /* fills its column: right edge lines up with the stats box and header */
  .day:first-of-type { margin-top: 10px; }
  .card { padding: 20px 24px 16px 26px; }
  .title { font-size: 18.5px; }
  .orig { font-size: 13.5px; }
  .sum { font-size: 15.5px; line-height: 1.75; }
  .why { font-size: 14px; }
  .foot { max-width: none; }
}

@media (max-width: 560px) {
  .row { flex-wrap: wrap; }
  .search { flex-basis: 100%; }
  .btns { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* installed-app / phone polish */
.top { padding-top: env(safe-area-inset-top); }
body { padding-bottom: env(safe-area-inset-bottom); overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
.aibtn[hidden] { display: none; }
@media (max-width: 899px) {
  .controls { position: static; background: none; padding: 4px 0 6px; }
  .lede, .sum, .why, .orig, .ans, .foot p { text-align: left; hyphens: manual; }
  .lede { font-size: 15px; line-height: 1.6; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .stat { padding: 10px 8px; }
  .stat b { font-size: 19px; }
  .stat small { font-size: 10.5px; }
}
@media (max-width: 560px) {
  .bar { gap: 8px; }
  .bar-r { gap: 6px; }
  .brand { font-size: 15px; }
  .hero { padding: 24px 0 8px; }
  .aibtn { padding: 8px 10px; }
  button, .seg button, .tabs button { min-height: 38px; }
}

/* ---- Polish layer: easing, scroll reveal, press feedback, skip link ---- */
:root { --ease: cubic-bezier(0.32, 0.72, 0, 1); }
h1, .title { text-wrap: balance; }
.lede, .sum, .why, .orig { text-wrap: pretty; }
.card, .tab, .chip, .btn, .aibtn, #more, .seg button, .stats .stat { transition-timing-function: var(--ease); }
.card { transition-duration: .35s; }
.card:hover { transform: translateY(-2px); }
.tab:active, .chip:active, .btn:active, .aibtn:active, #more:active, .seg button:active, .t:active { transform: scale(.98); }
.skip { position: absolute; left: 16px; top: -48px; z-index: 10; padding: 8px 14px; border-radius: 10px; background: var(--accent-2); color: #fff; font-weight: 650; text-decoration: none; transition: top .2s var(--ease); }
.skip:focus { top: 8px; }
@supports (animation-timeline: view()) {
  @keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
  .card { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 40%; }
}
