@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/plusjakartasans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/plusjakartasans-latinExt.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@view-transition {
  navigation: auto;
}

:root {
  color-scheme: light;
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-subtle: #F9FAFB;
  --ink: #0F172A;
  --ink-secondary: #475569;
  --ink-muted: #94A3B8;
  --border: rgba(15, 23, 42, .08);
  --border-strong: rgba(15, 23, 42, .14);
  --emerald: #059669;
  --emerald-bg: #ECFDF5;
  --emerald-border: #A7F3D0;
  --amber: #D97706;
  --amber-bg: #FFFBEB;
  --amber-border: #FDE68A;
  --indigo: #4F46E5;
  --indigo-bg: #EEF2FF;
  --indigo-border: #C7D2FE;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 10px 30px -10px rgba(15, 23, 42, .08);
  --shadow-hero: 0 24px 48px -16px rgba(11, 17, 32, .28);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B1120;
  --surface: #111C2E;
  --surface-subtle: #0F1929;
  --ink: #F8FAFC;
  --ink-secondary: #CBD5E1;
  --ink-muted: #94A3B8;
  --border: rgba(148, 163, 184, .16);
  --border-strong: rgba(148, 163, 184, .3);
  --emerald: #34D399;
  --emerald-bg: rgba(16, 185, 129, .12);
  --emerald-border: rgba(52, 211, 153, .32);
  --amber: #FBBF24;
  --amber-bg: rgba(217, 119, 6, .12);
  --amber-border: rgba(251, 191, 36, .32);
  --indigo: #A5B4FC;
  --indigo-bg: rgba(79, 70, 229, .16);
  --indigo-border: rgba(165, 180, 252, .3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2);
  --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, .5);
  --shadow-hero: 0 24px 48px -16px rgba(0, 0, 0, .6);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

h1, h2, h3, p, figure { margin: 0; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--emerald);
  outline-offset: 3px;
}

::selection { background: var(--emerald); color: #fff; }

.tnum, .num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-variant-ligatures: none; }
.muted { color: var(--ink-muted); }

/* Topbar */
.topbar-wrap {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px rgba(15, 23, 42, .16);
  flex: none;
}

.brand-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.15;
}

.brand-sub {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-muted);
}

.nav-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .045);
}

html[data-theme="dark"] .nav-pills { background: rgba(148, 163, 184, .08); }

.nav-btn {
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.nav-btn:hover { color: var(--ink); }

.nav-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.kipay-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 3px var(--emerald-bg);
}

.theme-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-secondary);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  transition: color .15s ease, border-color .15s ease;
}

.theme-btn:hover { color: var(--ink); border-color: var(--border-strong); }
.theme-btn svg { width: 17px; height: 17px; }
.i-sun { display: none; }
html[data-theme="dark"] .i-moon { display: none; }
html[data-theme="dark"] .i-sun { display: block; }

/* Layout */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.page-kicker {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--emerald);
  margin-bottom: 4px;
}

.page-title {
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.15;
}

.page-desc {
  margin-top: 4px;
  color: var(--ink-secondary);
  font-size: 14px;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.select-pill,
.btn-ghost-sm,
.input-ctrl {
  appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.select-pill {
  padding: 8px 32px 8px 12px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.btn-ghost-sm {
  padding: 8px 12px;
  color: var(--ink-secondary);
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

.btn-ghost-sm:hover {
  border-color: var(--border-strong);
  color: var(--ink);
  background: var(--surface-subtle);
}

/* Custom select from ui.js */
.select { position: relative; width: 100%; }

.select__trigger {
  width: 100%;
  min-height: 42px;
  padding: 10px 34px 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  font-size: 13.5px;
  font-weight: 600;
  position: relative;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.select__trigger::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--ink-muted);
  border-bottom: 2px solid var(--ink-muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.select__trigger:hover { border-color: var(--ink-muted); }

.select__value.is-placeholder { color: var(--ink-muted); font-weight: 500; }

.select__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 292px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.select__search {
  width: 100%;
  margin-bottom: 6px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  font-size: 13px;
  outline: none;
}

.select__option {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.select__option:hover { background: var(--surface-subtle); color: var(--ink); }

.select__option.is-selected {
  background: var(--emerald-bg);
  color: var(--emerald);
  font-weight: 700;
}

/* Bento hero */
.bento-hero {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
  animation: reveal .5s cubic-bezier(.22, 1, .36, 1) both;
}

.treasury-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  min-height: 236px;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: radial-gradient(120% 140% at 90% 10%, #1E293B 0%, #0B1120 55%, #070B14 100%);
  color: #fff;
  box-shadow: var(--shadow-hero);
}

.treasury-card::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -70px;
  top: -90px;
  background: radial-gradient(circle, rgba(16, 185, 129, .22) 0%, transparent 70%);
  pointer-events: none;
}

.treasury-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.treasury-label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, .68);
}

.treasury-amount {
  margin-top: 6px;
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.05;
}

.status-chip-dark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .9);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.progress-section { position: relative; z-index: 1; }
.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, .78);
  font-size: 13px;
}

