/* ==========================================================================
   GMC અરજી પોર્ટલ — styles
   Deep-indigo government portal. Light + dark themes (data-theme on <html>).
   ========================================================================== */

:root {
  color-scheme: light;
  --primary: #1a237e;
  --primary-hi: #283593;
  --on-primary: #ffffff;
  --tint: #e8eaf6;
  --tint-ink: #1a237e;
  --gold: #e0a526;

  --bg: #f1f2f9;
  --card: #ffffff;
  --card-alt: #f6f7fc;
  --ink: #1b1f33;
  --muted: #586082;
  --line: #e0e3f0;
  --line-strong: #c7ccE3;
  --topbar: #1a237e;
  --topbar-ink: #ffffff;

  --shadow: 0 1px 2px rgba(18, 27, 102, .06), 0 10px 28px -14px rgba(18, 27, 102, .22);
  --shadow-pop: 0 28px 64px -18px rgba(8, 12, 60, .5);
  --scrim: rgba(12, 16, 52, .55);
  --focus: 0 0 0 3px rgba(92, 107, 192, .42);

  --r: 14px;
  --r-sm: 10px;
  --top-h: 58px;
  --side-w: 236px;
  --side-w-mini: 68px;

  --danger: #c62828;
  --danger-bg: #ffebee;
  --ok: #2e7d32;

  /* status (contract colours; *-ink = darker text shade for contrast) */
  --s-pending: #ef6c00;      --s-pending-bg: #fff3e0;      --s-pending-ink: #a64400;
  --s-in_progress: #1565c0;  --s-in_progress-bg: #e3f2fd;  --s-in_progress-ink: #0d519a;
  --s-responded: #2e7d32;    --s-responded-bg: #e8f5e9;    --s-responded-ink: #256528;
  --s-overdue: #b71c1c;      --s-overdue-bg: #ffebee;      --s-overdue-ink: #a01818;
  --s-closed: #546e7a;       --s-closed-bg: #eceff1;       --s-closed-ink: #46606b;
  --s-transferred: #607d8b;  --s-transferred-bg: #e4ebee;  --s-transferred-ink: #3f545e;
  --s-not_applicable: #c62828; --s-not_applicable-bg: #ffebee; --s-not_applicable-ink: #b02020;
  /* priority */
  --p-urgent: #c62828;  --p-urgent-bg: #ffebee;  --p-urgent-ink: #b02020;
  --p-high: #e65100;    --p-high-bg: #fff3e0;    --p-high-ink: #a84300;
  --p-normal: #1565c0;  --p-normal-bg: #e3f2fd;  --p-normal-ink: #0d519a;
  /* deadline buckets */
  --d-crit: #c62828; --d-warn: #8f5500; --d-ok: #2e7d32;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #5c6bc0;
  --primary-hi: #7986cb;
  --on-primary: #ffffff;
  --tint: #232a5c;
  --tint-ink: #c5cbf5;
  --gold: #e8b341;

  --bg: #0d1021;
  --card: #161a34;
  --card-alt: #1c2142;
  --ink: #e8eaf8;
  --muted: #9ea5c8;
  --line: #272c52;
  --line-strong: #353c6b;
  --topbar: #141a4a;
  --topbar-ink: #ffffff;

  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 30px -14px rgba(0, 0, 0, .7);
  --shadow-pop: 0 28px 64px -18px rgba(0, 0, 0, .8);
  --scrim: rgba(3, 5, 20, .7);
  --focus: 0 0 0 3px rgba(121, 134, 203, .5);

  --danger: #ef5350;
  --danger-bg: rgba(239, 83, 80, .14);
  --ok: #81c784;

  --s-pending: #ffa040;      --s-pending-bg: rgba(255, 160, 64, .15);     --s-pending-ink: #ffb870;
  --s-in_progress: #64b5f6;  --s-in_progress-bg: rgba(100, 181, 246, .15); --s-in_progress-ink: #8cc8fa;
  --s-responded: #81c784;    --s-responded-bg: rgba(129, 199, 132, .15);   --s-responded-ink: #9bd69e;
  --s-overdue: #ef5350;      --s-overdue-bg: rgba(239, 83, 80, .17);       --s-overdue-ink: #ff8a80;
  --s-closed: #90a4ae;       --s-closed-bg: rgba(144, 164, 174, .16);      --s-closed-ink: #b0bec5;
  --s-transferred: #78909c;  --s-transferred-bg: rgba(120, 144, 156, .2);  --s-transferred-ink: #b4c4cc;
  --s-not_applicable: #ef5350; --s-not_applicable-bg: rgba(239, 83, 80, .17); --s-not_applicable-ink: #ff8a80;
  --p-urgent: #ef5350;  --p-urgent-bg: rgba(239, 83, 80, .17);   --p-urgent-ink: #ff8a80;
  --p-high: #ffa040;    --p-high-bg: rgba(255, 160, 64, .15);    --p-high-ink: #ffb870;
  --p-normal: #64b5f6;  --p-normal-bg: rgba(100, 181, 246, .15); --p-normal-ink: #8cc8fa;
  --d-crit: #ff8a80; --d-warn: #ffc266; --d-ok: #9bd69e;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Noto Sans Gujarati', 'Noto Sans', 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.noscroll { overflow: hidden; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.35; }
p { margin: 0 0 .6em; }
a { color: var(--primary-hi); }
:root[data-theme="dark"] a { color: #9fa8e8; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
small { font-size: .82em; }
.muted { color: var(--muted); }
.req { color: var(--danger); font-weight: 700; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
button:focus-visible, .btn:focus-visible, [tabindex]:focus-visible { box-shadow: var(--focus); }

/* ------------------------------------------------------------------ boot */
.boot {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px;
  background: var(--bg); z-index: 90; color: var(--muted);
}
.boot-mark { font-size: 44px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); opacity: .7; } }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  font-weight: 600; font-size: 14px; line-height: 1.3; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.btn:hover { background: var(--card-alt); border-color: var(--primary-hi); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hi); border-color: var(--primary-hi); }
.btn.danger { background: var(--card); color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.danger.solid { background: var(--danger); color: #fff; }
.btn.good { background: var(--s-responded); border-color: var(--s-responded); color: #fff; }
:root[data-theme="dark"] .btn.good { color: #0d1021; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #2b1d00; }
.btn.sm { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.btn.lg { min-height: 48px; font-size: 16px; padding: 10px 22px; }
.btn.block { width: 100%; }
.btn.is-busy::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 18px; line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: rgba(127, 135, 190, .18); }

/* ------------------------------------------------------------ form fields */
.field { margin-bottom: 14px; min-width: 0; }
.field > label, .lbl { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 5px; color: var(--ink); }
.field .hint, .hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
input[type="text"], input[type="password"], input[type="search"], input[type="date"], input[type="datetime-local"],
input[type="tel"], input[type="number"], input[type="email"], input[type="color"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
input[type="color"] { padding: 4px; min-height: 44px; cursor: pointer; }
select { appearance: auto; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-hi); box-shadow: var(--focus); }
input.bad, select.bad, textarea.bad { border-color: var(--danger); }
.form-err { color: var(--danger); font-size: 13.5px; font-weight: 600; min-height: 0; margin: 4px 0 0; }
.form-err:empty { display: none; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; }

.pw { position: relative; }
.pw input { padding-right: 48px; }
.pw .icon-btn { position: absolute; right: 2px; top: 2px; width: 40px; height: 40px; font-size: 16px; }

/* priority radio pills */
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg label { position: relative; flex: 1 1 130px; margin: 0; cursor: pointer; }      /* the hidden radio is positioned inside its own label */
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: flex; flex-direction: column; align-items: center; gap: 0; padding: 8px 10px; text-align: center;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); background: var(--card); font-weight: 600; font-size: 13.5px;
  transition: all .15s;
}
.seg span small { font-weight: 500; color: var(--muted); }
.seg input:focus-visible + span { box-shadow: var(--focus); }
.seg input:checked + span { border-color: var(--c); background: var(--cb); color: var(--ci); }
.seg input:checked + span small { color: var(--ci); }

/* chips (selected branches) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px;
  border-radius: 999px; background: var(--tint); color: var(--tint-ink); font-weight: 600; font-size: 13.5px;
}
.chip button { border: 0; background: rgba(26, 35, 126, .12); color: inherit; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: 12px; line-height: 1; }
:root[data-theme="dark"] .chip button { background: rgba(255, 255, 255, .14); }
.chips .none { color: var(--muted); font-size: 13px; padding: 4px 0; }
.bsel { display: flex; gap: 8px; }
.bsel select { flex: 1; min-width: 0; }

/* file picker */
.fpick { border: 1.5px dashed var(--line-strong); border-radius: var(--r-sm); padding: 12px; background: var(--card-alt); }
.fpick .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flist { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.flist li { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); font-size: 13.5px; }
.flist li span.n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flist li span.s { color: var(--muted); font-size: 12px; }
.flist li button { border: 0; background: transparent; cursor: pointer; color: var(--danger); font-size: 15px; width: 28px; height: 28px; }

/* switch */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--line-strong); border-radius: 999px; transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked + i { background: var(--s-responded); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { box-shadow: var(--focus); }

/* ----------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; line-height: 1.6; white-space: nowrap;
  color: var(--ci); background: var(--cb);
}
.badge.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.badge.outline { background: transparent; border: 1px solid var(--c); color: var(--c); }
[data-s="pending"]     { --c: var(--s-pending);     --cb: var(--s-pending-bg);     --ci: var(--s-pending-ink); }
[data-s="in_progress"] { --c: var(--s-in_progress); --cb: var(--s-in_progress-bg); --ci: var(--s-in_progress-ink); }
[data-s="responded"]   { --c: var(--s-responded);   --cb: var(--s-responded-bg);   --ci: var(--s-responded-ink); }
[data-s="overdue"]     { --c: var(--s-overdue);     --cb: var(--s-overdue-bg);     --ci: var(--s-overdue-ink); }
[data-s="closed"]      { --c: var(--s-closed);      --cb: var(--s-closed-bg);      --ci: var(--s-closed-ink); }
[data-s="transferred"] { --c: var(--s-transferred); --cb: var(--s-transferred-bg); --ci: var(--s-transferred-ink); }
[data-s="not_applicable"] { --c: var(--s-not_applicable); --cb: var(--s-not_applicable-bg); --ci: var(--s-not_applicable-ink); }
[data-p="urgent"] { --c: var(--p-urgent); --cb: var(--p-urgent-bg); --ci: var(--p-urgent-ink); }
[data-p="high"]   { --c: var(--p-high);   --cb: var(--p-high-bg);   --ci: var(--p-high-ink); }
[data-p="normal"] { --c: var(--p-normal); --cb: var(--p-normal-bg); --ci: var(--p-normal-ink); }
.pbadge { /* portal badge: --pc = portal colour; --pl / --pd = the same hue made readable (>= 4.5:1) on the light / dark card */
  display: inline-block; padding: 1px 9px; border-radius: 6px; font-size: 12px; font-weight: 600;
  color: var(--pl, var(--pc)); background: var(--pcb); border: 1px solid var(--pcb); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
:root[data-theme="dark"] .pbadge { color: var(--pd, var(--pc)); }

/* countdown pill */
.cd { display: inline-block; padding: 1px 9px; border-radius: 8px; font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cd.ok { color: var(--d-ok); background: var(--s-responded-bg); }
.cd.warn { color: var(--d-warn); background: var(--s-pending-bg); }
.cd.crit { color: var(--d-crit); background: var(--s-overdue-bg); }
.cd.over { color: #fff; background: var(--s-overdue); }
.cd.none, .cd.done { color: var(--muted); background: transparent; font-weight: 500; padding: 0; }

/* ================================================================== AUTH */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); }
.auth-brand {
  position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(1200px 500px at -10% 110%, rgba(224, 165, 38, .22), transparent 60%),
    linear-gradient(160deg, #0f1656 0%, #1a237e 55%, #283593 100%);
}
.auth-brand::before { /* fine dotted lattice, evokes ledger paper */
  content: ""; position: absolute; inset: 0; opacity: .18; pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, #fff 1px, transparent 1.2px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(120deg, #000 0%, transparent 70%); mask-image: linear-gradient(120deg, #000 0%, transparent 70%);
}
.auth-brand > * { position: relative; }
.auth-emblem { font-size: 54px; line-height: 1; }
.auth-brand h2 { font-size: clamp(26px, 3.2vw, 40px); line-height: 1.3; margin-top: 18px; font-weight: 700; }
.auth-brand p { max-width: 36ch; opacity: .85; font-size: 16px; margin-top: 10px; }
.auth-rule { width: 64px; height: 4px; background: var(--gold); border-radius: 4px; margin-top: 22px; }
.auth-foot { font-size: 13px; opacity: .7; }
.auth-main { display: grid; place-items: center; padding: 28px 20px; }
.auth-card {
  width: min(420px, 100%); background: var(--card); border-radius: 20px; padding: 32px 28px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.auth-card h1 { font-size: 22px; }
.auth-card .sub { color: var(--muted); margin: 2px 0 22px; font-size: 14px; }
.auth-card .btn.primary { margin-top: 6px; }
.auth-theme { position: fixed; top: 10px; right: 10px; z-index: 5; color: var(--ink); }
.auth-brand-mini { display: none; }

/* =============================================================== APP SHELL */
.appview { min-height: 100vh; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top-h); display: flex; align-items: center; gap: 4px;
  padding: 0 10px 0 8px; background: var(--topbar); color: var(--topbar-ink);
  border-bottom: 3px solid var(--gold);
}
.topbar .icon-btn { color: var(--topbar-ink); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; padding: 0 6px; }
.brand-mark { font-size: 26px; line-height: 1; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 18px; letter-spacing: .5px; }
.brand-text small { font-size: 12px; opacity: .8; }
.top-spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 8px; margin-right: 6px; min-width: 0; }
#whoName { font-weight: 600; font-size: 14px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-chip { background: rgba(255, 255, 255, .16); border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }

.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); align-items: start; }
body.navmini .shell { grid-template-columns: var(--side-w-mini) minmax(0, 1fr); }
.side {
  position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h));
  overflow-y: auto; padding: 14px 10px; background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.nav-i {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14.5px; position: relative; cursor: pointer; border: 0; background: transparent; text-align: left; width: 100%;
}
.nav-i .ic { font-size: 19px; width: 26px; text-align: center; flex: none; }
.nav-i:hover { background: var(--card-alt); }
.nav-i.on { background: var(--tint); color: var(--tint-ink); }
.nav-i.on::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }
.nav-sep { height: 1px; background: var(--line); margin: 8px 6px; }
.nav-cap { padding: 6px 12px 2px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
body.navmini .nav-i .lb, body.navmini .nav-cap { display: none; }
body.navmini .nav-i { justify-content: center; padding: 8px 0; }
body.navmini .nav-i .ic { width: auto; }
body.navmini .brand-text { display: none; }

.main { padding: 22px 26px 60px; min-width: 0; max-width: 1480px; outline: none; }
.bottomnav { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; }
.page-head h1 small { display: block; font-size: 13.5px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-h h2 { font-size: 16.5px; }
.card-h h2 small { font-weight: 500; color: var(--muted); font-size: 13px; margin-left: 6px; }
.stack { display: grid; gap: 18px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; }
.cols.pt { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }

/* ------------------------------------------------------------- KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi {
  position: relative; text-align: left; cursor: pointer; border: 1px solid var(--line); background: var(--card);
  border-radius: var(--r); padding: 14px 14px 12px 18px; box-shadow: var(--shadow); overflow: hidden;
  transition: transform .15s, border-color .15s; min-width: 0;
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c, var(--primary)); }
.kpi:hover { transform: translateY(-2px); border-color: var(--c, var(--primary-hi)); }
.kpi .k-l { font-size: 13px; font-weight: 600; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-n { display: block; font-size: 32px; font-weight: 700; line-height: 1.15; margin-top: 4px; color: var(--ci, var(--ink)); font-variant-numeric: tabular-nums; }
.kpi .k-g { display: block; font-size: 12px; color: var(--muted); }
.kpi.total { --c: var(--primary-hi); --ci: var(--ink); }
.kpis.mini { margin-bottom: 16px; }

/* ------------------------------------------------------ deadline tracker */
.tbar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--line); margin-bottom: 14px; gap: 2px; }
.tbar i { display: block; min-width: 6px; transition: flex .4s; }
.tbar i.over { background: var(--s-overdue); } .tbar i.crit { background: #ef5350; }
.tbar i.warn { background: #f5b301; } .tbar i.ok { background: #43a047; }
.buckets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.bucket {
  text-align: left; border: 1.5px solid var(--line); background: var(--card-alt); border-radius: var(--r-sm); padding: 10px 12px; cursor: pointer;
  display: flex; flex-direction: column; gap: 0; transition: border-color .15s, background .15s;
}
.bucket:hover, .bucket.on { border-color: var(--bc); background: var(--card); }
.bucket b { font-size: 24px; line-height: 1.2; color: var(--bc); font-variant-numeric: tabular-nums; }
.bucket span { font-size: 13px; font-weight: 600; }
.bucket.crit { --bc: var(--d-crit); } .bucket.warn { --bc: var(--d-warn); } .bucket.ok { --bc: var(--d-ok); } .bucket.over { --bc: var(--s-overdue); }
.bucket-list { margin-top: 12px; border-top: 1px dashed var(--line-strong); padding-top: 10px; display: grid; gap: 6px; }
.bl-i { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--card-alt); cursor: pointer; border: 0; text-align: left; width: 100%; }
.bl-i:hover { background: var(--tint); }
.bl-i .id { font-weight: 700; font-size: 13px; color: var(--primary-hi); flex: none; }
:root[data-theme="dark"] .bl-i .id { color: #9fa8e8; }
.bl-i .sj { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }

/* ------------------------------------------------------------ data table */
.tbl-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: right; font-weight: 600; font-size: 13px; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td { text-align: right; padding: 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tbl td:first-child { font-weight: 600; min-width: 150px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.zero td { color: var(--muted); }
.tbl .num-bad { color: var(--s-overdue-ink); font-weight: 700; }
.tbl.left td, .tbl.left th { text-align: left; }
.tbl.left td:last-child, .tbl.left th:last-child { text-align: right; }

/* portal-wise bars */
.pw-list { display: grid; gap: 12px; }
.pw-i .t { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.pw-i .t span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pw-i .t i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.pw-i .bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.pw-i .bar b { display: block; height: 100%; border-radius: 999px; }

.chart-box { position: relative; height: 290px; }

/* skeleton */
.skel { border-radius: var(--r); min-height: 110px; background: linear-gradient(100deg, var(--card) 30%, var(--card-alt) 50%, var(--card) 70%); background-size: 220% 100%; animation: shimmer 1.4s linear infinite; border: 1px solid var(--line); }
@keyframes shimmer { to { background-position: -120% 0; } }
.empty { text-align: center; padding: 38px 16px; color: var(--muted); }
.empty .big { font-size: 40px; display: block; margin-bottom: 6px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 2px; }

/* ----------------------------------------------------------- filter bar */
.filters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; align-items: end; padding: 14px 16px; }
.filters .f-search { grid-column: span 3; order: 1; }
.filters .f-sort { grid-column: span 2; order: 2; }
.filters .f-more > .field { order: 5; }
.filters .f-more > .f-reset { order: 3; grid-column: span 1; }
.filters .f-reset .btn { width: 100%; }
.filters .field { margin: 0; }
.filters .f-more { display: contents; }
.filters .f-toggle { display: none; }
.filters .f-toggle .cnt { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 10px; background: var(--primary); color: var(--on-primary); font-size: 12px; padding: 0 5px; }
.filters label { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 3px; display: block; }
.filters input, .filters select { min-height: 42px; }
.search-wrap { position: relative; }
.search-wrap input { padding-left: 14px; }


/* ------------------------------------------------------- docket list */
.dk { margin-top: 16px; }
.dk-head, .dk-row {
  display: grid; align-items: center; gap: 12px;
  grid-template-columns: 100px minmax(0, 2.8fr) 132px 124px minmax(0, 1.7fr) 100px;
}
.dk.has-chk .dk-head, .dk.has-chk .dk-row { grid-template-columns: 26px 100px minmax(0, 2.8fr) 132px 124px minmax(0, 1.7fr) 100px; }
.dk-head { padding: 0 16px 8px 20px; font-size: 13px; font-weight: 600; color: var(--muted); }
.dk-row {
  position: relative; padding: 12px 16px 12px 20px; margin-bottom: 8px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-sm); box-shadow: var(--shadow); cursor: pointer; transition: transform .12s, border-color .15s;
}
.dk-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; border-radius: var(--r-sm) 0 0 var(--r-sm); background: var(--c); }
.dk-row:hover { border-color: var(--primary-hi); transform: translateX(2px); }
.dk-row .c-id { font-weight: 700; font-size: 13.5px; color: var(--primary-hi); font-variant-numeric: tabular-nums; display: flex; flex-direction: column; gap: 2px; }
:root[data-theme="dark"] .dk-row .c-id { color: #9fa8e8; }
.dk-row .c-subj { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dk-row .sj-t { font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dk-row .sj-m { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-row .c-tags { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.dk-row .c-br { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.dk-row .c-cd { text-align: right; }
.newdot { align-self: flex-start; display: inline-block; font-size: 15px; line-height: 1.2; }
.m-lbl { display: none; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.pager .info { color: var(--muted); font-size: 14px; }
.pager .btns { display: flex; gap: 8px; }

.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--r-sm);
  background: var(--s-pending-bg); border: 1px solid var(--s-pending); color: var(--s-pending-ink); font-weight: 600;
}
.banner .btn { margin-left: auto; }

/* =========================================================== MODAL / DRAWER */
.modal-back {
  position: fixed; inset: 0; z-index: 70; background: var(--scrim); display: grid; place-items: center; padding: 16px;
  animation: fade .15s ease-out; overflow-y: auto;
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow-pop); animation: rise .2s ease-out; border: 1px solid var(--line);
}
.modal.wide { width: min(720px, 100%); }
.modal.sm { width: min(430px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 12px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17.5px; }
.mform { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-body { padding: 18px 20px 6px; overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.modal-body p.msg { margin-bottom: 10px; font-size: 15px; }

.drawer-back { position: fixed; inset: 0; z-index: 60; background: var(--scrim); animation: fade .15s ease-out; display: flex; justify-content: flex-end; }
.drawer {
  width: min(640px, 100%); height: 100%; background: var(--bg); display: flex; flex-direction: column; box-shadow: var(--shadow-pop);
  animation: slidein .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
.dw-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 12px 12px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.dw-head .tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.dw-id { font-weight: 700; font-size: 17px; color: var(--primary-hi); }
:root[data-theme="dark"] .dw-id { color: #9fa8e8; }
.dw-scroll { flex: 1; overflow-y: auto; padding: 18px 20px 40px; overscroll-behavior: contain; display: grid; gap: 16px; align-content: start; }
.dw-subject { font-size: 20px; line-height: 1.45; }
.dw-details { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--primary-hi); border-radius: var(--r-sm); padding: 12px 14px; font-size: 14.5px; }
.meta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px; margin: 0; }
.meta div { min-width: 0; }
.meta dt { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.meta dd { margin: 0; font-weight: 600; word-break: break-word; font-size: 14.5px; }
.meta .full { grid-column: 1 / -1; }
.actbar { display: flex; flex-wrap: wrap; gap: 8px; }
.dw-sec { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px; }
.dw-sec > h3 { font-size: 15.5px; margin-bottom: 12px; }
.dw-sec > h3 small { font-weight: 500; color: var(--muted); font-size: 12.5px; margin-left: 6px; }
.dw-sec h4 { font-size: 13.5px; color: var(--muted); margin: 12px 0 8px; }

.brc { border: 1px solid var(--line); border-left: 4px solid var(--c, var(--line-strong)); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--card-alt); }
.brc:last-child { margin-bottom: 0; }
.brc.mine { box-shadow: 0 0 0 2px var(--primary-hi) inset; }
.brc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.brc-name { font-weight: 700; }
.brc p { margin: 6px 0 0; font-size: 14px; }
.brc .when { color: var(--muted); font-size: 12.5px; }
.brc .btn { margin-top: 8px; }

.atts { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.att { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; text-decoration: none; color: var(--ink); background: var(--card-alt); transition: border-color .15s; }
.att:hover { border-color: var(--primary-hi); }
.att .th { height: 84px; display: grid; place-items: center; background: var(--tint); font-size: 30px; overflow: hidden; }
.att .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att .nm { padding: 6px 8px 0; font-size: 12.5px; font-weight: 600; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-all; }
.att .sz { padding: 0 8px 7px; font-size: 11.5px; color: var(--muted); }
.att-wrap { position: relative; }
.att-wrap .att { height: 100%; }
.att-del { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; border: none; border-radius: 7px;
  background: rgba(183,28,28,.92); color: #fff; font-size: 13px; cursor: pointer; display: grid; place-items: center;
  opacity: 0; transition: opacity .15s; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.att-wrap:hover .att-del, .att-del:focus { opacity: 1; }
@media (hover: none) { .att-del { opacity: 1; } }

.tl { list-style: none; margin: 0; padding: 0 0 0 4px; }
.tl li { position: relative; padding: 0 0 14px 22px; }
.tl li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--primary-hi)); box-shadow: 0 0 0 3px var(--card); }
.tl li::after { content: ""; position: absolute; left: 8px; top: 18px; bottom: -4px; width: 2px; background: var(--line); }
.tl li:last-child { padding-bottom: 0; } .tl li:last-child::after { display: none; }
.tl .a { font-weight: 700; font-size: 14px; }
.tl .n { font-size: 14px; word-break: break-word; }
.tl .w { font-size: 12.5px; color: var(--muted); }
.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.mini-list li { padding: 7px 10px; background: var(--card-alt); border-radius: 8px; border: 1px solid var(--line); }

/* ================================================================== ADMIN */
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.acard { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.acard .ico { width: 48px; height: 48px; border-radius: 12px; background: var(--tint); display: grid; place-items: center; font-size: 26px; flex: none; }
.acard .sw { width: 48px; height: 48px; border-radius: 12px; flex: none; border: 1px solid var(--line); }
.acard .tx { flex: 1; min-width: 0; }
.acard .tx b { display: block; overflow: hidden; text-overflow: ellipsis; }
.acard .tx small { color: var(--muted); }
.acard .ops { display: flex; gap: 2px; }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.emoji-pick button { width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--card-alt); font-size: 20px; cursor: pointer; }
.emoji-pick button:hover { border-color: var(--primary-hi); background: var(--tint); }
.urow { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1.2fr) 70px auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.urow:last-child { border-bottom: 0; }
.urow.head { font-size: 13px; font-weight: 600; color: var(--muted); padding-top: 4px; padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.urow .nm b { display: block; overflow: hidden; text-overflow: ellipsis; }
.urow .nm small { color: var(--muted); }
.urow.off { opacity: .6; }
.urow .ops { display: flex; gap: 2px; justify-content: flex-end; }
.you { font-size: 11.5px; background: var(--gold); color: #2b1d00; border-radius: 999px; padding: 0 8px; font-weight: 700; margin-left: 6px; }

/* ================================================================== TOASTS */
#toasts { position: fixed; z-index: 120; top: 14px; right: 14px; display: grid; gap: 8px; width: min(380px, calc(100vw - 28px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 12px; color: #fff; font-weight: 600; font-size: 14.5px;
  box-shadow: var(--shadow-pop); animation: toastin .22s ease-out; cursor: pointer; line-height: 1.5;
}
.toast.success { background: #2e7d32; } .toast.info { background: #1565c0; } .toast.error { background: #c62828; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: all .22s; }
@keyframes toastin { from { opacity: 0; transform: translateY(-10px); } }

/* ====================================================================== v2 ADDITIONS */
.mb { margin-bottom: 16px; }
#myKpiBox, #remBox:not(:empty) { margin-bottom: 16px; }
#remBox .banner { margin-bottom: 0; }
#myTrackBox { margin-bottom: 16px; }
.link { background: none; border: 0; padding: 0; color: var(--primary-hi); font-weight: 700; cursor: pointer; text-decoration: underline; font-size: inherit; }
:root[data-theme="dark"] .link { color: #9fa8e8; }
.good { color: var(--s-responded-ink); }
.chk { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; line-height: 1.4; }
.chk input { width: 18px; height: 18px; flex: none; accent-color: var(--primary); }
.checks { display: grid; gap: 8px; margin-bottom: 14px; }
.lblrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 5px; }
.lblrow label { margin: 0 !important; }
.tpl-sel { width: auto !important; min-height: 36px !important; padding: 4px 10px !important; font-size: 13.5px; max-width: 60%; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
code { background: var(--card-alt); border: 1px solid var(--line); padding: 0 5px; border-radius: 5px; font-size: .92em; }

/* ---- 🔔 bell ---- */
.bell { position: relative; }
.bell.has { animation: ring 1.6s ease-in-out 2; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-14deg); } 20%, 40% { transform: rotate(14deg); } 50% { transform: rotate(0); } }
.bell-badge {
  position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #d32f2f; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--topbar);
}
.bell-panel {
  position: fixed; z-index: 55; top: calc(var(--top-h) + 6px); right: 10px; width: min(400px, calc(100vw - 20px)); max-height: min(560px, calc(100dvh - var(--top-h) - 20px));
  display: flex; flex-direction: column; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-pop); overflow: hidden;
  animation: rise .18s ease-out;
}
.bp-head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--line); }
.bp-head b { flex: 1; font-size: 16px; }
.bp-list { overflow-y: auto; flex: 1; min-height: 80px; }
.nt-i { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; position: relative; }
.nt-i:hover { background: var(--card-alt); }
.nt-i.unread { background: var(--tint); }
.nt-i.unread .nt-msg { font-weight: 700; }
.nt-ico { font-size: 20px; flex: none; width: 28px; text-align: center; }
.nt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nt-msg { font-size: 14px; line-height: 1.45; word-break: break-word; }
.nt-meta { font-size: 12.5px; color: var(--muted); }
.nt-dot { width: 9px; height: 9px; border-radius: 50%; background: #d32f2f; flex: none; margin-top: 7px; }
.bp-foot { padding: 8px 12px; border-top: 1px solid var(--line); text-align: center; }
.bp-foot:empty { display: none; }

/* ---- more-nav sheet ---- */
.more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-bottom: 8px; }
.more-i { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-alt); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; text-align: center; }
.more-i span { font-size: 26px; }
.more-i.on, .more-i:hover { border-color: var(--primary-hi); background: var(--tint); }

/* ---- chips / tabs ---- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip-f, .tab {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 5px 13px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--ink); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
}
.chip-f b, .tab b { font-size: 12px; min-width: 20px; height: 20px; line-height: 20px; border-radius: 10px; padding: 0 6px; background: var(--card-alt); color: var(--muted); text-align: center; }
.chip-f:hover, .tab:hover { border-color: var(--primary-hi); }
.chip-f.on, .tab.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip-f.on b, .tab.on b { background: rgba(0, 0, 0, .28); color: #fff; }

/* ---- KPI variants ---- */
.kpis.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi.on { border-color: var(--c, var(--primary-hi)); box-shadow: 0 0 0 2px var(--c, var(--primary-hi)) inset; }
.kpi.static { cursor: default; }
.kpi.static:hover { transform: none; border-color: var(--line); }
.kpis.four .kpi .k-n, .kpis.five .kpi .k-n { font-size: 28px; }

/* ---- 🎯 attention panel ---- */
.att-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.att-box { border: 1px solid var(--line); border-top: 4px solid var(--c, var(--primary-hi)); border-radius: var(--r-sm); background: var(--card-alt); padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.att-box.na { --c: var(--s-not_applicable); --cn: var(--s-not_applicable-ink); } .att-box.ext { --c: var(--s-pending); --cn: var(--s-pending-ink); }
.att-box.ready { --c: var(--s-responded); --cn: var(--s-responded-ink); } .att-box.overdue { --c: var(--s-overdue); --cn: var(--s-overdue-ink); }
.ab-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ab-t { font-weight: 700; font-size: 14.5px; line-height: 1.3; }
.ab-n { font-size: 26px; line-height: 1; color: var(--cn, var(--c)); font-variant-numeric: tabular-nums; }
.ab-sub { font-size: 12.5px; color: var(--muted); margin-top: -4px; }
.ab-list { display: grid; gap: 6px; flex: 1; align-content: start; }
.ab-none { font-size: 13.5px; padding: 6px 0; }
.ab-f { display: flex; gap: 8px; flex-wrap: wrap; }
.ab-f:empty { display: none; }
.at-item { border: 1px solid var(--line); background: var(--card); border-radius: 8px; min-width: 0; }
.at-main { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 9px; cursor: pointer; border-radius: 8px; min-width: 0; }
.at-main:hover { background: var(--tint); }
.at-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.at-top .id { font-size: 13px; color: var(--primary-hi); }
:root[data-theme="dark"] .at-top .id { color: #9fa8e8; }
.at-sj { font-size: 13.5px; font-weight: 600; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.at-meta { font-size: 12.5px; color: var(--muted); line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.at-btns { display: flex; gap: 6px; padding: 0 8px 8px; }
.at-btns .btn { flex: 1; }

/* ---- list: indicators, mini badges, select, bulk bar ---- */
.dk-row.fresh { border-color: color-mix(in srgb, var(--s-overdue) 45%, var(--line)); }
.c-chk { display: grid; place-items: center; cursor: pointer; }
.c-chk input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.inds { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.ind { white-space: nowrap; font-weight: 600; }
.ind.dir { color: var(--s-pending-ink); } .ind.ext { color: var(--s-pending-ink); } .ind.warn { color: var(--s-not_applicable-ink); }
.rmini {
  display: inline-flex; align-items: center; gap: 3px; padding: 0 7px 0 5px; border-radius: 999px; font-size: 12.5px; font-weight: 700; line-height: 22px; white-space: nowrap;
  color: var(--ci); background: var(--cb); border: 1px solid transparent;
}
.rmini .ri { font-size: 13px; }
.rmini[data-s="not_applicable"], .rmini[data-s="transferred"] { border-color: var(--c); }
.bulk-bar { position: sticky; top: calc(var(--top-h) + 8px); z-index: 20; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--tint); border: 1px solid var(--primary-hi); box-shadow: var(--shadow); }
.bulk-bar b { color: var(--tint-ink); margin-right: 6px; }
.banner.rem { flex-direction: column; align-items: stretch; gap: 8px; background: var(--s-pending-bg); }
.rem-list { display: grid; gap: 4px; }
.rem-i { text-align: left; border: 0; background: rgba(255, 255, 255, .5); padding: 6px 10px; border-radius: 8px; cursor: pointer; color: inherit; font-weight: 500; }
:root[data-theme="dark"] .rem-i { background: rgba(255, 255, 255, .06); }
.rem-i:hover { background: rgba(255, 255, 255, .8); }
:root[data-theme="dark"] .rem-i:hover { background: rgba(255, 255, 255, .12); }

/* ---- drawer: callouts, directions, files, branch cards, chat ---- */
.drawer { width: min(700px, 100%); }
.dir-box { background: var(--s-pending-bg); border: 1px solid var(--s-pending); border-left-width: 5px; border-radius: var(--r-sm); padding: 10px 14px; color: var(--ink); }
.dir-box > b { color: var(--s-pending-ink); }
.dir-i { margin-top: 6px; font-size: 14.5px; line-height: 1.55; }
.dir-i small { display: block; color: var(--muted); }
.callout { border: 1px solid var(--line-strong); border-left: 4px solid var(--primary-hi); background: var(--card); border-radius: var(--r-sm); padding: 9px 13px; font-size: 14px; line-height: 1.55; }
.callout.warn { border-left-color: var(--s-pending); background: var(--s-pending-bg); }
.callout.na { border-left-color: var(--s-not_applicable); background: var(--s-not_applicable-bg); }
.callout.ok { border-left-color: var(--s-responded); background: var(--s-responded-bg); }
.callout.rem { border-left-color: var(--s-pending); background: var(--s-pending-bg); }
.rem-line { margin-top: 4px; }
.disp-box { border: 1px solid var(--s-closed); background: var(--s-closed-bg); border-radius: var(--r-sm); padding: 10px 14px; line-height: 1.6; }
.rel-i { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card-alt); border-radius: 8px; padding: 7px 10px; cursor: pointer; font-size: 14px; }
.rel-i:hover { background: var(--tint); }
.rel-i span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-sec > h3 { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.files { display: grid; gap: 8px; }
.file { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-alt); padding: 8px; }
.f-th { width: 76px; height: 76px; border: 0; border-radius: 8px; background: var(--tint); display: grid; place-items: center; font-size: 32px; cursor: pointer; overflow: hidden; padding: 0; }
.f-th img { width: 100%; height: 100%; object-fit: cover; }
.f-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.f-nm { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-sz { font-size: 12.5px; color: var(--muted); }
.f-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.brc { border-left-color: var(--c, var(--line-strong)); }
.brc.na { background: var(--s-not_applicable-bg); }
.brc-badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.brc-ins { background: rgba(120, 130, 190, .12); border-radius: 8px; padding: 6px 9px; }
.brc-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.brc-btns .btn { margin-top: 0; }
.extc { border: 1px solid var(--line); border-left: 4px solid var(--c, var(--line-strong)); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--card-alt); }
.extc:last-child { margin-bottom: 0; }
.extc p { margin: 6px 0 0; font-size: 14px; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; padding: 4px 2px 8px; }
.bub { max-width: 86%; padding: 7px 11px; border-radius: 14px; background: var(--card-alt); border: 1px solid var(--line); align-self: flex-start; }
.bub.me { align-self: flex-end; background: var(--tint); border-color: var(--primary-hi); }
.b-h { font-size: 12.5px; color: var(--muted); } .b-h b { color: var(--ink); }
.b-t { font-size: 14.5px; line-height: 1.5; word-break: break-word; }
.b-w { font-size: 11.5px; color: var(--muted); text-align: right; }
.compose { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.compose textarea { min-height: 48px; flex: 1; }
.tl li .a { display: flex; gap: 6px; align-items: baseline; }
.tl .w small { color: var(--muted); }

/* ---- modals: preview, option cards, branch chips, suggestions, duplicates ---- */
.modal.preview { width: min(960px, 100%); }
.pv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.pv-nm { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.pv-btns { display: flex; align-items: center; gap: 8px; }
.pv-body { padding: 10px; overflow: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pv-img { text-align: center; } .pv-img img { max-height: 72vh; max-width: 100%; object-fit: contain; border-radius: 8px; }
.pv-frame { width: 100%; height: 72vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; flex: 1; min-height: 360px; }
.opt-cards { display: grid; gap: 10px; margin-bottom: 14px; }
.opt-card { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); padding: 11px 12px; cursor: pointer; background: var(--card); }
.opt-card input { margin-top: 4px; accent-color: var(--primary); width: 18px; height: 18px; flex: none; }
.opt-card span { display: flex; flex-direction: column; } .opt-card small { color: var(--muted); font-size: 13px; }
.opt-card.on { border-color: var(--primary-hi); background: var(--tint); }
.bchips { display: grid; gap: 8px; margin-top: 10px; }
.bchip { border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 10px; background: var(--card-alt); }
.bc-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.bc-n { font-weight: 700; font-size: 14px; }
.bc-h button { border: 0; background: rgba(120, 130, 190, .2); color: inherit; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; flex: none; }
.bc-ins { min-height: 38px !important; font-size: 14px; }
.bchips .none { color: var(--muted); font-size: 13px; padding: 4px 0; }
.sug { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--tint); border: 1px dashed var(--primary-hi); }
.sug-t { font-size: 13px; font-weight: 700; color: var(--tint-ink); }
.sug-i { border: 1px solid var(--primary-hi); background: var(--card); color: var(--ink); border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 600; cursor: pointer; }
.sug-i:hover { background: var(--primary); color: var(--on-primary); } .sug-i small { opacity: .8; font-weight: 500; }
.dup-box { border: 1px solid var(--s-pending); border-left-width: 5px; background: var(--s-pending-bg); border-radius: 10px; padding: 9px 12px; margin-bottom: 14px; font-size: 14px; }
.dup-i { margin-top: 6px; } .dup-i .muted { font-size: 12.5px; }
.hint code { font-size: 12.5px; }

/* ---- admin: templates, settings, activity, reports ---- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tpl { display: flex; flex-direction: column; gap: 8px; }
.tpl-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; } .tpl-h b { overflow-wrap: anywhere; }
.tpl-b { margin: 0; font-size: 14px; color: var(--muted); flex: 1; line-height: 1.55; }
.tpl-f { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tog { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.tog:last-child { border-bottom: 0; }
.tg-t { display: flex; flex-direction: column; } .tg-t small { color: var(--muted); font-size: 13px; }
.settings .card { padding-bottom: 12px; }
.act-list { padding: 4px 6px; }
.act-i { display: flex; gap: 12px; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.act-i:last-child { border-bottom: 0; }
.act-ic { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--cb); color: var(--ci); font-size: 16px; }
.act-b { min-width: 0; flex: 1; } .act-t { font-size: 14.5px; } .act-n { font-size: 14px; color: var(--ink); margin-top: 2px; word-break: break-word; } .act-w { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.rep-filters { padding: 14px 16px; }
.rf-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; }
.rf-grid .field { margin: 0; } .rf-grid label { font-size: 12.5px; color: var(--muted); }
.th-btn { background: none; border: 0; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; padding: 0; white-space: nowrap; }
.th-btn.on, .th-btn:hover { color: var(--primary-hi); }
.tbl.sortable th, .tbl.sortable td { text-align: right; } .tbl.sortable th:first-child, .tbl.sortable td:first-child { text-align: left; }
.medal { font-size: 18px; }
.pri-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pri-t { border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 10px; padding: 8px 12px; background: var(--cb); color: var(--ci); display: flex; flex-direction: column; }
.pri-t b { font-size: 26px; line-height: 1.2; } .pri-t span { font-size: 13px; font-weight: 600; }
.tbl-wrap .tbl.left td:last-child { text-align: left; }
.tbl.left th:last-child { text-align: left; }
.pw-i .t small { font-weight: 500; }

/* ============================================================== RESPONSIVE */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cols, .cols.pt { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters .f-search { grid-column: 1 / -1; }
  .filters .f-sort { grid-column: span 2; }
}

@media (max-width: 1180px) {
  /* docket rows become cards */
  .dk-head { display: none; }
  .dk { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
  .dk-row {
    margin: 0; grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; column-gap: 10px; padding: 12px 14px 12px 18px; align-items: start;
    grid-template-areas: "id st" "subj subj" "tags tags" "br br" "cd cd";
  }
  .dk.has-chk .dk-row { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "chk id st" "subj subj subj" "tags tags tags" "br br br" "cd cd cd"; }
  .dk-row .c-chk { grid-area: chk; }
  .dk-row .c-id { grid-area: id; flex-direction: row; align-items: center; gap: 8px; }
  .dk-row .c-id .newdot { align-self: center; }
  .dk-row .c-st { grid-area: st; justify-self: end; }
  .dk-row .c-subj { grid-area: subj; font-size: 15.5px; }
  .dk-row .c-tags { grid-area: tags; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .dk-row .c-br { grid-area: br; }
  .dk-row .c-cd { grid-area: cd; text-align: left; border-top: 1px dashed var(--line); padding-top: 8px; display: flex; align-items: center; gap: 8px; }
  .m-lbl { display: inline; color: var(--muted); font-size: 12.5px; }
  .dk-row:hover { transform: none; }
}

@media (max-width: 860px) {
  :root { --top-h: 54px; }
  .shell, body.navmini .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .nav-toggle { display: none; }
  .main { padding: 16px 16px 96px; }
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: var(--card); border-top: 1px solid var(--line);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px -10px rgba(10, 14, 70, .3);
  }
  .bottomnav .nav-i {
    flex: 1; flex-direction: column; justify-content: center; gap: 0; min-height: 54px; padding: 4px 2px; font-size: 11.5px; border-radius: 10px; text-align: center; line-height: 1.25;
  }
  .bottomnav .nav-i .ic { font-size: 21px; width: auto; }
  .bottomnav .nav-i.on::before { left: 22%; right: 22%; top: 0; bottom: auto; width: auto; height: 3px; border-radius: 0 0 4px 4px; }
  #whoName { display: none; }
  .brand-text small { display: none; }
  .page-head h1 { font-size: 21px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .k-n { font-size: 28px; }
  .buckets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; padding: 12px; }
  .filters .f-search { grid-column: 1 / -1; }
  .filters .f-sort { grid-column: span 2; }
  .filters .f-toggle { display: inline-flex; min-height: 42px; }
  .filters .f-more { display: none; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .filters.open .f-more { display: grid; }
  .filters .f-more > .f-reset { grid-column: 1 / -1; order: 9; }
  .filters .f-more > .field { order: 0; }
  .tbl th, .tbl td { padding: 8px 6px; }
  .tbl th { white-space: normal; line-height: 1.3; vertical-align: bottom; }
  .tbl td:first-child { min-width: 112px; }
  .hide-m { display: none; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { display: none; }
  .auth-brand-mini { display: block; text-align: center; margin-bottom: 18px; }
  .auth-brand-mini .e { font-size: 44px; line-height: 1; }
  .auth-brand-mini b { display: block; font-size: 18px; margin-top: 6px; }
  .auth-main { align-content: center; }
  .urow { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .urow.head { display: none; }
  .urow .c-role, .urow .c-br2 { grid-column: 1; }
  .urow .c-act { grid-column: 2; grid-row: 1; }
  .urow .ops { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 700px) {
  .dk { grid-template-columns: minmax(0, 1fr); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 15px 14px; }
  /* modals become bottom sheets */
  .modal-back { align-items: end; padding: 0; }
  .modal, .modal.wide, .modal.sm { width: 100%; border-radius: 20px 20px 0 0; max-height: 94vh; max-height: 94dvh; animation: sheet .24s cubic-bezier(.2, .8, .2, 1); }
  .modal.sm { border-radius: 20px; margin: 0 12px 12px; width: calc(100% - 24px); }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1 1 auto; }
  .drawer { width: 100%; }
  .dw-scroll { padding: 14px 14px 40px; }
  #toasts { top: 8px; right: 8px; left: 8px; width: auto; }
  .seg label { flex-basis: 100%; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }

@media (max-width: 420px) {
  .page-actions:has(> .btn + .btn) { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; padding: 8px 10px; font-size: 13.5px; }
  .page-actions .btn[data-act="refresh"] { flex: 0 0 auto; }
  .kpi { padding: 12px 10px 10px 14px; }
}

/* ---- v2 responsive ---- */
@media (max-width: 1280px) {
  .att-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .bell-panel { top: calc(var(--top-h) + 4px); right: 6px; left: 6px; width: auto; max-height: calc(100dvh - var(--top-h) - 70px); }
  .att-grid { grid-template-columns: minmax(0, 1fr); }
  .kpis.five, .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chip-row { flex-wrap: nowrap; overflow-x: auto; margin-left: -16px; margin-right: -16px; padding: 0 16px 6px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .chip-row::-webkit-scrollbar { display: none; }
  .tpl-grid { grid-template-columns: minmax(0, 1fr); }
  .grid3 { grid-template-columns: minmax(0, 1fr); }
  .filters .f-toggle { order: 2; }
  .drawer { width: 100%; }
}
@media (max-width: 700px) {
  .meta { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; padding: 12px; }
  .meta .full { grid-column: 1 / -1; }
  .kpis.five { display: flex; overflow-x: auto; gap: 8px; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .kpis.five::-webkit-scrollbar { display: none; }
  .kpis.five .kpi { flex: 0 0 116px; padding: 10px 10px 8px 14px; }
  .kpis.five .kpi .k-n { font-size: 24px; }
  .buckets { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .bucket { padding: 8px 8px; }
  .bucket b { font-size: 20px; }
  .bucket span { font-size: 11.5px; line-height: 1.25; }
  .file { grid-template-columns: 60px minmax(0, 1fr); }
  .f-th { width: 60px; height: 60px; font-size: 26px; }
  .compose { flex-direction: column; align-items: stretch; }
  .bub { max-width: 95%; }
  .tpl-sel { max-width: 100%; width: 100% !important; }
  .rf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pv-frame { height: 60vh; }
  .modal.preview { width: 100%; }
  .pri-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ab-n { font-size: 22px; }
}
@media (max-width: 420px) {
  .bulk-bar .btn { flex: 1 1 100%; }
  .rf-grid { grid-template-columns: minmax(0, 1fr); }
}

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

@media print {
  .topbar, .side, .bottomnav, #toasts, .page-actions, .filters, .pager { display: none !important; }
  body { background: #fff; }
}

/* ====================================================================== v2.1 */
/* ---- overflow: long unbroken text / file names never widen a grid, modal or drawer ---- */
.stack, .dw-scroll, .checks, .files, .mini-list, .pw-list, .bchips, .opt-cards, .ab-list, .rem-list, .bucket-list, .flist, .tpl-grid, .agrid {
  grid-template-columns: minmax(0, 1fr);
}
.agrid { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.tpl-grid { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.stack > *, .dw-scroll > *, .files > *, .mini-list > *, .bucket-list > *, .flist > *, .ab-list > * { min-width: 0; }
.dw-scroll, .modal-body, .bell-panel, .toast, .tpl-b, .callout, .dir-box, .disp-box, .banner, .act-n, .at-sj, .at-meta, .nt-msg, .rem-i, .brc, .extc, .sug-i {
  overflow-wrap: anywhere;
}
.dw-subject, .dw-details, .tl .n, .tl .a, .b-t, .b-h, .dir-i, .brc p, .brc-name, .extc p, .rem-line, .bc-n, .dup-i, .dk-row .sj-t, .meta dd, .mini-list li, .tpl-h b, .pv-nm, .f-nm {
  overflow-wrap: anywhere; word-break: normal;
}
.tl .n, .b-t, .meta dd { word-break: normal; }
.flist li { min-width: 0; }
.flist li span.n { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flist li span.s { flex: none; white-space: nowrap; }
.file, .f-info { min-width: 0; }
.bl-i { min-width: 0; }
.bl-i .cd { flex: none; }
.bl-i .sj { min-width: 0; }
.bucket-list { overflow: hidden; }
.bsel > * { min-width: 0; }
.bc-h { min-width: 0; } .bc-n { min-width: 0; }
.rel-i b { flex: none; }

/* ---- character counters + upload messages ---- */
.cnt { font-size: 12px; line-height: 1.4; color: var(--muted); text-align: right; margin-top: 3px; font-variant-numeric: tabular-nums; }
.cnt.warn { color: var(--s-pending-ink); font-weight: 700; }
.fp-msg { color: var(--danger); font-size: 13px; font-weight: 600; white-space: pre-line; margin-top: 8px; }
.fp-msg:empty { display: none; }
.img-fb { font-size: 1em; text-align: center; padding: 6px; line-height: 1.4; }
.pv-img .img-fb { display: block; color: var(--muted); font-size: 15px; padding: 40px 12px; }

/* ---- closed (બંધ) items in the admin screens ---- */
.acard.off { opacity: .82; }
.acard.off .tx b { color: var(--muted); }
.acard .ops .btn { white-space: nowrap; }

/* ---- form controls: placeholder + option colours follow the theme (dark-mode contrast) ---- */
::placeholder { color: var(--muted); opacity: 1; }
option { background: var(--card); color: var(--ink); }
input:disabled, select:disabled, textarea:disabled { opacity: .7; cursor: not-allowed; }
.icon-btn[disabled], .icon-btn.is-busy { opacity: .5; pointer-events: none; }
.btn[aria-busy="true"] { cursor: progress; }
.drawer:focus, .modal:focus, .modal-back:focus { outline: none; }
.drawer-back, .modal-back { overscroll-behavior: contain; }

/* ---- dark mode: remaining contrast fixes (>= 4.5:1 for text) ---- */
:root[data-theme="dark"] .btn.primary:hover { background: #4d5cb5; border-color: #4d5cb5; }
:root[data-theme="dark"] .sug-i:hover { background: #4d5cb5; color: #fff; }
.cd.over { background: #c62828; }
.bucket.over { --bc: var(--s-overdue-ink); }
:root[data-theme="dark"] .kpi .k-l, :root[data-theme="dark"] .ab-sub { color: var(--muted); }

/* ---- touch: every tap target is at least 40 px high on phones / touch screens ---- */
@media (max-width: 860px), (pointer: coarse) {
  .btn, .btn.sm { min-height: 40px; }
  .chip-f, .tab { min-height: 40px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  .flist li button, .bc-h button, .chip button, .att-del { min-width: 40px; min-height: 40px; width: 40px; height: 40px; }
  .emoji-pick button { width: 40px; height: 40px; }
  .c-chk { min-width: 40px; min-height: 40px; }
  .chk, .tog { min-height: 40px; }
  .th-btn { min-height: 40px; padding: 0 4px; }
  .rem-i, .rel-i, .sug-i, .bl-i, .at-main { min-height: 40px; }
  .sug-i { padding: 8px 12px; }
  .link { display: inline-block; min-height: 40px; padding: 10px 4px; margin: -10px -4px; line-height: 20px; vertical-align: middle; }
  .meta dd a, .dw-details a, .msg a { display: inline-block; padding: 10px 4px; margin: -10px -4px; }
  .brand { min-height: 40px; }
  .btn, .th-btn { min-width: 40px; }
  .nt-i { min-height: 48px; }
  .pbadge { min-height: 0; }
  .switch { height: 26px; margin: 7px 0; }
  .switch input { inset: -7px 0; height: calc(100% + 14px); }
  .tpl-sel { min-height: 40px !important; }
  .f-btns .btn, .brc-btns .btn, .at-btns .btn { min-height: 40px; }
  .opt-card, .bucket, .more-i { min-height: 44px; }
  input[type="checkbox"], input[type="radio"] { min-width: 20px; min-height: 20px; }
}

/* ====================================================================== v2.1 round 3 */
/* ---- long unbroken text in the activity log and in the bar lists (reports: wards / portals, dashboard) ---- */
.act-i, .act-b, .act-t, .act-n, .act-w { min-width: 0; overflow-wrap: anywhere; }
.act-list { min-width: 0; }
.act-t .link { max-width: 100%; }
.pw-i, .pw-i .t { min-width: 0; }
.pw-i .t span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.pw-i .t b { flex: none; }
.pw-list > * { min-width: 0; }

/* ---- 🔔 reminders sent (PRO / authority drawer) ---- */
.rem-hist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.rem-hist li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 8px 10px; background: var(--card-alt); border: 1px solid var(--line); border-left: 4px solid var(--s-pending); border-radius: 8px; }
.rem-hist .rn { font-weight: 700; color: var(--s-pending-ink); font-variant-numeric: tabular-nums; }
.rem-hist .rb { min-width: 0; overflow-wrap: anywhere; }
.rem-hist .rt { font-size: 13.5px; color: var(--muted); }
.rem-hist .rt b { color: var(--ink); }
.rem-hist .rm { font-size: 14.5px; margin: 2px 0; }
.rem-hist .rw { font-size: 12.5px; color: var(--muted); }

/* ---- dark mode: buttons that are links (a.btn) must not take the link colour; solid red / hover red need white-on-dark-red ---- */
:root[data-theme="dark"] .btn { color: var(--ink); }
:root[data-theme="dark"] .btn.primary { color: var(--on-primary); }
:root[data-theme="dark"] .btn.danger { color: var(--danger); }
:root[data-theme="dark"] .btn.danger:hover, :root[data-theme="dark"] .btn.danger.solid { background: #c62828; border-color: #c62828; color: #fff; }
:root[data-theme="dark"] .btn.good { color: #0d1021; }
:root[data-theme="dark"] .btn.gold { color: #2b1d00; }
a.btn, a.btn:hover { text-decoration: none; }

/* ---- phone: the row-select checkbox itself is a 40 x 40 px target (the 20 px box is drawn inside it) ---- */
@media (max-width: 860px), (pointer: coarse) {
  .c-chk input[type="checkbox"] { -webkit-appearance: none; appearance: none; position: relative; width: 40px; height: 40px; margin: 0; padding: 0; border: 0; background: transparent; border-radius: 8px; cursor: pointer; }
  .c-chk input[type="checkbox"]::before { content: ""; position: absolute; inset: 10px; border: 2px solid var(--line-strong); border-radius: 5px; background: var(--card); }
  .c-chk input[type="checkbox"]:checked::before { background: var(--primary); border-color: var(--primary); }
  .c-chk input[type="checkbox"]:checked::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 700; line-height: 1; }
  .c-chk input[type="checkbox"]:focus-visible { box-shadow: var(--focus); }
}
