:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e9f0;
  --border-strong: #d5dbe5;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-50: #eef2ff;
  --green: #059669;   --green-50: #ecfdf5;
  --red: #dc2626;     --red-50: #fef2f2;
  --amber: #d97706;   --amber-50: #fffbeb;
  --cyan: #0891b2;    --cyan-50: #ecfeff;
  --blue: #2563eb;    --blue-50: #eff6ff;
  --side: #0f172a;
  --side-2: #1e293b;
  --side-text: #cbd5e1;
  --side-muted: #64748b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 45px -12px rgba(15, 23, 42, .25);
  --side-w: 268px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
.load-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 400;
  pointer-events: none; background: rgba(79, 70, 229, .18); opacity: 0; transition: opacity .15s;
}
.load-bar.is-on { opacity: 1; }
.load-bar.is-on::after {
  content: ""; display: block; height: 100%; width: 38%; background: var(--primary);
  box-shadow: 0 0 8px rgba(79, 70, 229, .45);
  animation: load-slide .9s ease-in-out infinite;
}
@keyframes load-slide { from { transform: translateX(-120%); } to { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) {
  .load-bar.is-on::after { animation: none; width: 100%; }
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
code { font: 12px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; color: var(--text-2); word-break: break-all; }
small { font-size: 12px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ico.flip { transform: rotate(180deg); }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 40;
  display: flex; flex-direction: column; background: var(--side); color: var(--side-text);
  border-right: 1px solid rgba(255, 255, 255, .04);
}
.sidebar-head { display: flex; align-items: center; gap: 12px; padding: 18px 14px 14px; }
.brand { display: flex; align-items: center; color: #fff; flex: none; }
.brand:hover { color: #fff; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 6px 16px -6px rgba(99, 102, 241, .7);
}
.brand-text { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; flex: 1; }
.brand-name { color: #fff; min-width: 0; max-width: 100%; }
.brand-name:hover { color: #fff; }
.brand-name strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn.sidebar-close { display: none; color: var(--side-text); }

.nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; scrollbar-width: thin; scrollbar-color: #334155 transparent; }
.nav-link {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 11px; margin: 1px 0;
  border-radius: 9px; color: var(--side-text); font-weight: 500; cursor: pointer; list-style: none; user-select: none;
  transition: background .15s, color .15s;
}
.nav-link::-webkit-details-marker { display: none; }
.nav-link .ico { color: #94a3b8; }
.nav-link:hover { background: var(--side-2); color: #fff; }
.nav-link.is-active { background: rgba(99, 102, 241, .18); color: #fff; }
.nav-link.is-active .ico { color: #a5b4fc; }
.nav-link .caret { margin-left: auto; width: 16px; height: 16px; transition: transform .28s ease; }
.nav-group[open] > .nav-link .caret { transform: rotate(180deg); }
.nav .nav-group > .nav-children {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows .28s ease, visibility 0s linear .28s;
}
.nav .nav-group[open] > .nav-children {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows .28s ease, visibility 0s;
}
.nav-fold { overflow: hidden; min-height: 0; }
.nav-fold-in { margin: 2px 0 6px 20px; padding-left: 12px; border-left: 1px solid #1f2a3d; }
@media (prefers-reduced-motion: reduce) {
  .nav .nav-group > .nav-children, .nav-link .caret { transition: none; }
}
.nav-label { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.nav-ai { width: 14px; height: 14px; color: #c4b5fd; }
.nav-sub:hover .nav-ai, .nav-sub.is-active .nav-ai { color: #e0e7ff; }
.ai-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.nav-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 7px; color: #94a3b8; font-size: 13px; }
.nav-sub:hover { color: #fff; background: var(--side-2); }
.nav-sub.is-active { color: #fff; background: rgba(99, 102, 241, .18); }
.nav-sub em { font-style: normal; font-size: 10px; letter-spacing: .02em; color: #64748b; border: 1px solid #263247; border-radius: 99px; padding: 0 7px; }
.nav .is-soon { opacity: .55; cursor: not-allowed; }
.nav .is-soon:hover { background: transparent; color: inherit; }

.sidebar-foot { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; border-top: 1px solid #1e293b; }
.foot-row { display: flex; align-items: center; gap: 10px; }
.lang-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; border-radius: 9px; background: #0b1220; }
.lang-switch a { height: 26px; border-radius: 7px; color: #94a3b8; font-size: 12px; font-weight: 700; line-height: 26px; text-align: center; text-decoration: none; }
.lang-switch a.is-on { background: #fff; color: #0f172a; }
.auth-lang { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.auth-lang .lang-switch { background: #e8edf4; }
.auth-lang .lang-switch a { color: #64748b; }
.auth-lang .lang-switch a.is-on { background: #0f172a; color: #fff; }
.sidebar-foot .icon-btn { color: var(--side-text); }
.sidebar-foot .icon-btn:hover { background: var(--side-2); color: #fff; }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
a.me:hover { color: inherit; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: #334155; color: #fff; font-weight: 600; }
img.avatar { display: block; object-fit: cover; }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-text strong { color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content > .powered { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 28px 0 0; padding: 14px 18px; background: #fff; border: 1px solid var(--border); border-radius: 14px; color: var(--muted); font-size: 13px; }
.content > .powered img { height: 36px; width: auto; }
.auth-card .powered { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.auth-card .powered img { height: 34px; width: auto; }

.scrim { display: none; }
.main { margin-left: var(--side-w); min-width: 0; }
#docs-box { scroll-margin-top: 88px; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 14px 28px; min-height: 68px; background: rgba(245, 247, 251, .85);
  backdrop-filter: saturate(180%) blur(10px); -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { font-size: 20px; font-weight: 700; }
.topbar-title p { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn.menu-btn { display: none; }
.content { padding: 24px 28px 48px; max-width: 1480px; }
.stack { display: grid; gap: 20px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; padding: 14px 16px; }
.toolbar .field { flex: 0 1 190px; }
.toolbar .check { height: 38px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.pair.is-busy { opacity: .6; transition: opacity .2s; }
.kpi-sub .line { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.kpi-sub .line:last-child { border-bottom: 0; }
.kpi-sub .line b { font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px;
  border: 1px solid transparent; border-radius: var(--radius-sm); font: 600 13px/1 var(--font);
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn .ico { width: 16px; height: 16px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(79, 70, 229, .3); }
.btn-primary:hover { background: var(--primary-600); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #047857; color: #fff; }
.btn-danger { background: var(--surface); color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: var(--red-50); color: var(--red); }
.modal .btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn.is-soon { opacity: .5; cursor: not-allowed; }
.is-spinning .ico { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: #eef1f6; color: var(--text); }
.icon-btn-sm { width: 30px; height: 30px; border-radius: 8px; color: var(--muted); }
.icon-btn-sm .ico { width: 16px; height: 16px; }
a.icon-btn-sm:hover, button.icon-btn-sm:hover { color: var(--primary); background: var(--primary-50); }
button.icon-btn:disabled, button.icon-btn:disabled:hover { opacity: .35; cursor: not-allowed; background: transparent; color: var(--muted); }
.icon-btn.is-soon { opacity: .35; cursor: not-allowed; }
.icon-btn.is-soon:hover { background: transparent; }

.field { display: grid; gap: 6px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.field input, .field select, .picker { width: 100%; box-sizing: border-box; }
.field textarea {
  width: 100%; min-height: 96px; padding: 10px 12px; resize: vertical;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: 14px var(--font); outline: none;
}
.field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
#purchase-edit-form textarea { min-height: 0; height: 38px; padding-top: 8px; padding-bottom: 8px; resize: none; }
.field.is-error input, .field.is-error select, .field.is-error textarea { border-color: #f87171; }
.field-error { display: none; }
.field.is-error .field-error { display: block; color: var(--red); font-size: 12px; font-weight: 600; }
.field input, .field select, .search input, .size select {
  height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: 14px var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .search input:focus, .size select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.field input[readonly] { background: var(--bg); color: var(--muted); }
.field input:disabled { background: #e2e8f0; color: #64748b; cursor: not-allowed; opacity: 1; }
tr.is-this td { background: #eef2ff; }
.field-inline { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.field-inline input, .field-inline select { height: 32px; font-size: 13px; padding: 0 10px; }

/* ---------- Cards / KPIs ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; transition: opacity .2s; }
.kpis.is-busy { opacity: .6; }
.kpi {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; row-gap: 2px;
  align-items: center; align-content: center; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); color: var(--text); min-height: 92px;
}
.kpi .kpi-icon { grid-row: span 2; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; line-height: 1.3; }
.kpi-value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 13px; font-weight: 500; color: var(--muted); }
.kpi-sub { grid-column: 2; font-size: 11.5px; color: var(--muted); line-height: 1.45; margin-top: 4px; }
a.kpi-link { transition: border-color .15s, box-shadow .15s, transform .15s; }
a.kpi-link:hover { color: var(--text); border-color: #c7d2fe; box-shadow: 0 6px 18px -8px rgba(79, 70, 229, .35); transform: translateY(-1px); }
.kpi.is-soon { cursor: default; }
.kpi-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; position: relative; }
.kpi-icon .ico { width: 20px; height: 20px; }
.kpi-icon .ico-plus {
  position: absolute; right: 1px; bottom: 1px; width: 15px; height: 15px;
  border-radius: 999px; background: #fff; box-shadow: 0 0 0 1.5px currentColor; stroke-width: 2.8;
}
.tone-green { background: var(--green-50); color: var(--green); }
.tone-red { background: var(--red-50); color: var(--red); }
.tone-amber { background: var(--amber-50); color: var(--amber); }
.tone-cyan { background: var(--cyan-50); color: var(--cyan); }
.tone-blue { background: var(--blue-50); color: var(--blue); }

.alert { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid; }
.alert div { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.alert-danger { background: var(--red-50); border-color: #fecaca; color: #991b1b; }
.alert-warning { background: var(--amber-50); border-color: #fde68a; color: #92400e; }
.alert .ico { width: 20px; height: 20px; }

/* ---------- Panels ---------- */
.panel { overflow: hidden; }
.panel:has(.datepick),
.panel:has(.suggest:not([hidden])) { overflow: visible; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.panel-tools { display: flex; align-items: center; gap: 8px; }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.panel-body { padding: 16px 18px 18px; }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); color: var(--text-2); font-size: 13.5px; }
.filter-bar a { font-weight: 600; }
.panel-title { display: flex; align-items: flex-start; gap: 12px; min-width: 0; flex: 1 1 320px; }
.panel-title h2 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.panel-title p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.panel-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--primary-50); color: var(--primary); }
.panel-icon .ico { width: 17px; height: 17px; }
.panel-warning .panel-icon { background: var(--amber-50); color: var(--amber); }
.panel-danger { border-color: #fecaca; }
.panel-danger .panel-icon { background: var(--red-50); color: var(--red); }
.count:not(:empty) { font-size: 11.5px; font-weight: 600; color: var(--text-2); background: #eef1f6; border-radius: 99px; padding: 1px 8px; }
.panel-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- Grid (server-side paginated table) ---------- */
.grid-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; }
.search { position: relative; flex: 1 1 260px; max-width: 360px; }
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 34px; padding-left: 34px; font-size: 13px; }
.size { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.size select { height: 34px; padding: 0 8px; font-size: 13px; }
.grid.is-empty .grid-bar, .grid.is-empty .grid-foot { display: none; }

.table-wrap { position: relative; overflow-x: auto; border-top: 1px solid var(--border); transition: opacity .15s; }
.table-wrap.is-busy { opacity: .55; pointer-events: none; }
.grid.is-empty .table-wrap { border-top: 0; }
.grid.is-empty thead { display: none; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  position: sticky; top: 0; text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
body[data-page=spots] .table { width: max-content; max-width: 100%; }
body[data-page=spots] .table thead th {
  writing-mode: vertical-rl; text-orientation: mixed; vertical-align: bottom; text-align: left;
  letter-spacing: 0; padding: 12px 8px; width: 1%;
}
body[data-page=spots] .table thead th.col-actions { writing-mode: horizontal-tb; width: 1%; padding: 8px; }
body[data-page=spots] .table td.col-tight { text-align: center; }
body[data-page=member-edit] .form-body > h3 { margin: 4px 0 0; font-size: 15px; }
body[data-page=member-edit] .doc-stack { display: grid; gap: 2px; }
body[data-page=member-edit] .doc-stack a { font-weight: 650; }
body[data-page=member-edit] .review-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#docs-toggle.btn-danger,
#docs-toggle.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
body[data-page=member-edit] .form-body .table-wrap { margin: 0 -18px -18px; }
.table th:first-child, .table td:first-child { padding-left: 18px; }
.table th:last-child, .table td:last-child { padding-right: 18px; }
.table td { padding: 11px 14px; border-bottom: 1px solid #eef1f5; vertical-align: middle; background: #fff; }
.table tbody tr:nth-child(even):not(.empty-row):not(.sk-row) td { background: #f3f5f8; }
.table tbody tr.is-credit:not(.empty-row):not(.sk-row) td,
.table tbody tr.is-credit:not(.empty-row):not(.sk-row):hover td { background: #ffcccc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:not(.empty-row):not(.sk-row):hover td { background: #e7edf5; }
.table .num { text-align: right; white-space: nowrap; }
.table .col-index { width: 56px; color: var(--muted); font-variant-numeric: tabular-nums; }
.table .col-actions { width: 1%; white-space: nowrap; }
.row-icons { display: inline-flex; align-items: center; gap: 4px; }
body[data-page=overall] .table,
body[data-page=tax] .table { font-size: 11.5px; }
body[data-page=overall] .table td,
body[data-page=tax] .table td { padding: 6px 8px; }
body[data-page=overall] .when,
body[data-page=tax] .when { display: inline-block; min-width: 2.6em; margin-right: 6px; color: var(--muted); font-variant-numeric: tabular-nums; }
body[data-page=overall] .table th.col-actions,
body[data-page=overall] .table td.col-actions,
body[data-page=tax] .table th.col-actions,
body[data-page=tax] .table td.col-actions { padding-left: 4px; padding-right: 4px; text-align: center; }
body[data-page=overall] .badge,
body[data-page=tax] .badge { font-size: 10.5px; }
.table .col-date, .table .col-tight { width: 1%; white-space: nowrap; }
.table .col-supplier { font-size: 12px; font-weight: 600; line-height: 1.35; }
.table .col-mark { width: 1%; white-space: nowrap; }
.table .col-mark code { word-break: normal; white-space: nowrap; }
.sortable button { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.sortable .ico { width: 13px; height: 13px; opacity: .5; }
.sortable.is-sorted { color: var(--primary); }
.sortable.is-sorted .ico { opacity: 1; }
.table.num th.num { text-align: right; }
th.num { text-align: right !important; }

.actions { display: inline-flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.icon-btn.is-ok { color: var(--green); }
.icon-btn.is-ok:hover { background: var(--green-50); color: #047857; }
body[data-page=transactions] button.icon-btn-sm[data-check]:not(.is-ok) { color: #94a3b8; }
body[data-page=transactions] button.icon-btn-sm[data-check]:not(.is-ok) .ico { stroke-width: 1.55; }
body[data-page=transactions] button.icon-btn-sm[data-check]:not(.is-ok):hover { color: #64748b; background: #f8fafc; }
body[data-page=transactions] button.icon-btn-sm[data-check].is-ok { color: #059669; }
body[data-page=transactions] button.icon-btn-sm[data-check].is-ok:hover { color: #047857; background: var(--green-50); }
body[data-page=transactions] [data-check] .ico-on { display: none; }
body[data-page=transactions] [data-check].is-ok .ico-off { display: none; }
body[data-page=transactions] [data-check].is-ok .ico-on { display: block; width: 18px; height: 18px; }
.icon-btn.is-warn { color: #d97706; }
.icon-btn.is-warn:hover { background: #fff7ed; color: #b45309; }
.icon-btn.is-bad { color: var(--red); }
.icon-btn.is-bad:hover { background: var(--red-50); color: var(--red); }
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 7px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge-danger { background: var(--red-50); color: #b91c1c; }
.badge-success { background: var(--green-50); color: #047857; }
.badge-warning { background: var(--amber-50); color: #b45309; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-muted { background: #f1f5f9; color: #475569; }
.pos-meta { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.pos-match { display: grid; gap: 2px; color: var(--text-2); font-size: 12px; }
.pos-match code { font-size: 12px; }
#pos-summary { margin: 0; padding: 12px 16px; border-radius: 12px; background: #eff6ff; color: #1e3a8a; font-size: 13.5px; }
#pos-summary.is-warn { background: #fff7ed; color: #9a3412; }
#pos-summary strong { font-weight: 650; }
#pos-detail .split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
#pos-detail .kv { display: grid; gap: 10px; margin: 0; }
#pos-detail .kv div { display: grid; gap: 2px; }
#pos-detail .kv dt { color: var(--muted); font-size: 12px; font-weight: 600; }
#pos-detail .kv dd { margin: 0; }
#pos-detail pre { max-height: 180px; overflow: auto; white-space: pre-wrap; margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--bg); font-size: 12px; }
@media (max-width: 760px) {
  #pos-detail .split { grid-template-columns: 1fr; }
}
.chip { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; vertical-align: 1px; }
.chip-ok { background: var(--green-50); color: #047857; }
.chip-bad { background: var(--red-50); color: #b91c1c; }
.chip-warn { background: var(--amber-50); color: #b45309; }
.chip-muted { background: #eef1f6; color: var(--text-2); }
.switch {
  position: relative; display: inline-flex; width: 26.4px; height: 15.6px; padding: 0; border: 0;
  border-radius: 99px; background: var(--red); cursor: pointer; vertical-align: middle; transition: background .15s;
}
.switch span {
  position: absolute; top: 1.8px; left: 1.8px; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .28); transition: transform .15s;
}
.switch.is-on { background: var(--green); }
.switch.is-on span { transform: translateX(10.8px); }
.switch:disabled { cursor: default; }
.switch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.table th.col-switch, .table td.col-switch { width: 1%; text-align: center; white-space: nowrap; }
.table td.col-switch > .cell { display: flex; justify-content: center; }
.doc-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; margin-right: 7px; vertical-align: 1px; }
.doc-dot.is-ok { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .15); }
.doc-link { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.doc-link .ico { width: 15px; height: 15px; }
.is-soon:not(.icon-btn):not(.btn):not(.kpi):not(.nav-link):not(.nav-sub) { color: inherit; cursor: default; }
.copy { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; padding: 3px 8px; border: 1px dashed transparent; border-radius: 7px; background: none; color: var(--text-2); font: 12.5px var(--font); cursor: copy; }
.copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy .ico { width: 14px; height: 14px; color: var(--muted); flex: none; }
.copy:hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }

.empty { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px 12px; color: var(--muted); text-align: center; flex-wrap: wrap; }
.empty .ico { width: 20px; height: 20px; }
.empty.is-error { color: #b91c1c; }
.empty-row td { padding: 0 !important; }

.grid-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.grid-info { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pager { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pg { min-width: 32px; height: 32px; padding: 0 8px; display: inline-grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text-2); font: 600 12.5px var(--font); cursor: pointer; }
.pg .ico { width: 15px; height: 15px; }
.pg:hover:not(:disabled) { border-color: #c7d2fe; color: var(--primary); }
.pg.is-current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pg:disabled { opacity: .4; cursor: default; }
.pg-gap { padding: 0 4px; color: var(--muted); }

/* ---------- Skeleton ---------- */
.sk { display: block; border-radius: 6px; background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 50%, #eef1f6 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.sk-line { height: 11px; width: 70%; }
.sk-icon { width: 42px; height: 42px; border-radius: 12px; grid-row: span 2; }
.sk-value { height: 20px; width: 55%; }
.kpi.is-loading .sk-line { width: 80%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Toast / Modal ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 10px; max-width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--text); color: #fff; box-shadow: var(--shadow-lg); font-weight: 500; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast.is-in { opacity: 1; transform: none; }
.hover-tip { position: fixed; z-index: 200; padding: 4px 8px; border-radius: 6px; background: var(--text); color: #fff; font-size: 12px; font-weight: 600; line-height: 1.3; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow); }
.toast-ok .ico { color: #4ade80; }
.toast-error { background: #7f1d1d; }
.toast-error .ico { color: #fca5a5; }
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); animation: fade .15s; }
#page-ai.modal { backdrop-filter: none; -webkit-backdrop-filter: none; }
#editor { backdrop-filter: none; -webkit-backdrop-filter: none; }
.modal-box { width: min(420px, 100%); padding: 22px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); }
.modal-sheet { width: min(860px, 100%); max-height: min(90vh, 920px); padding: 0; overflow: auto; overscroll-behavior: contain; }
html:has(#attendance-people:not([hidden])),
html:has(#attendance-people:not([hidden])) body { overflow: hidden; overscroll-behavior: none; }
.modal-sheet .modal-actions { padding: 0 18px 18px; margin-top: 0; }
.modal-box p { font-size: 15px; font-weight: 500; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- Welcome / Auth ---------- */
.welcome { display: grid; justify-items: center; gap: 10px; padding: 56px 24px; text-align: center; }
.welcome h2 { font-size: 22px; }
.auth { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, #e0e7ff 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #ede9fe 0, transparent 55%), var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(400px, 100%); padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); }
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; margin-bottom: 22px; }
.auth-logo { width: min(260px, 100%); height: 120px; object-fit: contain; object-position: center; }
.auth-brand .brand-mark { width: 72px; height: 72px; border-radius: 18px; font-size: 28px; }
.auth-brand div { display: flex; flex-direction: column; align-items: center; }
.auth-brand small { color: var(--muted); }
.auth-card h1 { font-size: 22px; }
.auth-card > .muted { margin: 4px 0 20px; }
.fast-rooms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 22px; }
.fast-room { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.fast-room img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.fast-room strong { font-size: 12px; letter-spacing: .02em; }
.fast-room:hover strong { color: var(--primary-600, #2563eb); }
.fast-room:disabled { opacity: .6; cursor: default; }
.form { display: grid; gap: 14px; }
.form .btn { height: 42px; margin-top: 4px; }
.form-error { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--red-50); color: #b91c1c; font-weight: 500; }
.form-error.is-ok { background: #ecfdf3; color: #166534; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(15, 23, 42, .45); }
  .nav-open { overflow: hidden; }
  .icon-btn.sidebar-close, .icon-btn.menu-btn { display: inline-grid; }
  .main { margin-left: 0; }
}

@media (max-width: 760px) {
  .topbar { padding: 10px 14px; min-height: 60px; gap: 8px; }
  .topbar-title h1 { font-size: 17px; }
  .hide-sm { display: none; }
  .topbar-actions .btn { width: 38px; padding: 0; }
  .topbar-actions a.btn-ghost { width: auto; padding: 0 12px; }
  .content { padding: 14px 12px 32px; }
  .stack { gap: 14px; }
  .pair { grid-template-columns: 1fr; }
  .toolbar .field { flex: 1 1 140px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { grid-template-columns: 1fr; grid-template-rows: none; align-content: start; padding: 13px; min-height: 0; row-gap: 6px; }
  .kpi .kpi-icon { grid-row: auto; width: 34px; height: 34px; border-radius: 10px; }
  .kpi .kpi-icon .ico { width: 17px; height: 17px; }
  .kpi-value { font-size: 18px; }
  .kpi-sub { grid-column: 1; }
  .panel-head { padding: 14px; }
  .panel-tools, .filters { width: 100%; }
  .filters .field-inline { flex: 1 1 140px; }
  .filters .field-inline input, .filters .field-inline select { flex: 1; min-width: 0; }
  .grid-bar { padding: 12px 14px; }
  .search { max-width: none; }

  .table-wrap { overflow: visible; border-top: 0; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody { padding: 0 12px 4px; }
  .table tr { margin-bottom: 10px; padding: 6px 0; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
  .table tbody tr:nth-child(even):not(.empty-row):not(.sk-row) { background: #f3f5f8; }
  .table tbody tr.is-credit:not(.empty-row):not(.sk-row),
  .table tbody tr.is-credit:nth-child(even):not(.empty-row):not(.sk-row) { background: #ffcccc; }
  .table tbody tr.is-credit td { background: transparent; }
  .table tbody tr:not(.empty-row):not(.sk-row):hover td { background: transparent; }
  .table td, .table th:first-child, .table td:first-child, .table td:last-child {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 14px; border: 0; text-align: right;
  }
  .table td::before { content: attr(data-label); flex: none; max-width: 45%; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); text-align: left; }
  .table td[data-label=""]::before { display: none; }
  .table td > .cell { min-width: 0; text-align: right; overflow-wrap: anywhere; }
  .table td.col-actions > .cell, .table td.col-switch > .cell { flex: none; min-width: max-content; overflow-wrap: normal; justify-content: flex-end; }
  .table .num, .table .col-actions, .table .col-switch, .table .col-index, .table .col-supplier, .table .col-mark, .table .col-date, .table .col-tight { width: 100%; max-width: none; white-space: normal; }
  .table .col-mark, .table .col-mark code { white-space: normal; }
  .table tr.empty-row, .table tr.sk-row { border: 0; background: transparent; }
  .table .empty-row td::before, .table .sk-row td::before { display: none; }
  .copy { max-width: 100%; }
  .grid-foot { padding: 12px 14px; justify-content: center; }
  .grid-info { width: 100%; text-align: center; }
}

@media (max-width: 380px) {
  .kpis { grid-template-columns: 1fr; }
}

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

/* ---------- Member transactions ---------- */
.topbar-tools { display: flex; align-items: center; gap: 4px; }
.txn-page { width: 100%; }
.shortcut-row { display: flex; gap: 10px; }
.shortcut-row > .shortcut { flex: 1 1 0; }
.shortcut {
  display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  font: inherit; color: inherit; text-align: left;
}
button.shortcut { cursor: pointer; }
button.shortcut:hover { border-color: #c7d2fe; box-shadow: 0 6px 18px -8px rgba(79, 70, 229, .35); }
.modal-wide { width: min(960px, 100%); max-height: min(86vh, 820px); padding: 0; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.shortcut strong, .shortcut small, #balance b, #rail-balance { display: block; }
#balance b, #rail-balance { font-size: 16px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.shortcut strong { font-size: 13px; }
.shortcut small { color: var(--muted); font-size: 12px; }
.shortcut.is-soon { opacity: .62; cursor: not-allowed; }
.is-expired { color: var(--red); font-weight: 600; }
.side-search { position: relative; padding: 0 12px 10px; }
.side-search .search { max-width: none; }
.side-search .search input { background: #0b1220; color: #e2e8f0; border-color: #1e293b; }
.side-search .search input::placeholder { color: #64748b; }
.suggest {
  position: absolute; z-index: 50; left: 12px; right: 12px; top: calc(100% - 6px);
  max-height: 320px; overflow: auto; background: #0f172a; border: 1px solid #1e293b;
  border-radius: 10px; box-shadow: var(--shadow-lg);
}
.suggest a { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; color: #e2e8f0; font-size: 13px; }
.suggest a:hover, .suggest a.is-on { background: #1e293b; color: #fff; }
.suggest em { color: #fbbf24; font-style: normal; white-space: nowrap; }
.suggest-empty { display: block; padding: 10px 12px; color: #94a3b8; font-size: 13px; }
.form-grid { display: grid; gap: 16px; align-items: start; }
.form-body { display: grid; gap: 14px; padding: 18px; }
.form-body h3 { margin: 6px 0 0; font-size: 14px; font-weight: 650; }
.form-body > .muted, .field > .muted { font-size: 12.5px; font-weight: 500; }
.pos-label { height: 34px; min-width: 150px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); font: 13px var(--font); color: var(--text); }
body[data-page=spot-edit] .table-wrap { border-top: 0; }
body[data-page=spot-edit] .html-field .cke_chrome { border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; box-shadow: none; }
.logo-row { display: flex; align-items: center; gap: 10px; }
.logo-row img { width: 84px; height: 40px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: #fff; flex: none; }
.logo-row > input { flex: 1; min-width: 0; }
.logo-pick { position: relative; flex: none; overflow: hidden; cursor: pointer; }
.logo-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.invoice-line { display: flex; align-items: center; gap: 8px; }
.invoice-line input { flex: 1; min-width: 0; }
.profile-photo { display: flex; align-items: center; gap: 14px; }
.profile-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: #e2e8f0; flex: none; }
.profile-avatar.is-letter { display: grid; place-items: center; color: #334155; font-size: 32px; font-weight: 650; }
.profile-lang.lang-switch { display: inline-grid; width: 148px; background: #e8edf4; }
.profile-lang.lang-switch a { color: #64748b; }
.profile-lang.lang-switch a:hover { color: #0f172a; }
.profile-lang.lang-switch a.is-on,
.profile-lang.lang-switch a.is-on:hover { background: #0f172a; color: #fff; }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: #e2e8f0; display: inline-grid; place-items: center; vertical-align: middle; }
.user-avatar.lg { width: 40px; height: 40px; flex: none; }
.user-avatar.is-empty { color: var(--muted); }
.user-avatar.is-empty .ico { width: 16px; height: 16px; }
.announce { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.ann-list { display: grid; gap: 6px; }
.ann-item { display: grid; gap: 2px; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; cursor: pointer; font: inherit; color: inherit; }
.ann-item strong { font-size: 13.5px; }
.ann-item span { color: var(--muted); font-size: 12px; }
.ann-item.is-on { border-color: #c7d2fe; background: #eef2ff; }
.ann-actions { display: flex; justify-content: flex-end; align-items: end; gap: 8px; flex-wrap: wrap; padding: 0 18px 18px; }
.login-spot, .job-filter { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.login-spot select, .job-filter select { min-width: 220px; height: 34px; font-weight: 500; }
.app-select { position: relative; min-width: 220px; }
.app-select-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; height: 34px; padding: 0 10px 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: 500 13px var(--font); cursor: pointer;
}
.app-select-btn .ico { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.app-select.is-open .app-select-btn,
.app-select-btn:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); outline: none; }
.app-select.is-open .app-select-btn .ico { transform: rotate(180deg); color: var(--primary); }
.app-select-menu {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0;
  display: grid; gap: 2px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.app-select-opt {
  display: block; width: 100%; padding: 8px 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); font: 500 13px var(--font); text-align: left; cursor: pointer;
}
.app-select-opt:hover { background: var(--primary-50); }
.app-select-opt.is-on { background: var(--primary-50); color: var(--primary); font-weight: 650; box-shadow: inset 3px 0 0 var(--primary); }
body[data-page=jobs] .panel:has(.app-select.is-open) { overflow: visible; }
body[data-page=jobs] .job-detail { white-space: pre-wrap; color: var(--muted); font-size: 12.5px; line-height: 1.45; max-width: 42rem; }
#ai-usage .toolbar { position: relative; z-index: 2; }
#ai-usage .aiuse-spot { flex: 1 1 320px; max-width: 420px; }
#ai-usage .aiuse-note { font-size: 13px; max-width: 820px; }
#ai-usage th.num, #ai-usage td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ann-test-email { min-width: 220px; margin: 0; }
#announce .search { max-width: none; }
@media (max-width: 900px) { .announce { grid-template-columns: 1fr; } }
.picker { position: relative; display: block; }
.picker > .suggest { left: 0; right: 0; top: calc(100% + 4px); }
.picker > .suggest.is-up { top: auto; bottom: calc(100% + 4px); }
#field-subscription .picker input { padding-right: 42px; }
#field-subscription .sub-drop-btn {
  position: absolute; right: 4px; top: 4px; width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}
#field-subscription .sub-drop-btn:hover { background: #eef2ff; color: var(--primary); }
#subscription-pick button.is-current { box-shadow: inset 3px 0 0 var(--primary); font-weight: 700; }
.suggest-lite { background: var(--surface); border-color: var(--border); }
.suggest-lite button {
  display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 12px;
  border: 0; background: transparent; color: var(--text); font: 13px var(--font); text-align: left; cursor: pointer;
}
.suggest-lite button:hover, .suggest-lite button.is-on { background: #eef2ff; }
.suggest-lite em { color: #b45309; font-style: normal; white-space: nowrap; }
.suggest-lite .suggest-empty { color: var(--muted); }
a.shortcut:hover { color: inherit; border-color: #c7d2fe; box-shadow: 0 6px 18px -8px rgba(79, 70, 229, .35); }


.rail { display: flex; gap: 10px; }
.rail > .shortcut { flex: 1 1 0; min-width: 0; }
.shortcut.is-current { border-color: #c7d2fe; box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.form-row { display: grid; grid-template-columns: minmax(140px, .6fr) minmax(220px, .8fr); gap: 14px; }
.form-row.cols-3 { grid-template-columns: minmax(160px, 1.1fr) minmax(120px, .8fr) 110px; }
.form-row.address-row { grid-template-columns: minmax(160px, 1fr) 6.5rem minmax(240px, 2.4fr); }
.form-row.money-row { grid-template-columns: 118px 88px 118px; justify-content: start; gap: 10px; }
#purchase-edit-form .money-row.has-category { grid-template-columns: 108px 78px 108px minmax(140px, 1fr); }
#purchase-edit-form #pur-supplier:disabled { background: #f1f5f9; color: var(--muted); opacity: 1; cursor: default; -webkit-text-fill-color: var(--muted); }
.edit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.edit-grid .field-wide, .edit-grid .check { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.parent-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.parent-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.muted { color: var(--muted); }
@media (max-width: 760px) {
  .edit-grid { grid-template-columns: 1fr; }
}
#panel-charges .col-sub { width: 70%; }
.datepick { position: relative; display: block; }
.datepick input { width: 100%; padding-right: 42px; }
.datepick-btn {
  position: absolute; right: 4px; top: 4px; width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.datepick-btn:hover { background: #eef2ff; color: var(--primary); }
.cal {
  position: absolute; z-index: 80; top: calc(100% + 6px); left: 0; width: 300px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head strong { font-size: 14px; }
.cal-head button, .cal-today {
  border: 0; background: #eef2ff; color: var(--primary); border-radius: 8px; cursor: pointer;
}
.cal-head button { width: 32px; height: 32px; display: grid; place-items: center; }
.cal-week, .cal-days { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-week span { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0 6px; }
.cal-days button {
  height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--text);
  font: 13px var(--font); cursor: pointer;
}
.cal-days button:hover { background: #eef2ff; }
.cal-days button.is-out { color: #cbd5e1; }
.cal-days button.is-today { box-shadow: inset 0 0 0 1.5px #c7d2fe; }
.cal-days button.is-on, .cal-days button.is-on:hover { background: var(--primary); color: #fff; }
.cal-today { width: 100%; height: 34px; margin-top: 8px; font-weight: 650; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
#receipt .icon-btn { color: #065f46; }
#receipt .icon-btn.is-bad { color: var(--red); }
#receipt .icon-btn.is-ok { color: #047857; }
.invoice-switch { display: flex; align-items: center; gap: 10px; }
.invoice-switch em { font-style: normal; font-weight: 650; color: var(--text); }
.invoice-switch input { width: 120px; }
.apy-toggle {
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 99px; background: transparent;
  color: #111; cursor: pointer; display: grid; place-items: center;
}
.apy-toggle .ico { width: 30px; height: 30px; }
.apy-toggle.is-off { color: #d9534f; }

.ovw-help { max-width: 760px; }
.ovw-section { font-size: 18px; }
.ovw-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.ovw-years { display: flex; flex-wrap: wrap; gap: 8px; }
#compare .toolbar .cmp-actions { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#compare .toolbar .btn { margin-left: 0; }
.cmp-ai-box { width: min(720px, 100%); max-height: min(88vh, 760px); padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.cmp-ai { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px 18px; min-height: 0; }
.cmp-ai-hint { font-size: 13px; }
.cmp-ai-log { display: flex; flex-direction: column; gap: 10px; min-height: 160px; max-height: min(46vh, 420px); overflow: auto; }
.cmp-ai-msg { margin: 0; max-width: 92%; padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; font-size: 14px; line-height: 1.45; }
.cmp-ai-msg.is-user { align-self: flex-end; background: #eef2ff; }
.cmp-ai-msg.is-ai { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); }
.cmp-ai-msg.is-wait { color: var(--muted); }
.cmp-ai-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.cmp-ai-form textarea { min-height: 72px; resize: vertical; }
@media (max-width: 640px) {
  .cmp-ai-form { grid-template-columns: 1fr; }
  #compare .toolbar .cmp-actions { margin-left: 0; width: 100%; }
  #compare .toolbar .cmp-actions .btn { flex: 1; }
}
.ovw-years button {
  height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text-2); font: 650 13px var(--font); cursor: pointer;
}
.ovw-years button.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.ovw-card { padding: 16px 16px 12px; }
.ovw-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.ovw-head h2 { font-size: 16px; }
.ovw-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; flex: none; }
.seg button { border: 0; background: #fff; color: var(--text-2); padding: 6px 10px; font: 650 12px var(--font); cursor: pointer; }
.seg button.is-on { background: var(--primary); color: #fff; }
.ovw-plot svg { width: 100%; height: auto; display: block; }
.ovw-plot line, .ovw-plot polyline, .ovw-plot text, .chart-pie text { pointer-events: none; }
.ovw-plot [data-tip], .chart-pie [data-tip] { cursor: pointer; }
.ovw-plot line { stroke: var(--border); stroke-width: 1; }
.ovw-plot .ovw-zero { stroke: #cbd5e1; }
.ovw-plot text { fill: var(--muted); font: 11px var(--font); }
.ovw-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; color: var(--text-2); font-size: 12.5px; }
.ovw-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ovw-legend i { width: 10px; height: 10px; border-radius: 99px; }
.ovw-legend .is-avg i { width: 18px; height: 0; border-radius: 0; background: none; border-top: 2px dashed var(--text-2); }
.ovw-month td.ovw-go { width: 36px; padding: 4px 0 4px 10px; }
.ovw-month thead th:first-child { width: 36px; }
.ovw-modal { display: grid; gap: 8px; padding: 0 18px 18px; }
.ovw-modal .ovw-plot, .cmp-chart .ovw-plot { min-height: 180px; overflow-x: auto; }
.cmp-card { overflow: hidden; }
.cmp-scroll { overflow: hidden; }
.cmp-empty { padding: 18px; }
.cmp-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 10.5px; }
.cmp-table th, .cmp-table td { padding: 4px 2px; border-bottom: 1px solid var(--border); text-align: right; vertical-align: top; font-weight: 500; overflow-wrap: anywhere; }
.cmp-table thead th { color: var(--muted); font-size: 10px; font-weight: 700; }
.cmp-table th:first-child, .cmp-table td:first-child { width: 46px; text-align: left; }
.cmp-table th:last-child, .cmp-table td:last-child { width: 78px; }
.cmp-table th button { border: 0; background: transparent; color: var(--primary); font: 700 10px var(--font); cursor: pointer; padding: 0; }
.cmp-table th.is-on, .cmp-table td.is-on { background: #eef2ff; }
.cmp-table .is-up { color: var(--green); }
.cmp-table .is-down { color: var(--red); }
.cmp-table small { display: block; font-size: 9px; line-height: 1.25; }
.cmp-table .is-zero { color: var(--muted); }
.cmp-months { display: none; }
#compare .cmp-chart .ovw-plot { overflow: hidden; }
#compare .cmp-chart .ovw-plot svg { width: 100%; max-width: 100%; height: auto; }
#compare polyline.cmp-avg { stroke: #475569; stroke-width: 1.75; stroke-dasharray: 5 4; fill: none; }
.chart-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
#charts .ovw-plot { overflow: hidden; }
#charts .ovw-plot svg { width: 100%; max-width: 100%; height: auto; }
#charts [data-plot] polyline.chart-avg { stroke: #334155; stroke-width: 1.25; stroke-dasharray: 4 3; fill: none; }
#charts [data-plot] text.chart-tick { font-size: 9px; }
.chart-pie { display: flex; justify-content: center; }
.chart-pie svg { width: min(280px, 100%); height: auto; }
#payments .pay-note { color: var(--red); }
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; }
.cal-bar h2 { font-size: 18px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-card { overflow: hidden; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.cal-dow, .cal-day { min-width: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal-dow:nth-child(7n), .cal-day:nth-child(7n) { border-right: 0; }
.cal-dow { padding: 8px 4px; color: var(--muted); font-size: 11px; font-weight: 700; text-align: center; }
.cal-day { min-height: 96px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal-day.is-out { background: #f8fafc; }
.cal-day.is-out .cal-num { color: var(--muted); }
.cal-day.is-today { background: #eef2ff; }
#pay-cal[data-envelope="1"] .cal-day { cursor: pointer; }
.cal-num { font-size: 12px; font-weight: 700; }
.cal-chip { display: block; padding: 2px 6px; border-radius: 6px; color: #fff; font-size: 11px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.cal-chip.is-cash { background: #00a65a; }
.cal-chip.is-envelope { background: #71b6b9; }
.cal-chip.is-deposit { background: #3c8dbc; }
.cal-chip.is-card { background: #f39c12; }
#att-cal.is-busy { opacity: .65; }
.att-boards { display: block; width: 100%; }
#att-cal .cal-grid { width: 100%; }
.att-board h3 { margin: 0; padding: 12px 14px 8px; font-size: 14px; }
.att-board .cal-grid { border-top: 1px solid var(--border); }
.att-board .cal-day { min-height: 78px; }
.att-num { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.att-xls { color: #059669; width: 22px; height: 22px; }
.att-xls:hover { color: #047857; background: #ecfdf5; }
.att-chips { display: flex; flex-wrap: wrap; gap: 3px; align-content: flex-start; }
.att-chip {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 28px; max-width: 100%; padding: 2px 4px; border: 0; border-radius: 6px;
  background: #3c8dbc; color: #fff; font: 700 11px/1.1 var(--font); cursor: pointer;
}
.att-chip small { font-size: 8px; font-weight: 550; opacity: .85; }
.att-chip.is-sub { flex-direction: row; gap: 4px; background: #059669; font-weight: 650; }
.att-chip.is-sub b { font-weight: 750; }
.att-chip.is-sub span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9.5rem; }
.att-members { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 0 16px; }
.att-member {
  display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer;
}
.att-member:hover { border-color: #c7d2fe; }
.att-member input { margin-top: 3px; }
.att-member strong { display: block; }
.att-member small { display: block; color: var(--muted); font-weight: 500; }
.att-member small.is-expired { color: var(--red); font-weight: 700; }
.tone-ok { color: #0073b7; }
.tone-warn { color: #d97706; }
.tone-bad { color: #dc2626; }
#attendance-people [data-people] { padding: 8px 20px 18px; }
.att-people { display: grid; gap: 0; padding: 0; }
.att-people > .muted { margin-top: 12px; }
.att-person { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.att-person:last-child { border-bottom: 0; }
.att-person small { display: block; color: var(--muted); }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 16px; }
#attendance .toolbar, #attendance .grid-foot { padding-left: 16px; padding-right: 16px; }
@media (max-width: 1200px) {
  .att-members { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .att-members { grid-template-columns: 1fr; }
}
#envelope { backdrop-filter: none; -webkit-backdrop-filter: none; }
#envelope .modal-box { display: grid; gap: 8px; }
#envelope form { display: grid; gap: 12px; }
.chart-grid .ovw-legend b { font-weight: 700; color: var(--text); }
.chart-grid .ovw-legend small { color: var(--muted); }
.cmp-table .cmp-zero, #compare .cmp-zero { stroke: #cbd5e1; }
[data-plot] line { stroke: var(--border); stroke-width: 1; }
[data-plot] text { fill: var(--muted); font: 11px var(--font); }
.ovw-modal .ovw-plot svg, [data-chart] .ovw-plot svg { width: auto; max-width: none; height: auto; }
.ovw-months { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ovw-month { overflow: hidden; }
.ovw-month header { padding: 14px 16px 0; }
.ovw-month h3 { font-size: 15px; }
.ovw-month table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ovw-month th, .ovw-month td { padding: 7px 12px; border-bottom: 1px solid var(--border); text-align: left; font-weight: 500; }
.ovw-month thead th { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.ovw-month td.num, .ovw-month thead th:nth-child(n + 3) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ovw-month tr.is-sub th { padding-left: 28px; color: var(--text-2); font-weight: 500; }
.ovw-month tr.is-deep th { padding-left: 44px; color: var(--muted); font-weight: 500; }
.ovw-month .is-good { color: var(--green); font-weight: 700; }
.ovw-month .is-bad { color: var(--red); font-weight: 700; }
.ovw-share { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; color: var(--muted); font-size: 11px; font-weight: 650; }
.ovw-track { width: 46px; height: 6px; border-radius: 99px; background: #eef2f7; overflow: hidden; }
.ovw-track i { display: block; height: 100%; background: #f87171; }
@media (max-width: 980px) {
  .ovw-months { grid-template-columns: 1fr; }
  .ovw-head { flex-direction: column; }
}
@media (max-width: 760px) {
  .cmp-table { display: none; }
  .cmp-months { display: grid; gap: 10px; }
  .cmp-box { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
  .cmp-box header { padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
  .cmp-box header button { border: 0; background: transparent; padding: 0; color: var(--primary); font: 700 13px var(--font); cursor: pointer; }
  .cmp-box header span { font: 700 13px var(--font); }
  .cmp-box ul { list-style: none; margin: 0; padding: 0; }
  .cmp-box li { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 7px 12px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
  .cmp-box li:last-child { border-bottom: 0; }
  .cmp-box li > span:first-child { color: var(--muted); font-weight: 650; }
  .cmp-box li > span:last-child { text-align: right; }
  .cmp-box small { display: block; font-size: 11px; line-height: 1.25; }
  .cmp-box.is-on { box-shadow: inset 0 0 0 1px #c7d2fe; }
  .cmp-box.is-on header { background: #eef2ff; }
}
.invoice-switch input:disabled { background: #eee; opacity: .7; }
.choice-row, .choice-col { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-col { flex-direction: column; align-items: stretch; margin: 8px 0 4px; }
.choice {
  min-height: 40px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font: 600 14px var(--font); cursor: pointer;
}
#receipt, #pay-error, #pay-today, #pay-new { display: grid; gap: 4px; }
#receipt[hidden], #pay-error[hidden], #pay-today[hidden], #pay-new[hidden], #pos-row[hidden] { display: none; }
.choice.is-on { border-color: var(--primary); background: #eef2ff; color: var(--primary); }
.checkline { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.wait-cover {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center;
  background: rgba(15, 23, 42, .45); color: var(--text);
}
.wait-cover div { width: min(420px, calc(100% - 32px)); padding: 22px; border-radius: 16px; background: #fff; display: grid; gap: 6px; }
.wait-cover[hidden] { display: none; }
@media (max-width: 760px) {
  .cal-day { min-height: 72px; padding: 3px; }
  .cal-chip { font-size: 10px; padding: 1px 4px; }
  .form-row, .form-row.cols-3 { display: grid; grid-template-columns: 1fr 1fr; }
  .form-row.address-row { grid-template-columns: minmax(0, 1fr) 6.5rem; }
  .form-row.address-row .field:last-child { grid-column: 1 / -1; }
  .form-row.money-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #purchase-edit-form .money-row.has-category { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .shortcut-row, .rail {
    display: flex; flex-wrap: nowrap; justify-content: center; gap: 10px;
  }
  .shortcut-row > .shortcut, .rail > .shortcut {
    flex: 0 0 auto; width: auto; padding: 8px; gap: 0; justify-content: center;
  }
  .shortcut > span:not(.kpi-icon) { display: none; }
  .shortcut .kpi-icon { width: 42px; height: 42px; border-radius: 12px; }
  .shortcut .kpi-icon .ico { width: 21px; height: 21px; }
  .shortcut .kpi-icon .ico-plus { width: 15px; height: 15px; }
}
#attendance-stats .grid-bar { display: none; }
#attendance-stats .att-sub small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
#attendance-stats .card > h2 { margin: 0; padding: 12px 12px 0; font-size: 14px; }
#attendance-stats .table { font-size: 11.5px; }
#attendance-stats .table th { font-size: 10px; letter-spacing: 0; padding: 6px 8px; white-space: normal; }
#attendance-stats .table td { padding: 5px 8px; }
#attendance-stats [data-months] .table th,
#attendance-stats [data-months] .table td,
#attendance-stats [data-months] .table .num,
#attendance-stats [data-months] .table td > .cell { text-align: center; }
#attendance-stats .table th:first-child, #attendance-stats .table td:first-child { padding-left: 10px; }
#attendance-stats .table th:last-child, #attendance-stats .table td:last-child { padding-right: 8px; }
#attendance-stats .table-wrap { overflow-x: hidden; }
#attendance-stats .badge { font-size: 10px; white-space: normal; }
#txn-catalog .is-pay { color: var(--green); font-weight: 650; }
#txn-catalog .is-charge { color: var(--red); font-weight: 650; }
#txn-catalog .toolbar .btn { margin-left: 0; }
.sheet { max-width: 760px; }
.with-btn { display: flex; gap: 8px; align-items: center; }
.with-btn input { flex: 1; min-width: 0; }
.with-btn .btn { height: 38px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.choices label { display: inline-flex; align-items: center; gap: 6px; font-weight: 550; }
#suppliers .is-ok { color: var(--green); }
#suppliers .is-off { color: var(--red); }
#members .choice-row { padding: 14px 18px 0; }
#members a.choice { display: inline-flex; align-items: center; text-decoration: none; }
#members .toolbar { padding-bottom: 0; }
#members .bal-switch { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; border-radius: 10px; background: #e8edf4; align-self: end; }
#members .bal-switch button { border: 0; background: transparent; height: 32px; padding: 0 12px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 650; color: #64748b; cursor: pointer; white-space: nowrap; }
#members .bal-switch button.is-on { background: #0f172a; color: #fff; }
#members .toolbar .field-grow { flex: 1 1 240px; }
#members .filter-note, #sub-stats .filter-note { margin: 10px 18px 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
#members .period-note { margin-top: 2px; font-size: 12.5px; }
#members .filter-note a { font-weight: 650; margin-left: 8px; }
#sub-stats .is-full { color: var(--green); font-weight: 700; }
#sub-stats .is-part { color: var(--red); font-weight: 700; }
#sub-stats .lead { margin: 0 0 4px; color: var(--muted); }
#members .who small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
#members .mem-name.is-ok { color: #0073b7; }
#members .mem-name.is-warn { color: #d97706; }
#members .mem-name.is-bad { color: #dc2626; }
#members .name-legend { margin: 0; padding: 4px 18px 14px; color: var(--muted); font-size: 12px; line-height: 1.4; }
#members .name-legend .is-ok { color: #0073b7; }
#members .name-legend .is-warn { color: #d97706; }
#members .name-legend .is-bad { color: #dc2626; }
#members .fam-bal { display: grid; gap: 2px; }
#members .is-debt { color: var(--red); font-weight: 700; }
#members .is-credit { color: var(--green); font-weight: 700; }
#members .fam-clear { color: var(--green); }
body[data-page=parents] .is-ok { color: var(--green); font-weight: 700; }
body[data-page=parents] .is-off { color: var(--red); font-weight: 700; }
body[data-page=parent-edit] .is-ok { color: var(--green); font-weight: 700; }
body[data-page=parent-edit] .is-warn { color: #d97706; font-weight: 700; }
#member-stats .table { font-size: 12px; }
#member-stats .table th { font-size: 10px; letter-spacing: 0; padding: 8px 6px; }
#member-stats .table td { padding: 8px 6px; }
#member-stats .table th.num,
#member-stats .table td.num,
#member-stats .table th:last-child,
#member-stats .table td:last-child { width: 1%; white-space: nowrap; }
#member-stats .metric-list { display: grid; gap: 10px; padding: 16px; }
#member-stats .metric-list > div { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; }
#member-stats .metric-list > div > div { display: flex; flex-direction: column; min-width: 0; }
#member-stats .metric-list .kpi-sub { display: block; }
#member-stats .stats-kpis { padding: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  #member-stats .stats-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  #member-stats .stats-kpis { grid-template-columns: 1fr; }
}
.access-wrap { overflow: auto; }
.access-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.access-table th, .access-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: center; vertical-align: middle; }
.access-table th:first-child, .access-table td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
.access-table th span { display: block; font-size: 13px; }
.access-table th small, .access-page small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.access-group td { background: var(--surface-2); font-weight: 700; color: var(--text); }
.access-table input { width: 16px; height: 16px; accent-color: var(--accent, #2563eb); }
.portal { min-height: 100vh; background: var(--bg); }
.portal-wrap { width: min(920px, 100%); margin: 0 auto; padding: 28px 16px 48px; }
.portal-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.portal-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.portal-brand h1 { font-size: 26px; margin: 0; }
.portal-brand p { margin: 2px 0 0; color: var(--muted); }
.portal-logo { width: min(160px, 34vw); height: 64px; object-fit: contain; object-position: left center; }
.portal-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.portal-body { display: grid; gap: 14px; padding: 18px; }
.portal-body h3 { margin: 8px 0 0; font-size: 16px; }
.portal-kid, .portal-doc { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.portal-doc.is-done { border-color: #86efac; background: #f0fdf4; }
.portal-kid h3 { margin: 0; font-size: 16px; }
.portal-kid h3 small, .panel-title h2 small { color: var(--muted); font-weight: 500; }
.portal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.portal-actions .btn { position: relative; }
.portal-debt { display: grid; gap: 8px; max-width: 280px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.portal-debt > p { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.portal-debt > div { display: grid; justify-items: center; gap: 2px; padding: 10px; border-radius: 10px; background: var(--surface); }
.portal-debt strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.portal-debt strong.is-due { color: #c0392b; }
.portal-bank { display: grid; justify-items: center; gap: 2px; padding-top: 8px; border-top: 1px dashed var(--border-strong); text-align: center; }
.portal-bank strong { letter-spacing: .03em; word-break: break-all; }
.portal-note { margin: 0; padding: 12px 14px; border-radius: 10px; background: #eff6ff; color: #1e3a8a; }
.portal-note.is-ok { background: #ecfdf3; color: #166534; }
.portal-note.is-warn { background: #fff7ed; color: #9a3412; }
.portal-status { display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #fef3c7; color: #92400e; }
.portal-status.is-1 { background: #dcfce7; color: #166534; }
.portal-status.is-2 { background: #fee2e2; color: #991b1b; }
@media (max-width: 640px) {
  .portal-actions .btn { flex: 1 1 100%; }
  .portal-logo { height: 48px; }
}
