/* =========================================================================
   Học tập số · Ban Tuyên giáo và Dân vận (TGDV)
   Visual identity: cờ đỏ #C8102E · sao vàng #F2C230 · warm paper neutrals
   ========================================================================= */

/* ----- Tokens ----------------------------------------------------------- */
:root {
  --red-700: #8E121E;
  --red-600: #C8102E;
  --red-500: #DA251D;
  --red-050: #FCEDEE;

  --gold-500: #F2C230;
  --gold-600: #C99512;
  --gold-050: #FBF2D6;

  --bg:        #F7F2EE;
  --bg-tint:   #F1E8E2;
  --surface:   #FFFFFF;
  --surface-2: #F6EFEB;
  --surface-3: #EFE5DF;

  --ink:    #241A1B;
  --ink-2:  #4A3B3C;
  --muted:  #776A67;
  --faint:  #9A8C88;
  --line:   #E8DDD6;
  --line-2: #DCCEC6;

  --green-600: #17824E;
  --green-bg:  #E6F4EC;
  --amber-600: #A46B06;
  --amber-bg:  #FBF0D9;

  --shadow-sm: 0 1px 2px rgba(60,30,20,.06), 0 1px 1px rgba(60,30,20,.04);
  --shadow-md: 0 6px 18px -8px rgba(80,30,25,.20), 0 2px 6px -2px rgba(80,30,25,.10);
  --shadow-lg: 0 24px 50px -18px rgba(70,20,20,.35), 0 8px 20px -12px rgba(70,20,20,.20);
  --shadow-red: 0 10px 24px -10px rgba(200,16,46,.55);

  --r-xs: 7px;
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 18px;
  --r-xl: 24px;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  --maxw: 1120px;
  --ease: cubic-bezier(.22,.61,.36,1);
  --header-h: 66px;

  --font-sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --red-700: #B4222B;
    --red-600: #E23A44;
    --red-500: #EF4B4B;
    --red-050: #2A1618;

    --gold-500: #F5CB45;
    --gold-600: #E8B92E;
    --gold-050: #2B2410;

    --bg:        #140F10;
    --bg-tint:   #1A1214;
    --surface:   #1E1618;
    --surface-2: #251B1E;
    --surface-3: #2E2226;

    --ink:    #F6ECE8;
    --ink-2:  #D8C8C3;
    --muted:  #AC9B96;
    --faint:  #86746F;
    --line:   #362A2D;
    --line-2: #43343A;

    --green-600: #37B972;
    --green-bg:  #12241A;
    --amber-600: #E4AE3C;
    --amber-bg:  #2A2110;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 8px 22px -10px rgba(0,0,0,.6);
    --shadow-lg: 0 26px 55px -20px rgba(0,0,0,.75);
    --shadow-red: 0 10px 26px -12px rgba(226,58,68,.5);

    color-scheme: dark;
  }
}

/* Manual toggle wins in both directions */
:root[data-theme="light"] {
  --red-700:#8E121E; --red-600:#C8102E; --red-500:#DA251D; --red-050:#FCEDEE;
  --gold-500:#F2C230; --gold-600:#C99512; --gold-050:#FBF2D6;
  --bg:#F7F2EE; --bg-tint:#F1E8E2; --surface:#FFFFFF; --surface-2:#F6EFEB; --surface-3:#EFE5DF;
  --ink:#241A1B; --ink-2:#4A3B3C; --muted:#776A67; --faint:#9A8C88; --line:#E8DDD6; --line-2:#DCCEC6;
  --green-600:#17824E; --green-bg:#E6F4EC; --amber-600:#A46B06; --amber-bg:#FBF0D9;
  --shadow-sm:0 1px 2px rgba(60,30,20,.06),0 1px 1px rgba(60,30,20,.04);
  --shadow-md:0 6px 18px -8px rgba(80,30,25,.20),0 2px 6px -2px rgba(80,30,25,.10);
  --shadow-lg:0 24px 50px -18px rgba(70,20,20,.35),0 8px 20px -12px rgba(70,20,20,.20);
  --shadow-red:0 10px 24px -10px rgba(200,16,46,.55);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --red-700:#B4222B; --red-600:#E23A44; --red-500:#EF4B4B; --red-050:#2A1618;
  --gold-500:#F5CB45; --gold-600:#E8B92E; --gold-050:#2B2410;
  --bg:#140F10; --bg-tint:#1A1214; --surface:#1E1618; --surface-2:#251B1E; --surface-3:#2E2226;
  --ink:#F6ECE8; --ink-2:#D8C8C3; --muted:#AC9B96; --faint:#86746F; --line:#362A2D; --line-2:#43343A;
  --green-600:#37B972; --green-bg:#12241A; --amber-600:#E4AE3C; --amber-bg:#2A2110;
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);
  --shadow-md:0 8px 22px -10px rgba(0,0,0,.6);
  --shadow-lg:0 26px 55px -20px rgba(0,0,0,.75);
  --shadow-red:0 10px 26px -12px rgba(226,58,68,.5);
  color-scheme: dark;
}

