 /* ============================================================
     DESIGN TOKENS — LIGHT THEME
     ============================================================ */
  :root {
    --bg-deep:       #eef2f7;
    --bg-base:       #f5f8fc;
    --bg-elev-1:     #ffffff;
    --bg-elev-2:     #f4f7fb;
    --bg-hover:      #eef4fb;

    --line-soft:     #e2e8f0;
    --line-med:      #cbd5e1;
    --line-strong:   #94a3b8;

    --tx-hi:         #0f172a;
    --tx-mid:        #475569;
    --tx-lo:         #64748b;
    --tx-dim:        #94a3b8;

    --accent:        #14b8a6;
    --accent-hi:     #0d9488;
    --accent-lo:     #0f766e;
    --accent-dim:    rgba(20, 184, 166, 0.12);
    --accent-glow:   rgba(20, 184, 166, 0.25);
    --accent-ring:   rgba(20, 184, 166, 0.30);

    --amber:         #d97706;
    --amber-hi:      #b45309;
    --amber-lo:      #92400e;
    --amber-dim:     rgba(245, 158, 11, 0.14);
    --amber-ring:    rgba(217, 119, 6, 0.30);

    --ok:            #059669;
    --danger:        #dc2626;
    --danger-hi:     #b91c1c;

    --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 14px;

    --ff-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
    --ff-mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo,
               Consolas, monospace;
  }

  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }
  html, body { margin: 0; padding: 0; min-height: 100%; }

  body {
    font-family: var(--ff-sans);
    font-size: 13px;
    line-height: 1.55;
    color: var(--tx-hi);
    background-color: #eef2f7;
    background-image:
      radial-gradient(60% 50% at 12% 18%, rgba(20,184,166,.18) 0%, transparent 60%),
      radial-gradient(55% 45% at 88% 12%, rgba(139,92,246,.15) 0%, transparent 60%),
      radial-gradient(60% 55% at 72% 88%, rgba(14,165,233,.14) 0%, transparent 60%),
      radial-gradient(50% 50% at 10% 92%, rgba(244,63,94,.10) 0%, transparent 60%),
      linear-gradient(135deg, #f7fafc 0%, #eaf0f7 50%, #f2f6fb 100%);
    background-attachment: fixed;
    padding: 40px 20px 80px;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    position: relative;
    overflow-x: hidden;
    isolation: isolate;
  }

  body::before {
    content: ""; position: fixed; inset: -25%; z-index: -2; pointer-events: none;
    background:
      radial-gradient(35% 35% at 20% 30%, rgba(20,184,166,.35) 0%, transparent 70%),
      radial-gradient(32% 32% at 80% 25%, rgba(139,92,246,.30) 0%, transparent 70%),
      radial-gradient(38% 38% at 65% 80%, rgba(14,165,233,.26) 0%, transparent 70%),
      radial-gradient(30% 30% at 15% 85%, rgba(244,63,94,.20) 0%, transparent 70%);
    filter: blur(60px) saturate(140%);
    animation: aurora-drift 26s ease-in-out infinite alternate;
    will-change: transform, filter;
    opacity: .55;
  }
  body::after {
    content: ""; position: fixed; inset: -10%; z-index: -1; pointer-events: none;
    background:
      conic-gradient(from 220deg at 50% 50%,
        transparent 0deg, rgba(20,184,166,.10) 60deg, transparent 130deg,
        rgba(139,92,246,.09) 200deg, transparent 280deg,
        rgba(14,165,233,.08) 340deg, transparent 360deg);
    animation: sweep 40s linear infinite;
    mix-blend-mode: multiply;
    opacity: .55;
  }
  @keyframes aurora-drift {
    0%   { transform: translate3d(0,0,0)      scale(1.00) rotate(0deg);   filter: blur(60px) saturate(140%) hue-rotate(0deg); }
    25%  { transform: translate3d(5%,-4%,0)   scale(1.08) rotate(6deg);   filter: blur(65px) saturate(155%) hue-rotate(15deg); }
    50%  { transform: translate3d(-4%,5%,0)   scale(0.95) rotate(-6deg);  filter: blur(58px) saturate(150%) hue-rotate(-10deg); }
    75%  { transform: translate3d(3%,6%,0)    scale(1.05) rotate(4deg);   filter: blur(62px) saturate(160%) hue-rotate(10deg); }
    100% { transform: translate3d(-5%,-3%,0)  scale(1.02) rotate(-4deg);  filter: blur(60px) saturate(145%) hue-rotate(-8deg); }
  }
  @keyframes sweep {
    from { transform: rotate(0deg)   scale(1); }
    50%  { transform: rotate(180deg) scale(1.05); }
    to   { transform: rotate(360deg) scale(1); }
  }
  @media (prefers-reduced-motion: reduce) {
    body::before, body::after { animation: none !important; }
    * { animation-duration: .001ms !important; }
  }

  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: #eef2f7; }
  ::-webkit-scrollbar-thumb {
    background: #cbd5e1; border-radius: 5px;
    border: 2px solid #eef2f7;
  }
  ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

  h1 {
    text-align: center; color: #0f172a; font-size: 28px; font-weight: 700;
    letter-spacing: -0.025em; margin: 0 0 8px;
  }
  .subtitle {
    text-align: center; color: #64748b; margin: 0 0 36px;
    font-weight: 500; font-size: 11px; letter-spacing: .20em;
    text-transform: uppercase;
  }

  .container {
    max-width: 1400px; margin: 0 auto;
    background: linear-gradient(180deg, #ffffff 0%, #f5f8fc 100%);
    padding: 36px 40px 32px; border-radius: var(--r-lg);
    border: 1px solid #dbe3ee;
    box-shadow: 0 1px 2px rgba(15,23,42,.05),
                0 20px 50px rgba(15,23,42,.10);
    position: relative; overflow: hidden;
  }
  .container::before {
    content: ""; position: absolute; top: 0; left: 24px; right: 24px; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(20,184,166,.55), transparent);
  }

  /* ============================================================
     TOP BAR
     ============================================================ */
  .topbar {
    display: flex; justify-content: space-between; align-items: center;
    margin: -8px 0 24px; padding: 14px 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--r-md);
    box-shadow: 0 1px 2px rgba(15,23,42,.04), inset 0 1px 0 #ffffff;
    gap: 16px; flex-wrap: wrap;
    position: relative; z-index: 2;
  }
  .topbar .brand {
    font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
    color: var(--accent-hi); font-weight: 700;
  }
  .topbar .user-chip {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  }
  .topbar .user-chip .name { font-weight: 600; color: var(--tx-hi); }
  .topbar .user-chip .role {
    font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
    padding: 3px 9px; border-radius: 999px;
    background: var(--accent-dim); color: var(--accent-hi);
    border: 1px solid rgba(20,184,166,.35);
  }
  .topbar .user-chip .role.admin {
    background: var(--amber-dim); color: var(--amber-hi);
    border-color: rgba(217,119,6,.40);
  }
  .topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }
  .topbar button { padding: 7px 14px; font-size: 12px; }

  /* ============================================================
     ADMIN BANNER
     ============================================================ */
  .admin-banner {
    margin: -8px 0 20px;
    padding: 12px 16px;
    border-radius: var(--r-md);
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-left: 4px solid #d97706;
    color: #7c2d12;
    font-size: 12px;
    font-weight: 500;
    position: relative; z-index: 2;
  }
  .admin-banner.hidden { display: none; }

  /* ============================================================
     MAIN FORM — HEADER GRID
     ============================================================ */
  .header-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 14px 32px; margin-bottom: 32px; padding: 22px 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
    border: 2px solid #334155;
    border-radius: var(--r-md);
    box-shadow: 0 1px 2px rgba(15,23,42,.04),
                0 6px 18px rgba(15,23,42,.06),
                inset 0 1px 0 #ffffff;
  }
  .field { display: flex; align-items: center; gap: 12px; }
  .header-grid .field label {
    font-weight: 600; color: #475569; min-width: 150px;
    font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
  }
  .header-grid .field input {
    flex: 1; padding: 9px 12px; border: 1px solid #cbd5e1;
    border-radius: var(--r-sm); font-size: 13px; font-family: inherit;
    color: #0f172a; background: #ffffff;
    transition: border-color 140ms, box-shadow 140ms, background 140ms;
  }
  .header-grid .field input:hover { border-color: #94a3b8; }
  .header-grid .field input:focus {
    outline: none; border-color: var(--accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px var(--accent-ring);
  }
  .header-grid .field input::placeholder { color: #94a3b8; }
  .header-grid .field input[readonly] {
    background: #f1f5f9; color: #475569;
    cursor: not-allowed; border-style: dashed;
  }

  /* ============================================================
     MAIN LEDGER SHEET
     ============================================================ */
  table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    font-size: 13px; border: 2px solid #334155;
    border-radius: var(--r-md); overflow: hidden;
    background: #ffffff;
  }
  thead th {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #5eead4; padding: 12px 10px; text-align: left;
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .14em; border-bottom: 2px solid #0f172a;
    white-space: nowrap;
  }
  td {
    border-bottom: 1px solid #cbd5e1; padding: 2px 10px;
    color: var(--tx-hi);
  }
  tbody tr:last-child td { border-bottom: none; }
  tbody tr:nth-child(even) { background: #f8fafc; }
  tbody tr { transition: background 120ms ease; }
  tbody tr:hover { background: #ecfdf5; box-shadow: inset 3px 0 0 var(--accent); }

  td input {
    width: 100%; border: none; background: transparent;
    padding: 9px 4px; font-size: 13px; font-family: inherit;
    color: var(--tx-hi); text-align: right; outline: none;
    border-radius: var(--r-xs);
    transition: background 120ms, box-shadow 120ms;
  }
  td input:focus { background: var(--accent-dim); box-shadow: inset 0 0 0 1px var(--accent); }
  td input[type="date"] { text-align: center; color: var(--tx-mid); }
  td input[readonly][data-col="A"],
  #disbursementTable td input[readonly][data-col="PLOT"] {
    background: #f1f5f9;
    color: #475569;
    cursor: not-allowed;
    font-weight: 600;
    text-align: center;
  }
  td.calc {
    text-align: right; color: var(--tx-mid);
    font-variant-numeric: tabular-nums; font-family: var(--ff-mono);
    font-size: 12px; padding-right: 12px;
  }
  td.penalty {
    text-align: right; color: var(--danger); font-weight: 600;
    font-variant-numeric: tabular-nums; font-family: var(--ff-mono);
    font-size: 12px; padding-right: 12px;
  }
  td.dr {
    text-align: center; color: var(--accent-hi); font-weight: 700;
    font-size: 10px; letter-spacing: .08em;
    background: var(--accent-dim); font-family: var(--ff-mono);
  }
  td.date {
    text-align: center; color: var(--tx-lo);
    font-family: var(--ff-mono); font-size: 12px;
  }

  /* ============================================================
     ADMIN-LOCKED INPUTS
     ============================================================ */
  input.admin-locked,
  .header-grid input.admin-locked,
  #ledgerTable input.admin-locked,
  .disb-header-band input.admin-locked,
  #disbursementTable input.admin-locked {
    background: #f1f5f9 !important;
    color: #475569 !important;
    cursor: not-allowed !important;
    border-color: #e2e8f0 !important;
  }

  /* ============================================================
     TOOLBAR + BUTTONS
     ============================================================ */
  .toolbar {
    margin-top: 28px; padding-top: 24px;
    border-top: 1px solid #e2e8f0;
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  }
  button {
    padding: 10px 18px; border: 1px solid #cbd5e1;
    border-radius: var(--r-sm); background: #ffffff;
    color: var(--tx-hi); cursor: pointer; font-size: 13px;
    font-family: inherit; font-weight: 500;
    transition: background 140ms, border-color 140ms,
                transform 80ms, box-shadow 140ms, color 140ms;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
    white-space: nowrap;
  }
  button:hover { background: #f8fafc; border-color: #94a3b8; }
  button:active { transform: translateY(1px); }
  button:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
  button:disabled { opacity: .5; cursor: not-allowed; }

  button:not(.secondary):not(.danger):not(.print-btn):not(.disb-btn):not(.ghost):not(.search-bar button) {
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-lo) 100%);
    color: #ffffff; border-color: var(--accent-lo); font-weight: 700;
  }
  button:not(.secondary):not(.danger):not(.print-btn):not(.disb-btn):not(.ghost):not(.search-bar button):hover {
    background: linear-gradient(180deg, var(--accent-hi) 0%, var(--accent) 100%);
  }
  button.secondary { background: #ffffff; color: var(--tx-mid); }
  button.secondary:hover { background: #f8fafc; color: var(--tx-hi); }
  button.danger {
    background: linear-gradient(180deg, #fef2f2 0%, #fee2e2 100%);
    color: var(--danger-hi); border-color: #fca5a5;
  }
  button.danger:hover {
    background: linear-gradient(180deg, #fee2e2 0%, #fecaca 100%);
    border-color: var(--danger); color: #7f1d1d;
  }
  button.print-btn {
    background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
    color: #065f46; border-color: #6ee7b7;
  }
  button.print-btn:hover {
    background: linear-gradient(180deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: var(--ok); color: #064e3b;
  }
  button.disb-btn {
    background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
    color: #92400e; border-color: #fcd34d;
  }
  button.disb-btn:hover {
    background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
    border-color: var(--amber); color: #78350f;
  }
  button.disb-btn.active {
    background: linear-gradient(180deg, var(--amber) 0%, var(--amber-lo) 100%);
    color: #ffffff; border-color: var(--amber-lo); font-weight: 700;
  }
  button.ghost {
    background: transparent; border-color: #cbd5e1;
    color: var(--tx-mid); box-shadow: none;
  }
  button.ghost:hover { border-color: var(--accent); color: var(--accent-hi); background: #f0fdfa; }

  .search-bar {
    display: flex; gap: 8px; margin-left: auto; align-items: center;
    padding: 5px 5px 5px 14px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--r-md);
    transition: border-color 140ms, box-shadow 140ms;
  }
  .search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
  .search-bar input {
    padding: 7px 8px; border: none; background: transparent;
    font-size: 13px; font-family: inherit; color: var(--tx-hi);
    width: 230px; outline: none;
  }
  .search-bar input::placeholder { color: var(--tx-dim); }
  .search-bar button { padding: 8px 14px; box-shadow: none; }

  .status {
    margin-top: 16px; font-size: 13px; min-height: 22px;
    font-weight: 600; padding: 0 2px;
  }
  .status.ok    { color: var(--ok); }
  .status.error { color: var(--danger-hi); }
  .status.info  { color: var(--accent-hi); }

  .record-info {
    margin-top: 16px; padding: 12px 16px; border-radius: var(--r-md);
    font-size: 13px; background: #f0fdfa; color: var(--accent-hi);
    border: 1px solid rgba(20,184,166,.30); border-left: 3px solid var(--accent);
    display: none; font-weight: 500;
  }
  .record-info.dirty {
    background: #fffbeb; border-color: rgba(217,119,6,.35);
    border-left-color: var(--amber); color: var(--amber-hi);
  }
  .record-info .meta {
    display: block; margin-top: 4px; font-size: 11px;
    opacity: .85; font-family: var(--ff-mono);
  }

  /* ============================================================
     DISBURSEMENT FORM
     ============================================================ */
  .disbursement-section {
    margin-top: 36px; padding: 26px 28px 22px;
    border: 2px solid #92400e;
    border-radius: var(--r-lg);
    background: linear-gradient(180deg, #fffdf6 0%, #fbf6e9 100%);
    box-shadow: 0 1px 2px rgba(120,83,9,.06),
                0 8px 22px rgba(120,83,9,.10),
                inset 0 1px 0 #ffffff;
    position: relative; overflow: hidden;
  }
  .disbursement-section::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
    background: linear-gradient(90deg, transparent 0%, #d97706 25%,
      #f59e0b 50%, #d97706 75%, transparent 100%);
  }
  .disb-heading {
    margin: 4px 0 22px; color: #92400e; font-size: 20px;
    font-weight: 700; text-align: center; text-transform: uppercase;
    letter-spacing: .14em;
    position: relative; z-index: 1;
  }
  .disb-header-band {
    display: grid; grid-template-columns: 1fr 1fr 1.4fr;
    gap: 16px; margin-bottom: 20px; padding: 18px 20px;
    background: #ffffff;
    border: 2px solid #d97706;
    border-radius: var(--r-md);
    position: relative; z-index: 1;
  }
  .disb-header-field { display: flex; flex-direction: column; gap: 5px; }
  .disb-header-field label {
    font-size: 10px; font-weight: 700; color: #92400e;
    text-transform: uppercase; letter-spacing: .14em;
  }
  .disb-header-field input {
    padding: 9px 12px; border: 1px solid #cbd5e1;
    border-radius: var(--r-sm); font-size: 13px; font-family: inherit;
    background: #ffffff; color: #0f172a;
    transition: border-color 140ms, box-shadow 140ms;
  }
  .disb-header-field input:focus {
    outline: none; border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(245,158,11,.25);
  }
  .disb-header-field input[readonly] {
    background: #fef3c7; color: #92400e;
    cursor: not-allowed; border-style: dashed;
    border-color: #f0c66b; font-weight: 600;
    font-family: var(--ff-mono);
  }

  #disbursementTable {
    width: 100%; border-collapse: separate; border-spacing: 0;
    font-size: 13px; border: 2px solid #92400e;
    border-radius: var(--r-md); overflow: hidden;
    background: #ffffff;
    position: relative; z-index: 1;
  }
  #disbursementTable thead th {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff; padding: 12px 10px; text-align: left;
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .14em; border-bottom: 2px solid #b45309;
    white-space: nowrap;
  }
  #disbursementTable td {
    border-bottom: 1px solid #e6d3a8; padding: 2px 10px;
    color: #1e293b;
  }
  #disbursementTable tbody tr:last-child td { border-bottom: none; }
  #disbursementTable tbody tr:nth-child(even) { background: #fffdf6; }
  #disbursementTable tbody tr:hover { background: #fef3c7; box-shadow: inset 3px 0 0 #d97706; }
  #disbursementTable td input {
    width: 100%; border: none; background: transparent;
    padding: 9px 4px; font-size: 13px; font-family: inherit;
    color: #0f172a; outline: none; border-radius: var(--r-xs);
    transition: background 120ms, box-shadow 120ms;
  }
  #disbursementTable td input:focus {
    background: #fef3c7; box-shadow: inset 0 0 0 1px #d97706;
  }
  #disbursementTable td.date {
    text-align: center; color: #64748b;
    font-family: var(--ff-mono); font-size: 12px;
  }
  #disbursementTable td.amount {
    text-align: right; font-variant-numeric: tabular-nums;
    font-family: var(--ff-mono); font-size: 12px;
    color: #92400e; font-weight: 600; padding-right: 12px;
  }
  #disbursementTable td.calc {
    text-align: right; font-variant-numeric: tabular-nums;
    font-family: var(--ff-mono); font-size: 12px;
    color: #b91c1c; font-weight: 600; padding-right: 12px;
  }
  .disb-total-row { background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%); }
  .disb-total-row td { border-top: 2px solid #d97706; padding: 14px 12px; }
  .disb-total-label {
    text-align: right; font-weight: 700; color: #92400e;
    font-size: 10px; text-transform: uppercase; letter-spacing: .16em;
  }
  .disb-total-amount {
    text-align: right; font-weight: 700; color: #92400e;
    font-size: 15px; font-variant-numeric: tabular-nums;
    font-family: var(--ff-mono);
  }
  .disb-total-remaining {
    text-align: right; font-weight: 700; color: #b91c1c;
    font-size: 15px; font-variant-numeric: tabular-nums;
    font-family: var(--ff-mono);
  }
  .disb-toolbar {
    margin-top: 18px; display: flex; gap: 10px; align-items: center;
    position: relative; z-index: 1;
  }

  .auto-filled { animation: flashFill 700ms ease; }
  @keyframes flashFill {
    0% { background: var(--accent-dim); box-shadow: inset 0 0 0 1px var(--accent); }
    100% { background: transparent; box-shadow: none; }
  }

  .print-header, .print-footer { display: none; }

  /* ============================================================
     AUTH SCREENS — UNTOUCHED (DARK)
     ============================================================ */
  .auth-wrap {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background: rgba(10, 16, 26, 0.55);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
  }
  .auth-wrap.hidden { display: none !important; }

  .auth-card {
    width: 100%; max-width: 420px;
    background: linear-gradient(180deg, rgba(58,71,92,.95) 0%, rgba(45,56,74,.97) 100%);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: var(--r-lg);
    padding: 34px 32px 30px;
    display: flex; flex-direction: column; gap: 14px;
    box-shadow: 0 28px 64px rgba(0,0,0,.38), 0 8px 20px rgba(0,0,0,.22),
                inset 0 1px 0 rgba(255,255,255,.08),
                0 0 0 1px rgba(45,212,191,.16),
                0 0 90px rgba(45,212,191,.18);
    position: relative; overflow: hidden;
  }
  .auth-card::before {
    content: ""; position: absolute; top: 0; left: 24px; right: 24px; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(94,234,212,.75), transparent);
  }
  .auth-card h1 {
    font-size: 22px; margin: 0 0 2px; text-align: center;
    letter-spacing: -0.02em; color: #fff;
    text-shadow: 0 0 24px rgba(45,212,191,.55), 0 2px 4px rgba(0,0,0,.35);
  }
  .auth-card .eyebrow {
    text-align: center; font-size: 10px; letter-spacing: .22em;
    text-transform: uppercase; color: #5eead4;
    font-weight: 700; margin-bottom: 8px;
    text-shadow: 0 0 14px rgba(45,212,191,.42);
  }
  .auth-card p.subtitle {
    font-size: 12px; letter-spacing: .02em; text-transform: none;
    color: #c5d0e0; margin: 0 0 6px; font-weight: 500;
    text-align: center; text-shadow: none;
  }
  .auth-card .field {
    display: flex; flex-direction: column; gap: 5px;
  }
  .auth-card .field label {
    font-size: 10px; font-weight: 700; letter-spacing: .14em;
    text-transform: uppercase; color: #97a5bb;
  }
  .auth-card .field input {
    padding: 10px 12px; font-size: 13px;
    background: rgba(20,28,40,.65);
    border: 1px solid #5a6a82;
    border-radius: var(--r-sm);
    color: #f4f7fb; font-family: inherit;
    transition: border-color 140ms, box-shadow 140ms, background 140ms;
  }
  .auth-card .field input:focus {
    outline: none; border-color: #2dd4bf;
    background: rgba(20,28,40,.9);
    box-shadow: 0 0 0 3px rgba(45,212,191,.42), inset 0 0 0 1px rgba(45,212,191,.16);
  }
  .auth-card button.primary {
    margin-top: 4px;
    padding: 11px 18px;
    background: linear-gradient(180deg, #2dd4bf 0%, #14b8a6 100%);
    color: #06231f; border: 1px solid #14b8a6;
    border-radius: var(--r-sm); font-weight: 700; font-size: 13px;
    cursor: pointer; font-family: inherit;
    transition: background 140ms, box-shadow 140ms, transform 80ms;
  }
  .auth-card button.primary:hover {
    background: linear-gradient(180deg, #5eead4 0%, #2dd4bf 100%);
  }
  .auth-card button.primary:active { transform: translateY(1px); }
  .auth-card button.primary:disabled { opacity: .55; cursor: not-allowed; }
  .auth-card .link-btn {
    background: none; border: none; color: #5eead4;
    text-decoration: underline; padding: 6px 0; font-size: 12px;
    cursor: pointer; font-family: inherit; align-self: center;
    box-shadow: none;
  }
  .auth-card .link-btn:hover { color: #fff; }
  .auth-error {
    font-size: 12px; color: #fca5a5; margin: 0;
    padding: 8px 12px; border-radius: var(--r-sm);
    background: rgba(248,113,113,.10);
    border: 1px solid rgba(248,113,113,.35);
  }
  .auth-error.hidden { display: none; }
  .auth-hint {
    font-size: 11px; color: #97a5bb; text-align: center;
    margin: 4px 0 0; letter-spacing: .02em;
  }

  /* ============================================================
     MODAL
     ============================================================ */
  .modal-overlay {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(10, 16, 26, 0.55);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
  }
  .modal-overlay.hidden { display: none !important; }
  .modal {
    width: 100%; max-width: 620px; max-height: 84vh; overflow-y: auto;
    background: linear-gradient(180deg, rgba(58,71,92,.97) 0%, rgba(45,56,74,.98) 100%);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: var(--r-lg);
    padding: 26px 26px 22px;
    box-shadow: 0 28px 64px rgba(0,0,0,.38), 0 8px 20px rgba(0,0,0,.22),
                inset 0 1px 0 rgba(255,255,255,.08),
                0 0 0 1px rgba(45,212,191,.16),
                0 0 90px rgba(45,212,191,.18);
    position: relative;
  }
  .modal::before {
    content: ""; position: absolute; top: 0; left: 24px; right: 24px; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(94,234,212,.7), transparent);
  }
  .modal h3 {
    margin: 0 0 6px; font-size: 17px; letter-spacing: -0.01em;
    color: #f4f7fb;
  }
  .modal .modal-sub {
    font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
    color: #5eead4; font-weight: 700; margin-bottom: 14px;
  }
  .modal .row-actions {
    display: flex; justify-content: flex-end; gap: 10px;
    margin-top: 18px; padding-top: 16px;
    border-top: 1px solid #4a5870;
  }
  .modal .row-actions button { padding: 9px 16px; font-size: 12px; }

  .user-row, .audit-row {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; padding: 12px 14px; margin-bottom: 8px;
    background: rgba(20,28,40,.55);
    border: 1px solid #4a5870;
    border-radius: var(--r-sm);
  }
  .user-row .u-meta, .audit-row .a-meta {
    display: flex; flex-direction: column; gap: 2px; min-width: 0;
  }
  .user-row .u-name, .audit-row .a-id {
    font-weight: 600; color: #f4f7fb; font-size: 13px;
  }
  .user-row .u-role, .audit-row .a-sub {
    font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
    color: #97a5bb;
  }
  .user-row .u-role.admin, .audit-row .a-owner-admin {
    color: #fbbf24;
  }
  .user-row .u-actions, .audit-row .a-actions {
    display: flex; gap: 6px; flex-shrink: 0;
  }
  .user-row .u-actions button, .audit-row .a-actions button {
    padding: 6px 10px; font-size: 11px;
  }
  .user-row .tag {
    display: inline-block; padding: 2px 7px; border-radius: 999px;
    font-size: 9px; letter-spacing: .12em; text-transform: uppercase;
    margin-left: 6px;
  }
  .tag.pending {
    background: rgba(245,158,11,.16); color: #fbbf24;
    border: 1px solid rgba(245,158,11,.45);
  }
  .tag.owner {
    background: rgba(45,212,191,.16); color: #5eead4;
    border: 1px solid rgba(45,212,191,.35);
  }
  .tag.disabled {
    background: rgba(148,163,184,.18); color: #cbd5e1;
    border: 1px solid rgba(148,163,184,.45);
  }
  .audit-scroll { max-height: 340px; overflow-y: auto; padding-right: 4px; }
  .empty-note {
    text-align: center; color: #97a5bb; font-size: 12px;
    padding: 18px 8px; font-style: italic;
  }
  .modal input, .modal select {
    width: 100%; padding: 10px 12px;
    background: rgba(20,28,40,.65);
    border: 1px solid #5a6a82;
    border-radius: 6px; color: #f4f7fb;
    font-family: inherit; font-size: 13px;
  }
  .modal input:focus, .modal select:focus {
    outline: none; border-color: #2dd4bf;
    box-shadow: 0 0 0 3px rgba(45,212,191,.42);
  }
  .modal label { color: #97a5bb; }
  .modal .auth-hint { color: #97a5bb; }
  .modal .auth-error { color: #fca5a5; }

  /* ============================================================
     RESPONSIVE
     ============================================================ */
  @media (max-width: 900px) {
    body { padding: 20px 10px 40px; }
    .container { padding: 22px 16px; }
    .header-grid { grid-template-columns: 1fr; gap: 10px; }
    .header-grid .field label { min-width: 120px; font-size: 10px; }
    .search-bar { margin-left: 0; width: 100%; }
    .search-bar input { width: 100%; }
    .disb-header-band { grid-template-columns: 1fr; }
    h1 { font-size: 22px; }
    .topbar { flex-direction: column; align-items: flex-start; }
    .topbar .user-chip { width: 100%; justify-content: space-between; }
  }

  /* ============================================================
     PRINT - A4 LANDSCAPE LEDGER CARD
     ============================================================ */
  @media print {
    /* DO NOT PRINT SYSTEM WARNINGS / POP-UPS / MESSAGES */
.alert,
.warning,
.error,
.toast,
.notification,
.popup,
.modal-overlay,
.modal,
.status,
.record-info,
.unlock-note,
.admin-banner,
.auth-error,
.auth-hint {
  display: none !important;
  visibility: hidden !important;
}
    @page {
      size: A4 landscape;
      margin: 6mm;
    }

    html, body {
      width: 297mm;
      min-height: 210mm;
      margin: 0 !important;
      padding: 0 !important;
      background: #fff !important;
      color: #000 !important;
      font-size: 9px;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }

    body * { visibility: hidden; }
    .container, .container * { visibility: visible; }

    .topbar, .top-search, .toolbar, .search-bar, .status, .record-info,
    .unlock-note, .print-btn, button, .disb-toolbar, .admin-banner,
    .auth-wrap, .modal-overlay, .no-print {
      display: none !important;
    }

    tbody tr.empty-row { display: none !important; }
    body::before, body::after { display: none !important; animation: none !important; }

    .container {
      position: absolute;
      left: 0;
      top: 0;
      width: 285mm !important;
      max-width: 285mm !important;
      margin: 0 !important;
      padding: 0 !important;
      box-sizing: border-box;
      box-shadow: none !important;
      border: none !important;
      border-radius: 0 !important;
      background: #fff !important;
    }

    .container::before { display: none !important; }

    .print-header {
      display: block !important;
      text-align: right;
      margin: 0 0 2mm 0;
      font-size: 7.5px;
      line-height: 1.1;
      color: #333 !important;
    }

    h1 {
      margin: 0 0 0.8mm 0 !important;
      font-size: 14px !important;
      line-height: 1.05;
      text-align: center;
      color: #000 !important;
    }

    .subtitle {
      margin: 0 0 2mm 0 !important;
      font-size: 8px !important;
      line-height: 1.05;
      text-align: center;
      color: #333 !important;
    }

    .header-grid {
      display: grid !important;
      grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
      gap: 1mm 3mm !important;
      margin: 0 0 2mm 0 !important;
      padding: 2mm 2.5mm !important;
      border: 1px solid #555 !important;
      border-radius: 0 !important;
      background: #fff !important;
      box-shadow: none !important;
      break-inside: avoid;
      page-break-inside: avoid;
    }

    .header-grid .field {
      min-width: 0 !important;
      gap: 1mm !important;
      align-items: center;
    }

    .header-grid .field label {
      min-width: 0 !important;
      width: auto !important;
      font-size: 7.2px !important;
      line-height: 1.05;
      white-space: nowrap;
      color: #000 !important;
    }

    .header-grid .field input {
      min-width: 0 !important;
      width: 100% !important;
      height: 4.5mm !important;
      padding: 0 1mm !important;
      border: none !important;
      border-bottom: 1px dotted #666 !important;
      border-radius: 0 !important;
      background: transparent !important;
      color: #000 !important;
      box-shadow: none !important;
      font-size: 8px !important;
      line-height: 1;
      box-sizing: border-box;
    }

    #ledgerTable {
      width: 100% !important;
      max-width: 100% !important;
      table-layout: fixed !important;
      border-collapse: collapse !important;
      border-spacing: 0 !important;
      border: 1px solid #000 !important;
      border-radius: 0 !important;
      background: #fff !important;
      font-size: 7px !important;
    }

    #ledgerTable thead { display: table-header-group; }
    #ledgerTable tfoot { display: table-row-group; }
    #ledgerTable tr {
      break-inside: avoid;
      page-break-inside: avoid;
    }

    #ledgerTable th {
      padding: 1.2mm 0.7mm !important;
      border: 1px solid #000 !important;
      background: #16365c !important;
      color: #fff !important;
      font-size: 6.6px !important;
      line-height: 1.05 !important;
      text-align: center !important;
      vertical-align: middle !important;
      white-space: normal !important;
      overflow-wrap: anywhere;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }

    #ledgerTable td {
      height: 5.2mm !important;
      padding: 0.7mm 0.6mm !important;
      border: 1px solid #777 !important;
      font-size: 6.8px !important;
      line-height: 1.05 !important;
      vertical-align: middle !important;
      color: #000 !important;
      background: #fff !important;
      overflow: hidden;
    }

    #ledgerTable td input {
      width: 100% !important;
      min-width: 0 !important;
      padding: 0 !important;
      margin: 0 !important;
      border: none !important;
      background: transparent !important;
      color: #000 !important;
      box-shadow: none !important;
      font-size: 6.8px !important;
      line-height: 1 !important;
    }

    #ledgerTable td.calc,
    #ledgerTable td.penalty,
    #ledgerTable td.date,
    #ledgerTable td.dr {
      color: #000 !important;
      background: transparent !important;
    }

    /* Balanced column widths for the 10-column ledger on A4 landscape */
    #ledgerTable th:nth-child(1), #ledgerTable td:nth-child(1) { width: 8%; }
    #ledgerTable th:nth-child(2), #ledgerTable td:nth-child(2) { width: 8%; }
    #ledgerTable th:nth-child(3), #ledgerTable td:nth-child(3) { width: 8%; }
    #ledgerTable th:nth-child(4), #ledgerTable td:nth-child(4) { width: 10%; }
    #ledgerTable th:nth-child(5), #ledgerTable td:nth-child(5) { width: 12%; }
    #ledgerTable th:nth-child(6), #ledgerTable td:nth-child(6) { width: 5%; }
    #ledgerTable th:nth-child(7), #ledgerTable td:nth-child(7) { width: 11%; }
    #ledgerTable th:nth-child(8), #ledgerTable td:nth-child(8) { width: 5%; }
    #ledgerTable th:nth-child(9), #ledgerTable td:nth-child(9) { width: 20%; }
    #ledgerTable th:nth-child(10), #ledgerTable td:nth-child(10) { width: 13%; }

    #ledgerCompletionSummary td {
      font-size: 6.8px !important;
      font-weight: 700;
    }

    .print-footer {
      display: block !important;
      margin-top: 2mm !important;
      padding-top: 1mm !important;
      border-top: 1px solid #999 !important;
      text-align: center;
      font-size: 7px !important;
      line-height: 1;
      color: #333 !important;
    }

    /* Keep the disbursement card printable without forcing it onto the ledger page. */
    .disbursement-section {
      break-before: page;
      page-break-before: always;
    }

    .disb-heading { color: #000 !important; }
    .disb-header-band, #disbursementTable {
      background: #fff !important;
      color: #000 !important;
    }
    #disbursementTable {
      width: 100% !important;
      table-layout: fixed;
      border-collapse: collapse !important;
      border: 1px solid #000 !important;
    }
    #disbursementTable thead th {
      background: #7a4a00 !important;
      color: #fff !important;
      font-size: 8px !important;
      padding: 1mm !important;
      border: 1px solid #000 !important;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
    #disbursementTable td {
      padding: 1mm !important;
      font-size: 8px !important;
      border: 1px solid #666 !important;
      color: #000 !important;
    }
    #disbursementTable td input {
      border: none !important;
      background: transparent !important;
      color: #000 !important;
      box-shadow: none !important;
    }
    .disb-total-row {
      background: #f4f4f4 !important;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
    .disb-total-label, .disb-total-amount, .disb-total-remaining {
      color: #000 !important;
    }
  }