.progress-meta strong { color: #fff; font-weight: 700; }

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #10B981, #34D399);
  transition: width .5s cubic-bezier(.22, 1, .36, 1);
}

.treasury-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-primary-light,
.btn-secondary-dark {
  border-radius: 11px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 10px 16px;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.btn-primary-light {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: #fff;
  color: #0F172A;
}

.btn-primary-light:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(255, 255, 255, .18);
}

.btn-secondary-dark {
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.btn-secondary-dark:hover { background: rgba(255, 255, 255, .14); }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.metric-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color .2s ease, transform .2s ease;
}

.metric-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 600;
}

.metric-icon {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-subtle);
  color: var(--ink-secondary);
  display: grid;
  place-items: center;
  flex: none;
}

.metric-icon svg { width: 16px; height: 16px; }
.metric-icon.green { background: var(--emerald-bg); border-color: var(--emerald-border); color: var(--emerald); }
.metric-icon.amber { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber); }
.metric-icon.indigo { background: var(--indigo-bg); border-color: var(--indigo-border); color: var(--indigo); }

.metric-value {
  margin-top: 14px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
}

.metric-sub {
  margin-top: 6px;
  color: var(--ink-muted);
  font-size: 12px;
}

/* Panels and tables */
.content-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 18px;
  align-items: start;
  animation: reveal .55s cubic-bezier(.22, 1, .36, 1) .06s both;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}

.panel-body { padding: 20px 22px; }
.panel-body--flush-top { padding-top: 0; }
.panel-title-wrap { display: flex; align-items: center; gap: 10px; }
.panel-title { font-size: 16px; font-weight: 700; letter-spacing: -.015em; }

.history-total { color: var(--emerald); font-size: 14px; font-weight: 700; }

.count-pill {
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 700;
}

.link-btn,
.text-btn {
  border: 0;
  background: none;
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.link-btn:hover, .text-btn:hover { color: var(--ink); }
.text-btn--danger { color: #DC2626; }
.text-btn--danger:hover { color: #B91C1C; }

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 22px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
}

.search-box { position: relative; flex: 1; min-width: 190px; }
.search-box svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .15s ease;
}

.search-input:focus { border-color: var(--ink-muted); }

.filter-group {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 9px;
  background: rgba(15, 23, 42, .04);
}

html[data-theme="dark"] .filter-group { background: rgba(148, 163, 184, .08); }

.filter-pill {
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 7px;
}

.filter-pill.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}

.table-scroll { width: 100%; overflow-x: auto; }

.panel table { width: 100%; border-collapse: collapse; text-align: left; }

.panel th {
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--ink-muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}

.panel td {
  padding: 13px 22px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}

.panel tbody tr:last-child td { border-bottom: 0; }
.panel tbody tr:hover { background: var(--surface-subtle); }
.panel th.col-no { width: 56px; }
.panel .col-total, .panel .col-count { text-align: right; }
.panel .col-actions { text-align: right; }

.member-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }

.avatar {
  width: 32px;
  height: 32px;
  border: 1px solid var(--indigo-border);
  border-radius: 9px;
  background: var(--indigo-bg);
  color: var(--indigo);
  display: grid;
  place-items: center;
  flex: none;
  font-size: 11.5px;
  font-weight: 700;
}

.avatar.paid {
  border-color: var(--emerald-border);
  background: var(--emerald-bg);
  color: var(--emerald);
}