/* ----- Reset ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2.5px solid var(--red-500); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--gold-050); color: var(--ink); }
b, strong { font-weight: 700; }

/* ----- Utility ---------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(16px, 4vw, 28px); }
.num { font-variant-numeric: tabular-nums; }
.sr { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================================================
   HEADER
   ======================================================================== */
.appbar {
  position: sticky; top: 0; z-index: 40;
  background:
    linear-gradient(180deg, rgba(0,0,0,.06), rgba(0,0,0,0) 40%),
    linear-gradient(105deg, var(--red-700), var(--red-600) 55%, var(--red-500));
  color: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.15), var(--shadow-md);
  border-bottom: 2px solid var(--gold-500);
}
.appbar__row {
  height: var(--header-h);
  display: flex; align-items: center; gap: var(--sp-4);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__star {
  flex: none; width: 40px; height: 40px; border-radius: 11px;
  background: radial-gradient(120% 120% at 30% 20%, #FFE68A, var(--gold-500) 60%, var(--gold-600));
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.4), 0 4px 12px -4px rgba(0,0,0,.5);
}
.brand__star svg { width: 25px; height: 25px; }
.brand__txt { min-width: 0; line-height: 1.15; }
.brand__title { font-weight: 800; font-size: 16px; letter-spacing: .2px; white-space: nowrap; }
.brand__sub {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: #FBE7C8; opacity: .92; white-space: nowrap;
}
.appbar__spacer { flex: 1; }
.appbar__actions { display: flex; align-items: center; gap: 8px; }

.iconbtn {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  color: #fff; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18); transition: background .15s var(--ease), transform .1s;
}
.iconbtn:hover { background: rgba(255,255,255,.22); }
.iconbtn:active { transform: scale(.94); }
.iconbtn svg { width: 20px; height: 20px; }

.userchip {
  display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 12px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px; max-width: 260px;
}
.userchip__name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userchip__av {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--gold-500); color: var(--red-700);
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}

/* ========================================================================
   CONTROL / STATS BAR
   ======================================================================== */
main { padding-block: var(--sp-6) var(--sp-12); }
.pagehead { margin-bottom: var(--sp-5); }
.pagehead h1 { font-size: clamp(20px, 3vw, 26px); font-weight: 800; letter-spacing: -.2px; text-wrap: balance; }
.pagehead p { color: var(--muted); margin-top: 4px; font-size: 14px; }