/* =========================
   TOP SEARCH BOX
   ========================= */

.top-search {
  display: flex;
  justify-content: flex-end;
  margin: 14px 0 18px;
}

.top-search .search-bar {
  margin-left: 0;
}

/* =========================
   DR 240 COMPLETION SUMMARY
   ========================= */

#ledgerCompletionSummary.hidden {
  display: none;
}

.ledger-completion-row td {
  border-top: 2px solid var(--accent);
  background: #f0fdfa;
  font-weight: 800;
}

.ledger-completion-row .completion-label {
  text-align: right;
  color: var(--accent-hi);
  letter-spacing: 0.03em;
}

.ledger-completion-row .completion-value {
  text-align: right;
  color: var(--tx-hi);
  font-family: var(--ff-mono);
}

.ledger-completion-row .completion-penalty-label {
  color: var(--danger-hi);
}


/* =========================
   MOBILE SEARCH BOX
   ========================= */

@media (max-width: 900px) {
  .top-search {
    justify-content: stretch;
  }

  .top-search .search-bar {
    margin-left: 0;
    width: 100%;
  }

  .top-search .search-bar input {
    width: 100%;
  }
}

/* ======================================================================
   VILLAGE GROUPING INTEGRATION — SHHA LEDGER (11 OCT 2026)
   Merged into the original styles(2).css stylesheet.
   Scope: village dropdowns, admin management, record/report filters,
   responsive four-field Disbursement Card header and matching print view.
   All original theme tokens, ledger rules and print styles are retained.
   ====================================================================== */