.member-copy, .ledger-copy { min-width: 0; }
.member-name, .ledger-title { display: block; font-weight: 600; color: var(--ink); }
.member-id, .ledger-meta { display: block; font-size: 11.5px; color: var(--ink-muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-paid {
  border: 1px solid var(--emerald-border);
  background: var(--emerald-bg);
  color: var(--emerald);
}

.badge-unpaid {
  border: 1px solid var(--amber-border);
  background: var(--amber-bg);
  color: var(--amber);
}

.btn-row-action {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.btn-row-action:hover { background: var(--ink); color: var(--surface); border-color: var(--ink); }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 600;
}

.tag--on {
  border-color: var(--emerald-border);
  background: var(--emerald-bg);
  color: var(--emerald);
}

.name-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
}

.name-btn:hover { color: var(--emerald); }

.check {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  position: relative;
  transition: background-color .15s ease, border-color .15s ease;
}

.check[aria-checked="true"] {
  border-color: var(--emerald);
  background: var(--emerald);
}

.check[aria-checked="true"]::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}

/* Ledger list */
.ledger-list { padding: 8px 0; }

.ledger-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
}

.ledger-item:last-child { border-bottom: 0; }
.ledger-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.ledger-icon {
  width: 36px;
  height: 36px;
  border: 1px solid var(--emerald-border);
  border-radius: 10px;
  background: var(--emerald-bg);
  color: var(--emerald);
  display: grid;
  place-items: center;
  flex: none;
}

.ledger-icon svg { width: 16px; height: 16px; }
.ledger-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-meta { font-size: 12px; color: var(--ink-muted); }
.ledger-amount { color: var(--emerald); font-size: 13.5px; font-weight: 700; white-space: nowrap; }

