:root {
  --ink: #172326;
  --muted: #6c7778;
  --line: #e6e8e4;
  --canvas: #f7f8f5;
  --paper: #ffffff;
  --soft: #eff5ef;
  --teal: #0f766e;
  --teal-deep: #075a54;
  --teal-soft: #dff4ed;
  --gold: #b7791f;
  --gold-soft: #fff4d8;
  --red: #b63a3a;
  --red-soft: #fff0ef;
  --shadow: 0 18px 50px rgba(25, 53, 49, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { display: grid; grid-template-columns: 258px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px 14px;
  border-right: 1px solid var(--line); background: var(--paper); display: flex; flex-direction: column; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 3px 8px; min-width: 0; }
.logo-button {
  width: 42px; height: 42px; flex: 0 0 auto; border: 0; border-radius: 13px; color: #fff;
  background: linear-gradient(135deg, #137c73, #075a54); font-family: Georgia, serif; font-size: 19px; font-weight: bold;
  display: grid; place-items: center; overflow: hidden; box-shadow: 0 6px 16px rgba(15,118,110,.22);
}
.logo-button img { height: 100%; width: 100%; object-fit: cover; }
.brand-name { font-family: Georgia, 'Times New Roman', serif; font-weight: 700; font-size: 16px; letter-spacing: .1px; white-space: nowrap; }
.brand-subtitle { margin-top: 2px; color: var(--muted); font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-section { padding: 0 11px; margin: 6px 0 4px; color: #98a09d; font-size: 10px; letter-spacing: .12em; font-weight: 800; text-transform: uppercase; }
.nav-item {
  border: 0; background: transparent; text-align: left; color: #51605d; border-radius: 10px; padding: 10px 11px;
  display: flex; align-items: center; gap: 11px; font-weight: 600; transition: .16s ease;
}
.nav-item:hover { color: var(--teal); background: #f2f8f6; }
.nav-item.active { color: var(--teal-deep); background: var(--teal-soft); }
.nav-icon { width: 18px; height: 18px; display: grid; place-items: center; color: currentColor; }
.nav-icon svg { width: 18px; height: 18px; stroke-width: 1.9; }
.sidebar-footer { margin-top: auto; padding: 14px 11px; color: var(--muted); border-top: 1px solid var(--line); font-size: 11px; line-height: 1.45; }
.sidebar-footer strong { display: block; color: var(--ink); margin-bottom: 2px; font-size: 12px; }

.main { min-width: 0; padding: 0 34px 42px; }
.topbar { height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.page-eyebrow { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
h1 { margin: 0; font-family: Georgia, 'Times New Roman', serif; font-size: 27px; letter-spacing: -.025em; font-weight: 600; }
.top-actions { display: flex; gap: 9px; align-items: center; }
.icon-button, .button {
  min-height: 38px; border: 1px solid var(--line); color: #42514d; background: var(--paper); border-radius: 10px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; transition: .16s ease;
}
.icon-button { width: 38px; padding: 0; }
.icon-button:hover, .button:hover { border-color: #b4c5bf; transform: translateY(-1px); }
.button.primary { background: var(--teal); border-color: var(--teal); color: #fff; box-shadow: 0 6px 15px rgba(15,118,110,.18); }
.button.primary:hover { background: var(--teal-deep); }
.button.danger { color: var(--red); border-color: #efc2be; background: #fffafa; }
.button.compact { min-height: 32px; border-radius: 8px; padding: 0 10px; font-size: 12px; }
.button svg, .icon-button svg { width: 17px; height: 17px; }

.content { animation: enter .25s ease; }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 2px 4px rgba(0,0,0,.015); min-width: 0; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-weight: 650; font-size: 12px; }
.stat-icon { width: 30px; height: 30px; background: var(--soft); color: var(--teal); border-radius: 9px; display: grid; place-items: center; }
.stat-icon svg { width: 16px; height: 16px; }
.stat-value { font-family: Georgia, 'Times New Roman', serif; font-size: 26px; letter-spacing: -.03em; margin-top: 13px; white-space: nowrap; }
.stat-note { color: var(--muted); margin-top: 4px; font-size: 11px; }
.positive { color: var(--teal); } .warning { color: var(--gold); } .negative { color: var(--red); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.44fr) minmax(300px, .8fr); gap: 16px; margin-top: 16px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 4px rgba(0,0,0,.015); }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 19px 20px 15px; }
.card-title { font-family: Georgia, 'Times New Roman', serif; margin: 0; font-size: 18px; font-weight: 600; }
.card-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.card-body { padding: 0 20px 20px; }
.summary-bar { height: 10px; display: flex; border-radius: 99px; overflow: hidden; background: #edf0ed; margin: 19px 0 15px; }
.summary-bar .collected { background: #149286; } .summary-bar .pending { background: #e8bb5a; }
.mini-legend { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.day-list { display: flex; flex-direction: column; gap: 3px; }
.activity-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eff1ef; }
.activity-row:last-child { border-bottom: 0; }
.member-avatar { width: 31px; height: 31px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--teal-deep); background: #e6f2eb; }
.activity-left { min-width: 0; display: flex; align-items: center; gap: 9px; }
.activity-name { font-weight: 750; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-detail { color: var(--muted); font-size: 11px; margin-top: 2px; }
.activity-amount { color: var(--teal-deep); font-weight: 800; font-size: 13px; white-space: nowrap; }
.upcoming { display: grid; grid-template-columns: 49px 1fr auto; gap: 12px; align-items: center; background: #f4faf7; border: 1px solid #dcefe7; border-radius: 13px; padding: 13px; }
.date-badge { text-align: center; padding: 7px 5px; border-radius: 9px; background: var(--teal); color: #fff; }
.date-badge strong { display: block; font-size: 18px; line-height: 1; font-family: Georgia, serif; }.date-badge span { font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.upcoming-title { font-weight: 800; }.upcoming-copy { margin-top: 3px; color: var(--muted); font-size: 11px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 27px 0 13px; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-weight: 600; font-size: 20px; }.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.group-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.group-card { padding: 18px; position: relative; overflow: hidden; }.group-card::after { content: ''; position: absolute; right: -28px; top: -32px; width: 120px; height: 120px; border-radius: 50%; background: rgba(224,244,237,.6); }
.group-card-top, .group-card-main { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }.group-card-main { margin-top: 17px; }
.tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; background: var(--teal-soft); color: var(--teal-deep); font-size: 10px; font-weight: 800; }.tag.gold { background: var(--gold-soft); color: #95620f; }.tag.red { background: var(--red-soft); color: var(--red); }.tag.gray { background: #eef1ef; color: #687370; }
.group-name { font-family: Georgia, serif; font-size: 18px; font-weight: 600; }.group-type { margin-top: 3px; color: var(--muted); font-size: 12px; }.group-amount { font-family: Georgia, serif; font-size: 21px; }.progress-line { height: 6px; border-radius: 99px; overflow: hidden; background: #e7eeea; margin-top: 15px; }.progress-line span { display: block; height: 100%; border-radius: inherit; background: var(--teal); }.group-foot { position: relative; z-index: 1; margin-top: 8px; color: var(--muted); font-size: 11px; display: flex; justify-content: space-between; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 13px; margin-bottom: 16px; }.toolbar-left, .toolbar-right { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.select, .input, .textarea { border: 1px solid var(--line); color: var(--ink); background: var(--paper); border-radius: 9px; min-height: 38px; padding: 0 11px; outline: none; }.select:focus, .input:focus, .textarea:focus { border-color: #75a9a1; box-shadow: 0 0 0 3px rgba(19,124,115,.1); }.textarea { padding: 10px 11px; min-height: 90px; resize: vertical; width: 100%; }
.search-wrap { position: relative; }.search-wrap svg { position: absolute; left: 11px; top: 10px; width: 17px; color: #8c9692; }.search-wrap .input { width: 235px; padding-left: 34px; }
.table-card { overflow: hidden; }.table-wrap { overflow: auto; max-width: 100%; }.data-table { border-collapse: separate; border-spacing: 0; min-width: 690px; width: 100%; font-size: 12px; }.data-table th { color: #78827f; background: #fafbf9; font-size: 10px; text-transform: uppercase; letter-spacing: .075em; text-align: left; font-weight: 800; padding: 12px 13px; border-bottom: 1px solid var(--line); white-space: nowrap; }.data-table td { padding: 13px; border-bottom: 1px solid #eef0ed; vertical-align: middle; }.data-table tr:last-child td { border-bottom: 0; }.data-table tbody tr:hover td { background: #fcfdfb; }.row-action { padding: 5px; color: #7d8985; border: 0; background: transparent; border-radius: 7px; }.row-action:hover { color: var(--teal); background: var(--teal-soft); }
.register-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }.register { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 12px; }.register th { position: sticky; top: 0; background: #fbfcfa; z-index: 2; padding: 12px 9px; color: #697572; text-align: center; border-bottom: 1px solid var(--line); border-right: 1px solid #edf0ed; font-size: 10px; text-transform: uppercase; letter-spacing: .045em; }.register th:first-child { text-align: left; left: 0; z-index: 4; min-width: 205px; }.register td { padding: 6px; text-align: center; height: 58px; border-bottom: 1px solid #edf0ed; border-right: 1px solid #edf0ed; background: var(--paper); }.register td:first-child { position: sticky; left: 0; z-index: 1; text-align: left; padding: 9px 13px; min-width: 205px; }.register tr:last-child td { border-bottom: 0; }.register-member { font-weight: 800; }.register-phone { font-size: 10px; color: var(--muted); margin-top: 3px; }.pay-cell { width: 51px; height: 42px; border: 0; border-radius: 9px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; transition: .15s; }.pay-cell:hover { transform: translateY(-1px); box-shadow: 0 3px 9px rgba(0,0,0,.1); }.pay-cell.paid { background: #dff4ed; color: #087465; }.pay-cell.pending { background: #fff2e2; color: #a85b18; }.pay-cell.future { background: #f0f3f1; color: #a5afab; }.pay-cell strong { font-size: 12px; }.payment-key { display: flex; gap: 13px; align-items: center; font-size: 11px; color: var(--muted); }.payment-key span { display: inline-flex; align-items: center; gap: 5px; }.payment-key i { width: 9px; height: 9px; display: inline-block; border-radius: 3px; }.table-footer { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.winner-note { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; color: #7e4b0c; font-size: 10px; font-weight: 800; white-space: nowrap; }.winner-note svg { width: 12px; height: 12px; }.pay-cell.winner { background: #fff0c7; color: #82560e; box-shadow: inset 0 0 0 1px #f1cf7e; }.pay-cell.winner svg { width: 15px; height: 15px; }.pay-cell.winner span { font-size: 9px; font-weight: 800; }.winner-key { background: #fff0c7; border: 1px solid #f1cf7e; }.proposal-sections { display: grid; gap: 15px; }.proposal-group .card-header { border-bottom: 1px solid var(--line); padding-bottom: 14px; }.danger-notice { color: #913636; background: #fff1ef; border-color: #f0c4bf; margin-bottom: 19px; }
.split-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; }.sidebar-card { padding: 18px; }.side-title { font-family: Georgia, serif; font-size: 17px; margin: 0 0 13px; }.outline-list { display: flex; flex-direction: column; }.outline-row { padding: 11px 0; border-bottom: 1px solid #edf0ed; display: flex; justify-content: space-between; gap: 10px; }.outline-row:last-child { border-bottom: none; }.outline-label { color: var(--muted); font-size: 12px; }.outline-value { font-weight: 800; font-size: 12px; text-align: right; }.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; }.report-card { padding: 17px; min-height: 140px; display: flex; flex-direction: column; align-items: flex-start; }.report-card .report-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; color: var(--teal); background: var(--teal-soft); }.report-card h3 { font-family: Georgia, serif; margin: 13px 0 5px; font-size: 17px; }.report-card p { color: var(--muted); font-size: 11px; margin: 0 0 15px; line-height: 1.45; }.report-card .button { margin-top: auto; }
.empty { border: 1px dashed #ced8d3; padding: 45px 20px; text-align: center; color: var(--muted); border-radius: var(--radius); background: rgba(255,255,255,.55); }.empty h3 { color: var(--ink); font-family: Georgia, serif; margin: 10px 0 5px; }.empty p { margin: 0; font-size: 12px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(22,34,31,.47); backdrop-filter: blur(3px); }.modal { width: min(570px, 100%); max-height: min(735px, calc(100vh - 36px)); overflow: auto; background: var(--paper); border-radius: 18px; box-shadow: 0 24px 80px rgba(0,0,0,.25); animation: modalIn .2s ease; }.modal.wide { width: min(750px, 100%); }.modal-header { padding: 20px 21px 15px; display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); }.modal-title { margin: 0; font-family: Georgia, serif; font-size: 21px; }.modal-copy { color: var(--muted); font-size: 12px; margin: 5px 0 0; }.close { border: 0; color: #75807d; background: transparent; padding: 3px; border-radius: 7px; }.close:hover { background: #eef2ef; color: var(--ink); }.modal-body { padding: 19px 21px; }.modal-footer { display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--line); padding: 14px 21px; position: sticky; bottom: 0; background: var(--paper); }.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }.form-field { display: flex; flex-direction: column; gap: 6px; }.form-field.full { grid-column: 1 / -1; }.form-label { font-size: 11px; font-weight: 800; color: #5d6966; }.form-help { font-size: 10px; color: var(--muted); line-height: 1.4; }.check-list { border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: 155px; }.check-option { display: flex; align-items: center; gap: 9px; padding: 10px; border-bottom: 1px solid #eff1ef; font-size: 12px; font-weight: 650; }.check-option:last-child { border: 0; }.check-option input { accent-color: var(--teal); }.notice { padding: 11px 12px; background: #fff7e8; color: #835d1d; border: 1px solid #f2dfb9; border-radius: 9px; font-size: 11px; line-height: 1.45; }.detail-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }.detail-cell { padding: 11px; border-radius: 10px; background: #f7faf8; }.detail-cell span { display: block; color: var(--muted); font-size: 10px; }.detail-cell strong { display: block; margin-top: 4px; font-size: 13px; }.plan-table { width: 100%; border-collapse: collapse; font-size: 12px; }.plan-table th { text-align: left; color: var(--muted); font-size: 10px; padding: 8px; text-transform: uppercase; }.plan-table td { border-top: 1px solid var(--line); padding: 7px 8px; }.plan-table input { max-width: 105px; min-height: 31px; }
.toast { position: fixed; bottom: 24px; left: 50%; z-index: 100; transform: translateX(-50%) translateY(15px); opacity: 0; pointer-events: none; padding: 11px 14px; border-radius: 10px; color: white; background: #263a35; box-shadow: 0 8px 28px rgba(0,0,0,.2); font-size: 12px; font-weight: 700; transition: .25s ease; }.toast.show { transform: translateX(-50%); opacity: 1; }.hidden { display: none !important; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

body.dark { --ink: #edf4f0; --muted: #a3b1aa; --line: #263936; --canvas: #111b19; --paper: #172422; --soft: #1d302c; --teal-soft: #163d36; --gold-soft: #40351d; --red-soft: #412323; --shadow: 0 18px 50px rgba(0,0,0,.23); }
body.dark .sidebar, body.dark .stat-card, body.dark .card, body.dark .register td, body.dark .select, body.dark .input, body.dark .textarea, body.dark .button, body.dark .modal, body.dark .modal-footer { background: var(--paper); }
body.dark .register th, body.dark .data-table th { background: #192825; } body.dark .data-table tbody tr:hover td { background: #1a2a26; } body.dark .upcoming { background: #17352f; border-color: #285348; } body.dark .group-card::after { opacity: .2; } body.dark .detail-cell { background: #1b2d29; } body.dark .modal-backdrop { background: rgba(1,8,6,.68); }

@media (max-width: 1050px) { .stats-grid { grid-template-columns: repeat(2,1fr); }.dashboard-grid, .split-layout { grid-template-columns: 1fr; }.sidebar-card { display: none; }.main { padding: 0 22px 36px; } }
@media (max-width: 760px) { .app-shell { display: block; }.sidebar { height: auto; position: relative; padding: 14px; flex-direction: row; align-items: center; justify-content: space-between; border-right: 0; border-bottom: 1px solid var(--line); gap: 0; }.sidebar .nav, .sidebar-footer { display: none; }.brand { padding: 0; }.main { padding: 0 15px 30px; }.topbar { height: auto; padding: 19px 0; align-items: flex-start; }.top-actions .button { font-size: 0; padding: 0; width: 38px; }.top-actions .button svg { margin: 0; }.top-actions .button.primary { font-size: 12px; width: auto; padding: 0 10px; }.stats-grid, .group-list, .report-grid { grid-template-columns: 1fr; }.dashboard-grid { margin-top: 13px; }.group-list { gap: 10px; }.toolbar { align-items: stretch; flex-direction: column; }.toolbar-left, .toolbar-right { width: 100%; }.search-wrap, .search-wrap .input { width: 100%; }.select { flex: 1; }.form-grid { grid-template-columns: 1fr; }.form-field.full { grid-column: auto; }.detail-grid { grid-template-columns: 1fr 1fr; }.modal { border-radius: 15px; }.top-actions .icon-button:nth-child(2) { display: none; }.section-heading { margin-top: 22px; }.section-heading .button { display: none; } }
@media print { .sidebar, .topbar, .toolbar, .no-print, .button, .top-actions { display: none !important; }.app-shell { display: block; }.main { padding: 0; }.card, .table-card, .register-wrap { border: 0; box-shadow: none; }.content { animation: none; } body { background: #fff; } }

/* ---------- Login screen ---------- */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--canvas); }
.login-card { width: min(380px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 34px 28px; text-align: center; }
.login-logo { width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 16px; display: grid; place-items: center; color: #fff; font-family: Georgia, serif; font-size: 26px; font-weight: bold; background: linear-gradient(135deg, #137c73, #075a54); overflow: hidden; }
.login-logo img { width: 100%; height: 100%; object-fit: cover; }
.login-title { font-family: Georgia, serif; font-size: 22px; margin: 0 0 4px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.login-pin { width: 100%; text-align: center; letter-spacing: 8px; font-size: 20px; min-height: 48px; margin-bottom: 12px; }
.login-btn { width: 100%; justify-content: center; min-height: 44px; }
.login-error { color: var(--red); font-size: 12px; margin-bottom: 10px; font-weight: 700; }
.login-foot { margin-top: 18px; color: var(--muted); font-size: 11px; }

/* ---------- Mobile navigation menu ---------- */
.menu-toggle { display: none; margin-left: auto; padding: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 9px; }
.menu-toggle svg { width: 20px; height: 20px; }
@media (max-width: 760px) {
  .menu-toggle { display: inline-flex; align-items: center; }
  .brand { flex: 1; }
  .sidebar.nav-open { flex-direction: column; align-items: stretch; }
  .sidebar.nav-open .nav { display: flex; flex-direction: column; width: 100%; margin-top: 12px; gap: 4px; }
  .sidebar.nav-open .nav .nav-section { margin-top: 8px; }
  .sidebar.nav-open .nav-item { width: 100%; justify-content: flex-start; }
  .sidebar.nav-open .sidebar-footer { display: block; width: 100%; margin-top: 12px; }
}

/* Login inputs (email + password) */
.login-input { width: 100%; margin-bottom: 10px; min-height: 44px; text-align: left; letter-spacing: normal; font-size: 15px; }