/* The application's JavaScript already uses this shared visibility class.
   It was not defined in the supplied base stylesheet. */
.hidden,
[hidden] { display: none !important; }

/* Make newly registered village dropdowns match the Ledger Card inputs.
   Also covers the existing Loan Type and Payment Method dropdowns. */
.header-grid .field select {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-med);
  border-radius: var(--r-sm);
  background: #ffffff;
  color: var(--tx-hi);
  font: inherit;
  font-size: 13px;
  transition: border-color 140ms, box-shadow 140ms, background 140ms;
}
.header-grid .field select:hover { border-color: var(--line-strong); }
.header-grid .field select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.header-grid .field select:disabled,
.header-grid .field select.admin-locked {
  background: #f1f5f9 !important;
  color: var(--tx-mid) !important;
  border-color: var(--line-soft) !important;
  cursor: not-allowed;
}

/* Six header fields: Loan Type and Account Number first; 3 columns x 2 rows. */
.disb-header-band {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.disb-header-field { min-width: 0; }
.disb-header-field select {
  display: block;
  min-width: 0;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-med);
  border-radius: var(--r-sm);
  background: #ffffff;
  color: var(--tx-hi);
  font: inherit;
  font-size: 13px;
  transition: border-color 140ms, box-shadow 140ms;
}
.disb-header-field select:focus-visible {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .25);
}
.disb-header-field select:disabled,
.disb-header-field select.admin-locked {
  background: #fef3c7 !important;
  color: #92400e !important;
  border: 1px dashed #f0c66b !important;
  cursor: not-allowed;
}

