:root {
  --ink: #1d2433;
  --muted: #667085;
  --line: #e4e7ec;
  --bg: #f4f6f9;
  --card: #ffffff;
  --brand: #1f4e79;
  --side: #13233a;
  --side-ink: #c9d4e3;
  --ok: #067647;
  --err: #b42318;
  --s-member: #12b76a;
  --s-provisional: #f79009;
  --s-non_member: #98a2b3;
  --s-defaulter: #d92d20;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
main { width: 100%; max-width: none; margin: 0; padding: 24px 32px 48px; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 0 0 12px; }
a { color: var(--brand); }
code { background: #eef2f6; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.small { font-size: 13px; }

/* Admin shell: dark sidebar on desktop, compact band on phones. */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .2s ease; }
.sidebar {
  background: var(--side);
  color: var(--side-ink);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: padding .2s ease;
}
.sidebar-toggle {
  position: absolute; top: 17px; right: 10px; z-index: 2; width: 30px; min-height: 30px;
  padding: 0; border: 1px solid #344967; border-radius: 7px; background: #1b2f4d; color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.sidebar-toggle:hover { background: #284568; }
.sidebar-toggle:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.sidebar .brand { padding-right: 30px; }
.sidebar .brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 16px; line-height: 1.2; }
.sidebar .brand span { display: block; font-weight: 400; font-size: 13px; color: var(--side-ink); }
.sidebar-search input { width: 100%; padding: 9px 10px; border-radius: 6px; border: 1px solid #2c4262; background: #1b2f4d; color: #fff; font: inherit; }
.sidebar-search input::placeholder { color: #8ea3bf; }
.sidebar-search { position: relative; }
.sidebar-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: #fff; color: var(--ink); border-radius: 8px; padding: 6px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .28); max-height: 60vh; overflow: auto;
}
.sidebar-list { list-style: none; margin: 0; padding: 0; }
.sidebar-list li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; font-size: 14px; }
.sidebar-list li:hover { background: #f2f4f7; }
.sidebar-list li a { color: var(--ink); text-decoration: none; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-list li a:hover { color: var(--brand); }
.sidebar-list li .badge { flex: 0 0 auto; }
.sidebar-list li.muted { display: block; font-weight: 400; }
#side-all { display: block; padding: 8px; margin-top: 4px; border-top: 1px solid var(--line); font-size: 14px; text-decoration: none; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a { display: flex; align-items: center; gap: 12px; color: var(--side-ink); text-decoration: none; padding: 9px 12px; border-radius: 6px; }
.nav-icon { display: block; width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side-nav a:hover { background: #1b2f4d; color: #fff; }
.side-nav a.active { background: var(--brand); color: #fff; font-weight: 600; }
.side-foot { margin-top: auto; }
.side-foot button.link { display: flex; align-items: center; gap: 12px; color: var(--side-ink); }
.content { min-width: 0; }
.shell.sidebar-collapsed { grid-template-columns: 68px minmax(0, 1fr); }
.sidebar-collapsed .sidebar { padding-inline: 10px; }
.sidebar-collapsed .sidebar-toggle { right: 19px; }
.sidebar-collapsed .brand { display: block; padding: 40px 0 0; overflow: hidden; font-size: 0; text-align: center; }
.sidebar-collapsed .brand::before { content: attr(data-short); color: #fff; font-size: 15px; font-weight: 700; }
.sidebar-collapsed .brand span,
.sidebar-collapsed .sidebar-search { display: none; }
.sidebar-collapsed .side-foot { margin-top: auto; display: block; text-align: center; }
.sidebar-collapsed .side-foot button.link { width: 100%; min-height: 38px; justify-content: center; padding-inline: 0; }
.sidebar-collapsed .side-foot .nav-label,
.sidebar-collapsed .side-nav .nav-label { display: none; }
.sidebar-collapsed .side-nav a { justify-content: center; padding: 10px 0; overflow: hidden; }
.sidebar-collapsed .side-nav .nav-icon { width: 22px; height: 22px; flex-basis: 22px; }
.sidebar-collapsed .side-nav a.active { background: #31577f; }
.graph-hint { margin: 0 0 8px; }
.graph-toolbar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.graph-toolbar label { min-width: 180px; }
.graph-toolbar .graph-search { flex: 1 1 240px; }
.graph-view-actions { display: flex; gap: 8px; }
.graph-count { margin: 0 0 6px; font-size: 13px; }
.graph-key { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.graph-key span { display: inline-flex; align-items: center; gap: 5px; }
.graph-key i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.graph-key .member { background: #18a66a; }
.graph-key .provisional { background: #e89a22; }
.graph-key .non-member { background: #8290a3; }
.graph-key .defaulter { background: #d35454; }
.flat-graph-3d { width: 100%; height: min(68vh, 760px); min-height: 420px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; touch-action: none; }
.graph-details { margin-top: 10px; min-height: 24px; padding: 14px; color: var(--ink); background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; }
.graph-details h2, .graph-details p { margin: 0 0 8px; }
.graph-details .muted { margin: 0; }
.graph-management { margin-top: 14px; }
.relation-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.relation-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 9px; }
.data-tools-grid { align-items: start; }
.data-tool { display: grid; align-content: start; gap: 12px; }
.data-tool h2, .data-tool p { margin: 0; }
.data-tool input[type="file"] { font-size: 14px; }
.tool-result { overflow-wrap: anywhere; }
.tool-result ul { padding-left: 20px; }
.relation-type-form { display: flex; align-items: flex-end; gap: 8px; }
.relation-type-form label { flex: 1; }
.relation-type-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.relation-type-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 6px 0; }
.activity-list { display: grid; gap: 14px; }
.activity-entry { border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.activity-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; }
.activity-entry details { margin-top: 8px; }
.activity-values { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 8px; }
.activity-values h3 { font-size: 13px; margin: 0 0 4px; }
.activity-values pre { max-height: 280px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: #f8fafc; padding: 10px; border-radius: 6px; font-size: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.card.narrow { max-width: 560px; margin: 24px auto; }
.section-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.actions-cell .row-action { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 32px; min-height: 32px; opacity: 1; transition: opacity .15s ease; }
.register tbody tr.member-row:focus-visible .row-action,
.register tbody tr.member-row:focus-within .row-action { opacity: 1; pointer-events: auto; }
@media (hover: hover) and (pointer: fine) {
  .register tbody tr.member-row:not(:hover):not(:focus-within):not(:focus-visible) .row-action { opacity: 0; pointer-events: none; }
  .register tbody tr.member-row:hover .row-action { opacity: 1; pointer-events: auto; }
}
.actions-cell a.row-action { text-decoration: none; }
.actions-cell .action-icon { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.actions-cell button.row-action { padding: 0; border: 0; background: transparent; font: inherit; cursor: pointer; }
.muted { color: var(--muted); font-weight: 400; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.connect-flats-form input { width: 100%; }
.flat-autocomplete { position: relative; }
.flat-search-options { position: absolute; inset: calc(100% + 4px) 0 auto; z-index: 20; max-height: 260px; overflow-y: auto; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 24px rgba(16, 24, 40, .16); }
.flat-search-option { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 5px; background: #fff; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.flat-search-option:hover, .flat-search-option:focus-visible { background: #eef5fc; outline: none; }
.flat-search-empty { margin: 0; padding: 10px; color: var(--muted); font-size: 14px; }
.selected-flat-connections { padding: 12px 14px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; }
.selected-flat-connections h2 { margin: 0 0 8px; font-size: 14px; }
.selected-flat-connections ul { display: grid; gap: 6px; margin: 0; padding-left: 18px; }
.selected-flat-connections li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.connection-delete-form { margin: 0; }
.flat-connection-names { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; }
.connect-flats-form .relation-options { display: grid; gap: 8px; border: 0; margin: 0; padding: 0; }
.connect-flats-form .relation-options legend { margin-bottom: 2px; font-weight: 600; }
.connect-flats-form .relation-option { display: flex; flex-direction: row; align-items: center; gap: 9px; width: fit-content; font-weight: 400; cursor: pointer; }
.connect-flats-form .relation-option input { width: 18px; min-height: 18px; margin: 0; accent-color: var(--brand); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .flat-graph-3d { height: 58vh; min-height: 360px; max-height: 560px; }
  .graph-toolbar { align-items: stretch; }
  .graph-toolbar label { min-width: 0; }
  .graph-toolbar .graph-search, .graph-toolbar .graph-status { flex-basis: 100%; }
  .graph-toolbar input, .graph-toolbar select { width: 100%; min-width: 0; }
  .graph-view-actions { width: 100%; }
  .graph-view-actions button { flex: 1; }
  .graph-key { gap: 8px 12px; }
  .graph-management { grid-template-columns: 1fr; }
  .graph-management > *, .graph-management label { min-width: 0; max-width: 100%; }
  .graph-management select, .graph-management input { width: 100%; max-width: 100%; }
  .relation-list li { align-items: flex-start; }
  .relation-type-form { align-items: stretch; flex-direction: column; }
  .activity-head { flex-direction: column; }
}
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
input, select, textarea {
  font: inherit;
  font-weight: 400;
  padding: 8px 10px;
  border: 1px solid #cfd4dc;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9ec5ea; border-color: var(--brand); }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.filters .search-lg { flex: 1 1 320px; }
.filters .search-lg input { font-size: 16px; padding: 11px 14px; }
.chips-group { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chips-group legend { font-size: 14px; font-weight: 600; margin-right: 6px; padding: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex-direction: row;
  padding: 5px 11px; border: 0; border-radius: 999px; background: transparent;
  font-weight: 500; font-size: 14px; cursor: pointer; user-select: none;
}
.chip input { margin: 0; width: 16px; height: 16px; accent-color: var(--brand); }
.chip:has(input:checked) { background: #e8f0f8; color: var(--brand); font-weight: 600; }
.chip:has(input:focus-visible) { outline: 2px solid #9ec5ea; outline-offset: 2px; }
.status-filters { flex: 1 1 100%; align-items: center; gap: 8px; }
.status-filter-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; width: 100%; }
.status-filter-head { margin-top: 2px; }
.status-filter-actions { display: inline-flex; gap: 6px; margin-left: auto; }
.status-filter-actions button { padding: 3px 9px; font-size: 12px; color: var(--brand); }
.status-chip { padding: 5px 10px; }
.status-chip.status-member:has(input:checked) { background: #ecfdf3; color: #067647; }
.status-chip.status-provisional:has(input:checked) { background: #fffaeb; color: #b54708; }
.status-chip.status-non_member:has(input:checked) { background: #f2f4f7; color: #475467; }
.status-chip.status-defaulter:has(input:checked) { background: #fef3f2; color: #b42318; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.status-member .status-dot { background: var(--s-member); }
.status-provisional .status-dot { background: var(--s-provisional); }
.status-non_member .status-dot { background: var(--s-non_member); }
.status-defaulter .status-dot { background: var(--s-defaulter); }
.result-line { margin: 0 0 12px; color: var(--muted); }
.result-line a { margin-left: 10px; }
button, .button {
  font: inherit;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #cfd4dc;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.primary, .button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.link { border: 0; background: none; padding: 0; color: var(--brand); cursor: pointer; font: inherit; }
button.link.danger { color: var(--err); }
form.inline { display: inline; margin: 0; }
.error-text { color: var(--err); font-size: 13px; font-weight: 400; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-weight: 600; }
.flash.ok { background: #ecfdf3; color: var(--ok); }
.flash.error { background: #fef3f2; color: var(--err); }

/* Dashboard */
.dashboard-layout { display: grid; gap: 22px; }
.dashboard-layout > * { min-width: 0; margin-bottom: 0; }
.dashboard-overview { display: grid; gap: 10px; }
.dashboard-section-head h2 { margin: 0 0 2px; }
.dashboard-section-head p { margin: 0; }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.hero h1 { margin-bottom: 4px; }
.hero p { margin: 0; }
.hero-search { display: flex; gap: 8px; flex: 1 1 420px; max-width: 620px; }
.hero-search input { flex: 1; font-size: 16px; padding: 11px 14px; }
.hero-search button { padding: 0 20px; font-size: 15px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: var(--ink);
}
.kpi.total { border-left-color: var(--brand); }
.kpi.status-member { border-left-color: var(--s-member); }
.kpi.status-provisional { border-left-color: var(--s-provisional); }
.kpi.status-non_member { border-left-color: var(--s-non_member); }
.kpi.status-defaulter { border-left-color: var(--s-defaulter); }
a.kpi:hover { border-color: #cfd4dc; }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { font-size: 28px; line-height: 1.1; }
.kpi-sub { font-size: 12px; color: var(--muted); }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.chart-card h2 { margin-bottom: 14px; }
.donut-wrap { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.donut { width: 170px; height: 170px; flex: 0 0 auto; }
.donut-track { fill: none; stroke: #f2f4f7; stroke-width: 20; }
.donut circle[class^="seg-"] { fill: none; stroke-width: 20; }
.donut-num { font-size: 20px; font-weight: 700; fill: var(--ink); }
.donut-label { font-size: 11px; fill: var(--muted); }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; flex: 1 1 180px; }
.legend li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.legend li .muted { margin-left: auto; font-size: 13px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.swatch.seg-member, .bar-seg.seg-member { background: var(--s-member); }
.swatch.seg-provisional, .bar-seg.seg-provisional { background: var(--s-provisional); }
.swatch.seg-non_member, .bar-seg.seg-non_member { background: var(--s-non_member); }
.swatch.seg-defaulter, .bar-seg.seg-defaulter { background: var(--s-defaulter); }
.seg-member { stroke: var(--s-member); }
.seg-provisional { stroke: var(--s-provisional); }
.seg-non_member { stroke: var(--s-non_member); }
.seg-defaulter { stroke: var(--s-defaulter); }

.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 28px 1fr 40px; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.bar-row:hover .bar-track { outline: 2px solid #9ec5ea; }
.bar-label { font-weight: 700; }
.bar-track { display: flex; height: 18px; border-radius: 4px; overflow: hidden; background: #f2f4f7; min-width: 8px; }
.bar-seg { display: block; height: 100%; }
.bar-count { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.recent { list-style: none; padding: 0; margin: 0; }
.recent li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--line); }
.recent li:last-child { border-bottom: 0; }
.recent-flat { color: var(--ink); text-decoration: none; flex: 1 1 260px; min-width: 0; }
.recent-flat:hover { color: var(--brand); text-decoration: underline; }
.recent time { font-variant-numeric: tabular-nums; }

mark { background: #fef0c7; color: inherit; border-radius: 2px; padding: 0 1px; }
[hidden] { display: none !important; }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; font-size: 20px; font-weight: 700; color: var(--brand); }
.login-brand .login-logo img { border-radius: 12px; margin: 0; }
.login-logo small { font-size: 14px; font-weight: 400; color: var(--muted); }
.login-brand h1 { font-size: 38px; }
.login-lead { font-size: 17px !important; color: var(--muted) !important; margin: 12px 0 22px !important; }
.login-illustration { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 0 22px; }
.login-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; max-width: 480px; }
.login-features li { position: relative; padding-left: 30px; font-size: 15px; line-height: 1.45; color: var(--ink); }
.login-features li::before {
  content: "✓"; position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%;
  background: #e6f6ee; color: var(--s-member); font-size: 12px; font-weight: 700; text-align: center; line-height: 20px;
}
.login-features code { background: #eef2f6; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.login-card h2 { font-size: 22px; margin: 0 0 14px; }
.login-footer { grid-column: 1 / -1; text-align: center; font-size: 13px; color: var(--muted); padding-top: 8px; border-top: 1px solid var(--line); }
@media (max-width: 800px) {
  .login-logo { justify-content: center; }
  .login-lead { margin-inline: auto !important; }
  .login-illustration { margin-inline: auto; }
  .login-features { margin-inline: auto; text-align: left; }
  .login-brand h1 { font-size: 30px; }
}
.brand-mark { display: inline-block; vertical-align: middle; margin-right: 8px; }
.sidebar-collapsed .brand-mark { display: block; margin: 0 auto; }
.sidebar-collapsed .brand::before { content: none; }
.filter-panel { flex: 1 1 100%; }
.filter-panel > summary { cursor: pointer; font-weight: 600; font-size: 14px; margin: 0 0 10px; }
.filter-panel > summary:focus-visible { outline: 2px solid #9ec5ea; outline-offset: 2px; }
.filter-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Login page: branding on the left, sign-in card on the right; stacks on phones. */
.login-page {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 48px; align-items: center;
  min-height: calc(100vh - 120px); max-width: 980px; margin: 0 auto;
}
.login-brand img { display: block; margin-bottom: 14px; border-radius: 16px; }
.login-brand h1 { font-size: 44px; line-height: 1.1; color: var(--brand); margin: 0 0 12px; }
.login-brand p { font-size: 20px; line-height: 1.4; color: var(--ink); margin: 0; max-width: 480px; }
.login-card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .1), 0 8px 16px rgba(0, 0, 0, .08);
}
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form label { gap: 0; font-weight: 400; }
.login-form input {
  font-size: 17px; padding: 14px 16px; border: 1px solid #dddfe2; border-radius: 6px; width: 100%;
}
.login-form input:focus { border-color: #1877f2; box-shadow: 0 0 0 2px #e7f3ff; outline: none; }
.login-submit {
  font: inherit; font-size: 20px; font-weight: 700; color: #fff; background: #1877f2; border: 0;
  border-radius: 6px; padding: 12px 16px; cursor: pointer; width: 100%;
}
.login-submit:hover { background: #166fe5; }
.login-submit:focus-visible { outline: 2px solid #9ec5ea; outline-offset: 2px; }
.login-note { margin: 16px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.login-card .flash { margin-bottom: 12px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
@media (max-width: 800px) {
  .login-page { grid-template-columns: 1fr; gap: 24px; min-height: 0; text-align: center; }
  .login-brand img { margin: 0 auto 10px; }
  .login-brand h1 { font-size: 32px; }
  .login-brand p { font-size: 17px; margin: 0 auto; }
  .login-card { width: 100%; max-width: 396px; margin: 0 auto; }
}
/* Consistent space between stacked sections and cards on every page. */
main > section + section, main > .card + .card { margin-top: 20px; }
.search-results { margin: -4px 0 16px; }
/* Space between the parts of the register: heading, filters, result line and table. */
.register-card > * + * { margin-top: 18px; }
.register-card > .filters { margin-bottom: 0; }
.filter-panel > .chips-group + .chips-group { margin-top: 16px; }
.filter-panel > .filter-actions { margin-top: 16px; }
/* Tables */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.grid th { background: #f9fafb; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
table.grid td.num, table.grid th.num { text-align: right; }
table.grid td.empty { text-align: center; color: var(--muted); padding: 24px; }
table.grid tbody tr:hover { background: #fafbfc; }
.register tbody tr.member-row { cursor: pointer; transition: background-color .15s ease, box-shadow .15s ease; }
.register tbody tr.member-row:hover,
.register tbody tr.member-row:focus-visible { background: #eef5fc; box-shadow: inset 3px 0 0 var(--brand); outline: none; }
.register tbody tr.member-row:active { background: #e4eff9; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2f6; color: #344054; white-space: nowrap; }
.badge.member { background: #ecfdf3; color: var(--ok); }
.badge.provisional { background: #fffaeb; color: #b54708; }
.badge.non_member { background: #f2f4f7; color: #475467; }
.badge.defaulter { background: #fef3f2; color: var(--err); }
.print-only { display: none; }

/* Tablets and below: sidebar becomes a top band. */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .shell.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 12px 54px 12px 16px; }
  .sidebar-toggle { top: 12px; right: 14px; }
  .sidebar-collapsed .sidebar { position: relative; padding: 12px 54px 12px 16px; gap: 0; }
  .sidebar-collapsed .brand { display: block; padding: 0; overflow: visible; font-size: 16px; text-align: left; }
  .sidebar-collapsed .brand::before { content: none; }
  .sidebar-collapsed .brand span { display: block; }
  .sidebar-collapsed .sidebar-search,
  .sidebar-collapsed .side-nav { display: none; }
  .sidebar-collapsed .side-foot { margin: 0 0 0 auto; display: block; }
  .sidebar-collapsed .side-foot button.link { width: auto; min-height: 38px; padding: 0 8px; }
  .sidebar-collapsed .sidebar-toggle { right: 14px; }
  .sidebar-search { flex: 1 1 220px; }
  .sidebar-search input { width: 100%; }
  .side-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .side-nav a { padding: 8px 10px; }
  .side-foot { margin-top: 0; }
}

/* Phones: tap targets, no iOS zoom on inputs, register rows stack as cards. */
@media (max-width: 640px) {
  main { padding: 16px 16px 40px; }
  .card { padding: 16px; }
  .sidebar-search input, .hero-search input, .filters .search-lg input { font-size: 16px; }
  .hero-search { flex-direction: column; }
  .hero-search button { min-height: 44px; }
  .kpi-value { font-size: 24px; }
  input, select, textarea { font-size: 16px; }
  input, select { min-height: 44px; }
  button, .button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters label, .filters .button, .filters button { width: 100%; }
  .filters .search-lg { flex: none; }
  .filters .chip { width: auto; min-height: 36px; padding: 6px 14px; }
  .chip input { min-height: 16px; }
  .chips-group { gap: 8px; }
  .actions .button, .actions button { flex: 1 1 auto; }
  .section-head .actions { width: 100%; }

  table.register thead { display: none; }
  table.register, table.register tbody, table.register tr, table.register td { display: block; width: 100%; }
  table.register tr { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
  table.register tr.member-row:hover,
  table.register tr.member-row:focus-visible { box-shadow: 0 0 0 2px rgba(31, 78, 121, .22); }
  table.register td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.register td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; text-align: left; }
  table.register td.serial, table.register td.empty { display: block; text-align: left; }
  table.register td.serial, table.register td.empty::before, table.register td.actions-cell::before { display: none; }
  table.register td.empty { padding: 20px 0; text-align: center; }
  table.register td.actions-cell { justify-content: flex-start; align-items: center; gap: 16px; padding-top: 8px; }
  table.register td.actions-cell a, table.register td.actions-cell button.link { font-size: 15px; min-height: 44px; display: inline-flex; align-items: center; }

  table.dashboard th, table.dashboard td { padding: 8px 6px; font-size: 14px; }
  table.dashboard th { font-size: 11px; }
}

@media print {
  body { background: #fff; }
  .shell { display: block; }
  main { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .no-print { display: none !important; }
  .print-only { display: block; font-size: 16px; margin-bottom: 8px; }
  table.grid th, table.grid td { padding: 4px 6px; font-size: 11px; }
  table.grid { page-break-inside: auto; }
  tr { page-break-inside: avoid; }
}