.control {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  padding: var(--sp-4); margin-bottom: var(--sp-6);
  display: flex; flex-direction: column; gap: var(--sp-4);
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.stat {
  position: relative; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--faint);
}
.stat--todo::before { background: var(--amber-600); }
.stat--done::before { background: var(--green-600); }
.stat--all::before  { background: var(--red-500); }
.stat__k { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.stat__v { font-size: 28px; font-weight: 800; line-height: 1.1; letter-spacing: -.5px; }
.stat--todo .stat__v { color: var(--amber-600); }
.stat--done .stat__v { color: var(--green-600); }
.stat--all  .stat__v { color: var(--ink); }
.stat__meta { font-size: 12px; color: var(--faint); }
.progressbar { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.progressbar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green-600), #2fb56f); transition: width .6s var(--ease); }

.control__tools { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.search {
  position: relative; flex: 1 1 240px; min-width: 200px;
}
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.search input {
  width: 100%; height: 42px; padding: 0 14px 0 38px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-color: var(--red-500); box-shadow: 0 0 0 3px var(--red-050); }

.segmented {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: 3px; gap: 2px;
}
.segmented button {
  padding: 7px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  display: inline-flex; align-items: center; gap: 7px; transition: color .15s, background .15s;
}
.segmented button .cnt {
  font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--muted); font-variant-numeric: tabular-nums;
}
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.segmented button[aria-selected="true"] .cnt { background: var(--red-050); color: var(--red-600); }

/* ----- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: var(--r-sm);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  border: 1px solid transparent; transition: transform .1s var(--ease), background .15s, box-shadow .15s, border-color .15s, color .15s;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--sm { height: 36px; padding: 0 14px; font-size: 13.5px; border-radius: var(--r-xs); }
.btn--block { width: 100%; }

.btn--primary { background: var(--red-600); color: #fff; box-shadow: var(--shadow-red); }
.btn--primary:hover:not(:disabled) { background: var(--red-500); }
.btn--gold { background: var(--gold-500); color: #4A2D06; box-shadow: 0 8px 20px -10px rgba(242,194,48,.7); }
.btn--gold:hover:not(:disabled) { background: var(--gold-600); }
.btn--success { background: var(--green-600); color: #fff; box-shadow: 0 8px 20px -12px rgba(23,130,78,.7); }
.btn--success:hover:not(:disabled) { filter: brightness(1.06); }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--faint); }
.btn--outline-red { background: transparent; color: var(--red-600); border-color: color-mix(in srgb, var(--red-500) 45%, transparent); }
.btn--outline-red:hover:not(:disabled) { background: var(--red-050); }

/* ========================================================================
   LIST
   ======================================================================== */
.groups { display: flex; flex-direction: column; gap: var(--sp-6); }
.group__head {
  display: flex; align-items: center; gap: 12px; margin-bottom: var(--sp-3); padding-left: 2px;
}
.group__bar { width: 5px; height: 22px; border-radius: 3px; background: var(--red-500); flex: none; }
.group__title { font-size: 16.5px; font-weight: 800; letter-spacing: -.2px; }
.group__title span { color: var(--muted); font-weight: 600; }
.group__count {
  margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px;
}
.list { display: flex; flex-direction: column; gap: var(--sp-3); }

.item {
  position: relative; display: grid;
  grid-template-columns: 1fr auto; gap: var(--sp-4); align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 18px 16px 20px; box-shadow: var(--shadow-sm);
  transition: box-shadow .18s var(--ease), border-color .18s, transform .18s;
}
.item::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0;
  background: var(--amber-600);
}
.item--done::before { background: var(--green-600); }
.item:hover { box-shadow: var(--shadow-md); border-color: var(--line-2); transform: translateY(-1px); }
.item.is-confirming { opacity: .7; }
.item.just-done { animation: flashDone .9s var(--ease); }
@keyframes flashDone {
  0% { background: var(--green-bg); }
  100% { background: var(--surface); }
}