.empty-state { padding: 40px 24px; text-align: center; color: var(--ink-muted); }
.empty-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-subtle);
  color: var(--ink-secondary);
  display: grid;
  place-items: center;
}
.empty-title { color: var(--ink); font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.empty-sub { font-size: 12.5px; }

/* Form */
.form-layout {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 20px;
  align-items: start;
  animation: reveal .5s cubic-bezier(.22, 1, .36, 1) both;
}

.form-card { padding: 26px; }
.form-card .panel-header { margin: -26px -26px 22px; }

.field { margin-bottom: 18px; }
.field__label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.field__hint { margin-top: 6px; color: var(--ink-muted); font-size: 12px; }

.input-ctrl {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.input-ctrl:focus {
  border-color: var(--ink-muted);
  box-shadow: 0 0 0 3px var(--border);
}

textarea.input-ctrl { min-height: 84px; resize: vertical; }
.input-ctrl[readonly] { background: var(--surface-subtle); color: var(--ink-secondary); }

.form-actions, .button-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.button-row--spaced { margin-top: 22px; }
.button-row--end { justify-content: flex-end; margin-top: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, border-color .15s ease, background-color .15s ease;
}

.btn:hover { border-color: var(--ink-muted); transform: translateY(-1px); }
.btn[disabled] { opacity: .6; cursor: not-allowed; transform: none; }

.btn--primary { border-color: var(--ink); background: var(--ink); color: var(--surface); }
.btn--primary:hover { border-color: var(--ink); background: var(--ink); }
.btn--quiet { background: transparent; color: var(--ink-secondary); }
.btn--danger { border-color: #FECACA; background: #FEF2F2; color: #B91C1C; }
html[data-theme="dark"] .btn--danger { border-color: rgba(248, 113, 113, .3); background: rgba(239, 68, 68, .12); color: #FCA5A5; }

.btn-submit {
  width: 100%;
  padding: 12px 18px;
  border: 0;
  border-radius: 11px;
  background: var(--ink);
  color: var(--surface);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  transition: transform .15s ease, opacity .15s ease;
}

.btn-submit:hover { transform: translateY(-1px); }
.btn-submit[disabled] { opacity: .6; cursor: not-allowed; transform: none; }

.summary__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.summary__row:last-child { border-bottom: 0; }
.summary__key { color: var(--ink-secondary); }
.summary__val { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }

/* Receipt */
.receipt {
  margin-top: 22px;
  padding: 18px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.receipt--paid { border-color: var(--emerald); }
.receipt--paid .receipt__title { color: var(--emerald); }
.receipt__title { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }

.receipt__ref {
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

.receipt__meta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.receipt__meta-key { color: var(--ink-secondary); font-size: 12px; font-weight: 600; }
.receipt__meta-val { font-size: 12.5px; font-weight: 700; overflow-wrap: anywhere; }
.receipt__meta .btn { padding: 6px 10px; font-size: 12px; }

.receipt__qr {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  display: grid;
  place-items: center;
}

.receipt__qr img { display: block; width: 190px; height: 190px; }

.receipt__link {
  display: inline-block;
  margin-top: 12px;
  color: var(--emerald);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.receipt__code {
  margin-top: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 11px;
  overflow-wrap: anywhere;
  font-variant-ligatures: none;
}

.receipt__hint { margin-top: 12px; color: var(--ink-secondary); font-size: 12.5px; }
.receipt__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* Notice banner */
.local-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--ink-secondary);
  font-size: 12.5px;
}

.local-banner--compact { margin-top: 0; }
.local-banner-left { display: flex; align-items: center; gap: 10px; }
.local-banner-left svg { flex: none; color: var(--ink-secondary); }
.local-banner strong { color: var(--ink); }
.local-banner-note { color: var(--ink-muted); font-size: 12px; }

/* Admin */
.setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--ink-secondary);
  font-size: 13px;
}

.setting-row .setting-amount { width: 96px; padding: 6px 10px; }

.month-editor { display: grid; gap: 10px; }

.month-editor__row {
  display: grid;
  grid-template-columns: 1fr auto 1fr 100px;
  align-items: center;
  gap: 10px;
}

.month-editor__label { font-size: 13px; font-weight: 600; }
.month-editor__row .input-ctrl { padding: 8px 10px; font-size: 13px; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.overlay.is-open { display: block; }
.overlay__scrim { position: absolute; inset: 0; background: rgba(15, 23, 42, .6); backdrop-filter: blur(3px); }

.drawer__panel,
.modal {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(480px, 100%);
  overflow-y: auto;
  padding: 26px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  animation: slide-in .22s cubic-bezier(.22, 1, .36, 1) both;
}

.modal {
  right: 50%;
  top: 50%;
  bottom: auto;
  width: min(420px, calc(100% - 32px));
  border: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transform: translate(50%, -50%);
  animation: none;
}

.drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.drawer__title { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.drawer__sub { margin-top: 4px; color: var(--ink-secondary); font-size: 13px; }
.login-error {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  background: #FEF2F2;
  color: #B91C1C;
  font-size: 13px;
  font-weight: 600;
}
html[data-theme="dark"] .login-error { border-color: rgba(248, 113, 113, .3); background: rgba(239, 68, 68, .12); color: #FCA5A5; }

.auth-layout { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; min-height: 62vh; }
.auth-card { width: 100%; max-width: 420px; min-width: 0; }
.auth-layout .form-card { width: 100%; min-width: 0; }
.filter-select { width: 190px; }

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--ink-muted);
  font-size: 12px;
}

/* Toast */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: min(360px, calc(100% - 48px));
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 600;
  animation: toast-in .2s ease both;
}

.toast--error { background: #991B1B; color: #fff; border-color: #991B1B; }
.toast.is-leaving { animation: toast-out .18s ease both; }

@keyframes reveal {
  from { clip-path: inset(0 0 100% 0); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes slide-in {
  from { transform: translateX(18px); }
  to { transform: translateX(0); }
}

@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes toast-out {
  to { transform: translateY(8px); opacity: 0; }
}

@media (max-width: 960px) {
  .bento-hero,
  .content-grid,
  .form-layout { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
  .kipay-badge { display: none; }
}

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; gap: 10px; }
  .container { padding: 22px 16px 48px; }
  .brand > span:last-child { display: none; }
  .brand-mark { width: 34px; height: 34px; }
  .nav-pills { padding: 3px; }
  .nav-btn { padding: 6px 10px; font-size: 12.5px; }
  .theme-btn { width: 34px; height: 34px; }
  .page-header { align-items: flex-start; }
  .treasury-card { padding: 22px; }
  .treasury-top { flex-direction: column; }
  .metric-card { padding: 16px; }
  .metric-value { font-size: 26px; }
  .panel-header, .panel-toolbar { padding-left: 16px; padding-right: 16px; }
  .panel th, .panel td { padding-left: 14px; padding-right: 14px; }
  .form-card { padding: 18px; }
  .form-card .panel-header { margin: -18px -18px 18px; }
  .receipt__meta { grid-template-columns: 1fr; }
  .month-editor__row { grid-template-columns: 1fr auto; }
  .drawer__panel { padding: 20px; }
  .footer__inner { padding: 16px; }
  .toast { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation-duration: .001ms !important; }
  .bento-hero, .content-grid, .form-layout { clip-path: none; }
}