/* The Records and Reports village selectors inherit the dark modal style.
   Long labels should stay above the dropdown rather than squeezing it. */
#modalAudit .field:has(> #recordsVillageFilter),
#modalCustomerReport .field:has(> #reportVillageFilter),
#modalAssignVillage .field:has(> #assignVillageSelect) {
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
}
#recordsVillageFilter,
#reportVillageFilter,
#assignVillageSelect {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
#modalAudit .field:has(> #recordsVillageFilter) label,
#modalCustomerReport .field:has(> #reportVillageFilter) label,
#modalAssignVillage .field:has(> #assignVillageSelect) label {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .03em;
}
.modal select option {
  background: #243247;
  color: #f4f7fb;
}

/* Village manager: the existing audit-row component has a dark background.
   Its plain-text village name must be light enough to read. */
#modalVillages .modal,
#modalAssignVillage .modal { max-width: 650px; }
#modalVillages .search-bar {
  width: 100%;
  margin-left: 0;
  min-width: 0;
  border-color: #5a6a82;
}
#modalVillages .search-bar input {
  width: auto;
  flex: 1;
  min-width: 0;
}
#modalVillages .search-bar button { flex-shrink: 0; }
#villageManagerList { margin-top: 12px; }
#villageManagerList .audit-row {
  color: #f4f7fb;
  text-align: left;
  overflow-wrap: anywhere;
}
#villageManagerList .audit-row > :first-child {
  min-width: 0;
  flex: 1;
}
#villageManagerList .audit-row button { flex-shrink: 0; }
#villageManagerList .empty-note { line-height: 1.5; }
#villageManagerStatus,
#assignVillageStatus {
  min-height: 1.25em;
  color: #c5d0e0;
  font-size: 12px;
  overflow-wrap: anywhere;
}
#assignVillageCustomer { overflow-wrap: anywhere; }