.item__main { min-width: 0; }
.item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 8px; }
.item__title {
  font-size: 15.5px; font-weight: 700; line-height: 1.4; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item__id { margin-top: 6px; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.item__actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* chips + pills */
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em; border-radius: 7px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.chip svg { width: 13px; height: 13px; opacity: .8; }
.chip--sector { color: var(--red-600); background: var(--red-050); border-color: color-mix(in srgb, var(--red-500) 22%, transparent); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px;
  font-size: 12px; font-weight: 700; border-radius: 999px; letter-spacing: .01em;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.pill--todo { color: var(--amber-600); background: var(--amber-bg); }
.pill--todo::before { background: var(--amber-600); }
.pill--done { color: var(--green-600); background: var(--green-bg); }
.pill--done::before { background: var(--green-600); }
.pill--exam { color: var(--red-600); background: var(--red-050); }
.pill--exam::before { background: var(--red-500); }

/* ========================================================================
   SKELETON / EMPTY
   ======================================================================== */
.skel { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 6px; }
.skel::after {
  content:""; position:absolute; inset:0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skel-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; display:flex; flex-direction:column; gap:10px; }

.empty {
  text-align: center; padding: 64px 24px; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r-lg);
}
.empty svg { width: 52px; height: 52px; margin: 0 auto 14px; color: var(--faint); opacity: .8; }
.empty h3 { font-size: 17px; color: var(--ink); font-weight: 700; margin-bottom: 4px; }
.empty p { font-size: 14px; }

/* ========================================================================
   DETAIL DRAWER
   ======================================================================== */
.overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(30,12,12,.5);
  backdrop-filter: blur(3px); opacity: 0; transition: opacity .25s var(--ease);
}
.overlay.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; width: min(560px, 100%);
  background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .32s var(--ease);
}
.drawer.show { transform: none; }
.drawer__head {
  padding: 18px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 12px; background: var(--surface);
}
.drawer__head .grow { min-width: 0; }
.drawer__eyebrow { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--red-600); margin-bottom: 6px; }
.drawer__title { font-size: 17px; font-weight: 800; line-height: 1.35; text-wrap: balance; }
.drawer__body { padding: 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 22px; }
.drawer__foot {
  padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface);
  display: flex; gap: 10px;
}

.section__label {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.section__label svg { width: 15px; height: 15px; color: var(--red-500); }

.doc {
  font-size: 14.5px; line-height: 1.72; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px;
  overflow-wrap: break-word;
}
.doc :where(h1,h2,h3,h4) { color: var(--ink); line-height: 1.35; margin: 14px 0 8px; font-weight: 700; }
.doc h1 { font-size: 18px; } .doc h2 { font-size: 16.5px; } .doc h3 { font-size: 15px; }
.doc p { margin: 8px 0; }
.doc :where(ul,ol) { margin: 8px 0 8px 20px; } .doc li { margin: 4px 0; }
.doc a { color: var(--red-600); text-decoration: underline; text-underline-offset: 2px; }
.doc img { border-radius: 10px; margin: 10px 0; }
.doc table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.doc :where(td,th) { border: 1px solid var(--line-2); padding: 7px 10px; text-align: left; }
.doc-scroll { overflow-x: auto; }

.attach {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .15s, background .15s;
}
.attach + .attach { margin-top: 8px; }
.attach:hover { border-color: var(--red-500); background: var(--red-050); }
.attach__ic { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--red-050); color: var(--red-600); }
.attach__ic svg { width: 21px; height: 21px; }
.attach__m { min-width: 0; flex: 1; }
.attach__n { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach__s { font-size: 12px; color: var(--faint); }
.attach__dl { flex: none; color: var(--red-600); }
.attach__dl svg { width: 20px; height: 20px; }

.audio { width: 100%; height: 40px; margin-top: 8px; border-radius: 999px; }

/* ========================================================================
   TOASTS + PROGRESS MODAL
   ======================================================================== */
.toasts { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 10px; align-items: center; width: max-content; max-width: 92vw; }
.toast {
  display: flex; align-items: center; gap: 11px; padding: 12px 16px;
  background: var(--ink); color: var(--surface); border-radius: 999px; box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 500; animation: toastIn .3s var(--ease);
}
:root[data-theme="dark"] .toast, :root:not([data-theme="light"]) .toast { }
.toast svg { width: 19px; height: 19px; flex: none; }
.toast--ok  { background: #14663f; color: #eafaf0; }
.toast--err { background: #8f1720; color: #fdeaea; }
.toast--info{ background: var(--ink); color: var(--surface); }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.96); } }