/* All Villages list is grouped by the existing Records JavaScript.
   Keep headings readable without changing the backend or row markup. */
#auditList > .empty-note { line-height: 1.4; }

@media (max-width: 1200px) and (min-width: 901px) {
  .disb-header-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .disb-header-band { grid-template-columns: 1fr; }
  .header-grid .field select { width: 100%; }
  #modalVillages .search-bar { flex-wrap: wrap; }
  #modalVillages .search-bar input { flex-basis: 100%; }
  #modalVillages .search-bar button { width: 100%; }
}

/* The original A4 landscape rules apply to input fields. Extend the same
   print treatment to the new Village dropdowns on both cards. */
@media print {
  #modalVillages, #modalAssignVillage { display: none !important; }
  .header-grid .field select {
    min-width: 0 !important;
    width: 100% !important;
    height: 4.5mm !important;
    padding: 0 1mm !important;
    border: none !important;
    border-bottom: 1px dotted #666 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    font-size: 8px !important;
    line-height: 1 !important;
    appearance: none;
  }
  .disb-header-band {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  .disb-header-field select {
    display: block;
    min-width: 0 !important;
    width: 100% !important;
    padding: 1mm !important;
    border: none !important;
    border-bottom: 1px dotted #666 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    appearance: none;
    font-size: 8px !important;
  }
}

/* ======================================================================
   PRINT: hide payment-entry controls (moved from Index.html <head>)
   ====================================================================== */
@media print {
  #paymentMade, #paymentTransactionDate, #paymentTransactionAmount,
  #recordPaymentBtn { display: none !important; }
  .header-grid > .field:has(#paymentMade),
  .header-grid > .field:has(#paymentTransactionDate),
  .header-grid > .field:has(#paymentTransactionAmount),
  .header-grid > .field:has(#recordPaymentBtn) { display: none !important; }
  .topup-banner, #modalTopUp, #screen-system-control, .maintenance-notice { display: none !important; }
}

/* ======================================================================
   MAINTENANCE NOTICE (login screen)
   ====================================================================== */
.maintenance-notice {
  box-sizing: border-box; width: min(96vw, 900px); margin: 24px auto;
  padding: 36px 28px; text-align: center;
  background: #fff4e5; border: 6px solid #e65100; border-radius: 16px;
  color: #7a2e00; box-shadow: 0 8px 32px rgba(230,81,0,.35);
  font-family: system-ui, sans-serif;
}
.maintenance-notice .mn-sign  { font-size: 96px; line-height: 1; margin-bottom: 12px; }
.maintenance-notice .mn-title { font-size: 40px; font-weight: 800; letter-spacing: 1px; margin-bottom: 16px; }
.maintenance-notice .mn-text  { font-size: 26px; font-weight: 600; line-height: 1.35; margin-bottom: 14px; }
.maintenance-notice .mn-sub   { font-size: 18px; }
@media (max-width: 600px) {
  .maintenance-notice .mn-sign  { font-size: 64px; }
  .maintenance-notice .mn-title { font-size: 28px; }
  .maintenance-notice .mn-text  { font-size: 20px; }
}

/* ======================================================================
   SYSTEM CONTROL SCREEN (System Operator / first Primary Administrator)
   ====================================================================== */
.sysctl-screen {
  position: fixed; inset: 0; z-index: 9999; padding: 16px;
  display: flex; align-items: flex-start; justify-content: center; overflow: auto;
  background: #f4f6f8; font-family: system-ui, sans-serif; color: #111;
}
.sysctl-card {
  background: #fff; max-width: 460px; width: 100%; margin: auto; padding: 28px;
  border-radius: 10px; box-shadow: 0 4px 24px rgba(0,0,0,.12);
}
.sysctl-card.wide { max-width: 980px; }
.sysctl-card h2 { margin: 0 0 4px; }
.sysctl-user  { color: #667; margin-bottom: 18px; }
.sysctl-state { font-weight: 600; padding: 12px; border-radius: 8px; margin-bottom: 14px; }
.sysctl-state.is-down { background: #fdecea; color: #b00020; }
.sysctl-state.is-up   { background: #e8f5e9; color: #1b5e20; }
.sysctl-label { display: block; font-size: 13px; color: #445; margin-bottom: 4px; }
.sysctl-input {
  width: 100%; box-sizing: border-box; padding: 8px; margin-bottom: 14px;
  border: 1px solid #ccd; border-radius: 6px;
}
.sysctl-actions { display: flex; gap: 10px; }
.sysctl-toggle {
  flex: 1; padding: 11px; border: 0; border-radius: 6px; color: #fff; font-weight: 600;
}
.sysctl-toggle.is-down { background: #2e7d32 !important; border-color: #2e7d32 !important; }
.sysctl-toggle.is-up   { background: #c62828 !important; border-color: #c62828 !important; }
.sysctl-logout { padding: 11px 16px; border: 1px solid #ccd !important; border-radius: 6px; background: #fff !important; color: #111 !important; font-weight: 500; }
.sysctl-error { color: #b00020; margin-top: 12px; }
.sysctl-note  { color: #778; font-size: 12px; margin-top: 16px; }

/* First Primary Administrator panels (built by app.js) */
.sys-section { margin-top: 22px; padding-top: 16px; border-top: 1px solid #e3e6ea; }
.sys-h3 { margin: 0 0 10px; }
.sys-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sys-input { padding: 8px; border: 1px solid #ccd; border-radius: 6px; background: #fff; color: #111; }
.sys-input-wide { min-width: 230px; }
.sys-btn { padding: 6px 10px; border: 1px solid #ccd !important; border-radius: 6px; background: #fff !important; color: #111 !important; font-weight: 500; cursor: pointer; }
.sys-btn-ml { margin-left: 6px; }
.sys-btn-danger { color: #b00020 !important; }
.sys-btn-solid { padding: 8px 14px; border: 0 !important; border-radius: 6px; color: #fff !important; cursor: pointer; }
.sys-btn-blue  { background: #1565c0 !important; }
.sys-btn-slate { background: #455a64 !important; }
.sys-msg { margin: 8px 0; font-size: 13px; }
.sys-msg.ok  { color: #1b5e20; }
.sys-msg.err { color: #b00020; }
.sys-scroll { margin-top: 8px; overflow: auto; }
.sys-scroll.tall { max-height: 420px; }
.sys-table { width: 100%; border-collapse: collapse; font-size: 13px; border: 0; border-radius: 0; background: transparent; }
.sys-table.small { font-size: 12px; }
.sys-th { text-align: left; padding: 6px; border-bottom: 1px solid #e3e6ea; background: #fff; color: #111; letter-spacing: 0; text-transform: none; font-size: inherit; }
.sys-th.sticky { padding: 5px; position: sticky; top: 0; }
.sys-td { padding: 6px; }
.sys-td.audit { padding: 5px; border-bottom: 1px solid #f0f2f4; vertical-align: top; }
.sys-nowrap { white-space: nowrap; }
.sys-muted { color: #667; }

/* ======================================================================
   RECORDS / ACTIVITY LOG HELPERS (previously inline in app.js)
   ====================================================================== */
.empty-note.error { color: #fca5a5; font-style: normal; }
.empty-note.village-heading {
  font-weight: 700; padding: 10px 5px; border-bottom: 1px solid #8996aa;
  text-align: left; font-style: normal; color: #f4f7fb;
}
.audit-row .a-ok     { color: #5eead4; }
.audit-row .a-bad    { color: #fca5a5; }
.audit-row .a-target { color: #c5d0e0; }
.a-sub.dim { opacity: .75; }

/* ======================================================================
   TOP-UP LOAN CARD (Accounts only)
   ====================================================================== */
.topup-banner {
  margin: 8px 0 16px; padding: 10px 14px; border-radius: var(--r-md);
  background: #fff7e0; border: 1px solid #e0b100; border-left: 4px solid #d97706;
  color: #5c4400; font-weight: 600; font-size: 12px;
}
#modalTopUp { z-index: 10000; }
#modalTopUp .modal { max-width: 460px; }
.topup-help { color: #c5d0e0; font-size: 12px; margin: 0 0 14px; }
.topup-field { flex-direction: column; align-items: stretch; gap: 5px; margin-bottom: 12px; }
.topup-field label { font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.topup-preview {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; margin: 0 0 12px;
  padding: 12px 14px; border-radius: var(--r-md);
  background: rgba(20,28,40,.55); border: 1px solid #4a5870; color: #f4f7fb; font-size: 13px;
}
.topup-preview dt { color: #97a5bb; margin: 0; }
.topup-preview dd { margin: 0; font-weight: 700; text-align: right; font-family: var(--ff-mono); }
#tuErr:empty { display: none; }


/* Stack the maintenance notice above the sign-in card instead of beside it. */
#screen-login { flex-direction: column; gap: 16px; overflow-y: auto; }
#screen-login .maintenance-notice { flex-shrink: 0; margin: 0 auto; }