.modal-scrim {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  background: rgba(30,12,12,.55); backdrop-filter: blur(3px); padding: 20px;
  opacity: 0; transition: opacity .2s var(--ease);
}
.modal-scrim.show { opacity: 1; }
.progress-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 26px 26px 24px; width: min(400px, 100%); text-align: center;
}
.progress-card h3 { font-size: 17px; font-weight: 800; }
.progress-card p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.progress-card .bigcount { font-size: 34px; font-weight: 800; color: var(--red-600); font-variant-numeric: tabular-nums; margin: 14px 0 6px; }
.progress-card .progressbar { height: 10px; margin-top: 14px; }

/* ========================================================================
   LOGIN
   ======================================================================== */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 700px at 100% -10%, color-mix(in srgb, var(--red-500) 20%, transparent), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, color-mix(in srgb, var(--gold-500) 16%, transparent), transparent 55%),
    var(--bg);
  position: relative; overflow: hidden;
}
.auth__stars { position: absolute; inset: 0; opacity: .5; pointer-events: none; }
.auth__card {
  position: relative; width: min(430px, 100%);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.auth__banner {
  padding: 30px 32px 26px;
  background:
    linear-gradient(180deg, rgba(0,0,0,.08), transparent 50%),
    linear-gradient(115deg, var(--red-700), var(--red-600) 60%, var(--red-500));
  color: #fff; text-align: center; border-bottom: 3px solid var(--gold-500);
}
.auth__logo {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 18px;
  background: radial-gradient(120% 120% at 30% 20%, #FFE896, var(--gold-500) 62%, var(--gold-600));
  display: grid; place-items: center; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.45), 0 10px 26px -10px rgba(0,0,0,.6);
}
.auth__logo svg { width: 38px; height: 38px; }
.auth__banner h1 { font-size: 20px; font-weight: 800; letter-spacing: .2px; }
.auth__banner p { font-size: 12.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: #FBE7C8; margin-top: 6px; }
.auth__form { padding: 28px 32px 30px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field__box { position: relative; }
.field__box > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: var(--faint); pointer-events: none; }
.field input {
  width: 100%; height: 48px; padding: 0 14px 0 42px;
  background: var(--surface-2); border: 1.5px solid var(--line-2); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s; color: var(--ink);
}
.field input::placeholder { color: var(--faint); }
.field input:focus { outline: none; border-color: var(--red-500); box-shadow: 0 0 0 3px var(--red-050); background: var(--surface); }
.field .peek { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.field .peek:hover { background: var(--surface-3); }
.auth__err {
  display: none; align-items: center; gap: 9px; padding: 11px 14px;
  background: var(--red-050); border: 1px solid color-mix(in srgb, var(--red-500) 30%, transparent);
  color: var(--red-600); border-radius: var(--r-sm); font-size: 13.5px; font-weight: 500;
}
.auth__err.show { display: flex; }
.auth__err svg { width: 18px; height: 18px; flex: none; }
.auth__foot { text-align: center; margin-top: 2px; }
.auth__demo { font-size: 13px; color: var(--muted); }
.auth__demo button { color: var(--red-600); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.auth__note { text-align: center; font-size: 12px; color: var(--faint); margin-top: 18px; max-width: 430px; }

/* ========================================================================
   RESPONSIVE
   ======================================================================== */
@media (max-width: 720px) {
  .brand__sub { display: none; }
  .userchip__name { display: none; }
  .userchip { padding: 5px; }
  .stats { grid-template-columns: 1fr; }
  .stat { flex-direction: row; align-items: center; justify-content: space-between; }
  .stat__v { font-size: 24px; }
  .item { grid-template-columns: 1fr; }
  .item__actions { justify-content: stretch; }
  .item__actions .btn { flex: 1; }
  .control__tools { flex-direction: column; align-items: stretch; }
  .search { flex: 0 0 auto; width: 100%; }
  .segmented { justify-content: space-between; }
  .segmented button { flex: 1; justify-content: center; }
  .control__actions { display: contents; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
