/* ==========================================================================
   Temple Utsava Manager – design system
   ========================================================================== */
:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --surface-2: #faf8f5;
  --ink: #1f1a17;
  --ink-2: #463d37;
  --muted: #7a6f68;
  --line: #e9e3dc;
  --line-2: #f1ece6;

  --brand: #8b2c17;
  --brand-600: #a63a1c;
  --brand-700: #6f2312;
  --brand-rgb: 139, 44, 23;
  --accent-rgb: 232, 119, 26;
  --accent-soft: #f3b680;
  --brand-50: #fbf0ea;
  --brand-100: #f6dccf;
  --saffron: #e8771a;
  --gold: #c8962c;
  --sidebar: #3a0f0b;
  --sidebar-2: #561812;

  --green: #15803d; --green-50: #ecfdf3;
  --red: #b42318; --red-50: #fef3f2;
  --amber: #b54708; --amber-50: #fffaeb;
  --blue: #175cd3; --blue-50: #eff8ff;
  --gray-50: #f2f0ed;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(31, 26, 23, .06);
  --shadow: 0 1px 3px rgba(31, 26, 23, .06), 0 6px 20px -6px rgba(31, 26, 23, .10);
  --shadow-lg: 0 20px 50px -12px rgba(31, 26, 23, .30);
  --sb-w: 264px;
  --font: "Inter", "Noto Sans Kannada", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 18px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
p { margin: 0 0 .6em; }
img { max-width: 100%; }
.ic { flex-shrink: 0; vertical-align: middle; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sb-w); z-index: 40;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: rgba(255, 255, 255, .92); display: flex; flex-direction: column; padding: 18px 14px;
}
.sb-brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 18px; }
.sb-logo {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--saffron), var(--gold)); color: #fff;
  box-shadow: 0 6px 16px -4px rgba(var(--accent-rgb), .6);
}
.sb-brand-text { min-width: 0; flex: 1; }
.sb-brand-text strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 14.5px; line-height: 1.25; color: #fff; overflow: hidden; }
.sb-brand-text span { display: block; font-size: 12px; color: rgba(255, 255, 255, .62); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-close { display: none; color: rgba(255, 255, 255, .92); }
.sb-context {
  display: flex; gap: 10px; align-items: center; padding: 10px 12px; margin: 0 2px 14px;
  border-radius: 12px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .08); color: #fff;
}
.sb-context:hover { color: #fff; background: rgba(255, 255, 255, .11); }
.sb-context b { display: block; font-size: 13px; }
.sb-context small { display: block; font-size: 11.5px; color: rgba(255, 255, 255, .7); }
.sb-context .dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 4px rgba(74, 222, 128, .18); }
.sb-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.sb-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: rgba(255, 255, 255, .8); font-weight: 500; transition: background .15s, color .15s;
}
.sb-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sb-nav a.active { background: rgba(255, 255, 255, .13); color: #fff; box-shadow: inset 3px 0 0 var(--saffron); }
.sb-nav a.active .ic { color: var(--accent-soft); }
.sb-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .45); padding: 16px 12px 6px; font-weight: 600; }
.sb-foot { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .1); }
.sb-foot .icon-btn { color: rgba(255, 255, 255, .8); }
.sb-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: #fff; padding: 6px; border-radius: 10px; }
.sb-user:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sb-user b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user small { display: block; font-size: 11.5px; color: rgba(255, 255, 255, .62); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, var(--saffron), var(--brand)); color: #fff; font-weight: 700; font-size: 13px;
}
.avatar-sm { width: 34px; height: 34px; font-size: 12px; }
a.avatar:hover { color: #fff; }

.main { flex: 1; min-width: 0; margin-left: var(--sb-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: rgba(245, 243, 239, .86); backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.tb-title { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.tb-title h1 { font-size: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-right { display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; }
.ctx-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 500; color: var(--ink-2);
}
.content { padding: 24px 28px 48px; width: 100%; max-width: 1480px; }
.drawer-backdrop { display: none; }
.bottom-nav { display: none; }

/* ---------- Generic layout ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.hstack { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.strong { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }
.t-right { text-align: right; }
.t-center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.green { color: var(--green); } .red { color: var(--red); } .amber { color: var(--amber); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-head h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 650; }
.card-head h3 .ic { color: var(--brand); }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.kpi { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); overflow: hidden; min-width: 0; }
.kpi-ic { position: absolute; right: 14px; top: 14px; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; padding-right: 44px; }
.kpi-value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi--hero { background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-600) 55%, var(--saffron) 100%); border: 0; color: #fff; box-shadow: 0 12px 30px -12px rgba(var(--brand-rgb), .55); }
.kpi--hero .kpi-label, .kpi--hero .kpi-sub { color: rgba(255, 255, 255, .82); }
.kpi--hero .kpi-ic { background: rgba(255, 255, 255, .16); color: #fff; }
.kpi--green .kpi-ic { background: var(--green-50); color: var(--green); }
.kpi--red .kpi-ic { background: var(--red-50); color: var(--red); }
.kpi--amber .kpi-ic { background: var(--amber-50); color: var(--amber); }
.kpi--blue .kpi-ic { background: var(--blue-50); color: var(--blue); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; user-select: none;
  background: var(--surface); color: var(--ink); border-color: var(--line);
}
.btn:hover { border-color: #d8cfc6; color: var(--ink); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: .6; pointer-events: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px -4px rgba(var(--brand-rgb), .55); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-saffron { background: var(--saffron); border-color: var(--saffron); color: #fff; }
.btn-saffron:hover { filter: brightness(.92); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--gray-50); border-color: transparent; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #912018; border-color: #912018; color: #fff; }
.btn-soft-danger { background: var(--red-50); color: var(--red); border-color: #fecdca; }
.btn-soft-danger:hover { background: #fee4e2; color: var(--red); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #166534; color: #fff; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; gap: 6px; }
.btn-lg { height: 52px; padding: 0 22px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent;
  color: var(--ink-2); cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }
.icon-btn.red { color: var(--red); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.btn.is-loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .req { color: var(--red); }
.input {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid #ddd5cc; background: #fff;
  font: inherit; font-size: 15px; color: var(--ink); transition: border-color .15s, box-shadow .15s; outline: none; min-width: 0;
}
textarea.input { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a6f68' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
select.input[required]:has(option[value=""]:checked), select[data-item-cat]:has(option[value=""]:checked) { color: var(--muted); }
select.input option { color: var(--ink); }
.input.field-missing { border-color: var(--red, #c0392b); box-shadow: 0 0 0 3px rgba(192, 57, 43, .15); }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .12); }
.input::placeholder { color: #b0a59c; }
.input-sm { height: 34px; font-size: 13.5px; padding: 0 10px; border-radius: 8px; }
.input-lg { height: 52px; font-size: 18px; }
.input[readonly] { background: var(--surface-2); }
.hint { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.input-icon { position: relative; }
.input-icon > .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .input { padding-left: 38px; }
.amount-wrap { position: relative; }
.amount-wrap::before { content: "₹"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 700; color: var(--brand); }
.amount-wrap .input { padding-left: 38px; height: 58px; font-size: 26px; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.amount-words { font-size: 12px; color: var(--green); min-height: 18px; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid #ddd5cc;
  background: #fff; font-weight: 600; font-size: 13.5px; color: var(--ink-2); cursor: pointer; user-select: none; transition: all .12s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
label.chip { position: relative; }
.chip:has(input:checked), .chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); margin-top: 1px; }
.field-err { color: var(--red); font-size: 12.5px; }
.lookup-hit { display: none; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--green-50); color: var(--green); font-size: 12.5px; font-weight: 500; }
.lookup-hit.show { display: flex; }

/* File drop */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 18px; text-align: center;
  border: 1.5px dashed #d6c9bd; border-radius: 12px; background: var(--surface-2); cursor: pointer; color: var(--muted); transition: all .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.dropzone input { display: none; }
.dropzone b { color: var(--ink-2); }
.file-previews { display: flex; flex-wrap: wrap; gap: 8px; }
.file-previews .fp { position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--gray-50); display: grid; place-items: center; font-size: 10px; color: var(--muted); border: 1px solid var(--line); }
.file-previews .fp img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Segmented / tabs ---------- */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--gray-50); border: 1px solid var(--line); border-radius: 11px; flex-wrap: wrap; }
.seg a, .seg button {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; border: 0; background: transparent;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.seg a:hover, .seg button:hover { color: var(--ink); }
.seg .on { background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); }
.custom-range { display: none; align-items: center; gap: 8px; flex-wrap: wrap; }
.custom-range.open { display: flex; }
.custom-range .input { width: auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.filterbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filterbar .input { width: auto; min-width: 140px; }
.filterbar .grow .input { width: 100%; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; border: 1px solid transparent; }
.b-green { background: var(--green-50); color: var(--green); border-color: #abefc6; }
.b-red { background: var(--red-50); color: var(--red); border-color: #fecdca; }
.b-amber { background: var(--amber-50); color: var(--amber); border-color: #fedf89; }
.b-blue { background: var(--blue-50); color: var(--blue); border-color: #b2ddff; }
.b-gray { background: var(--gray-50); color: var(--ink-2); border-color: var(--line); }
.b-brand { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); }
button.badge { cursor: pointer; font-family: inherit; }
button.badge:hover { filter: brightness(.96); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 650; color: var(--muted); padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:hover td { background: #fcfaf7; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .t-right { text-align: right; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line); }
.table tr.is-void td { background: #fffbfa; color: #a99b93; }
.table tr.is-void .amt, .table tr.is-void td.amt { text-decoration: line-through; text-decoration-color: var(--red); }
.table tr.is-edited td:first-child { box-shadow: inset 3px 0 0 var(--saffron); }
.table tr.is-void td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.cell-main { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 12px; color: var(--muted); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Mobile list cards */
.mlist { display: none; }
.mitem { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.mitem:last-child { border-bottom: 0; }
.mitem .m-main { flex: 1; min-width: 0; }
.mitem .m-title { font-weight: 650; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mitem .m-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }
.mitem .m-right { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.mitem .m-amt { font-weight: 750; font-size: 16px; font-variant-numeric: tabular-nums; }
.mitem.is-void { background: #fffbfa; }
.mitem.is-void .m-amt { text-decoration: line-through; color: #a99b93; text-decoration-color: var(--red); }
.mitem.is-edited { box-shadow: inset 3px 0 0 var(--saffron); }
.mitem.is-void { box-shadow: inset 3px 0 0 var(--red); }
.m-actions { display: flex; gap: 2px; }
.void-note { font-size: 12px; color: var(--red); margin-top: 4px; }

/* Summary strip */
.sumstrip { display: flex; gap: 0; flex-wrap: wrap; border-bottom: 1px solid var(--line-2); }
.sumstrip > div { flex: 1; min-width: 96px; padding: 12px 18px; border-right: 1px solid var(--line-2); }
.sumstrip > div:last-child { border-right: 0; }
.sumstrip .s-label { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.sumstrip .s-val { font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; }

/* ---------- Alerts / toasts ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; border: 1px solid; font-size: 13.5px; }
.alert .ic { margin-top: 1px; }
.alert-warn { background: var(--amber-50); border-color: #fedf89; color: #7a2e0e; }
.alert-info { background: var(--blue-50); border-color: #b2ddff; color: #194185; }
.alert-error { background: var(--red-50); border-color: #fecdca; color: #7a271a; }
.alert-success { background: var(--green-50); border-color: #abefc6; color: #05603a; }
.alert a { font-weight: 600; text-decoration: underline; }
.toasts { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 12px 14px; border-radius: 12px; background: #1f1a17; color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toastIn .25s ease-out; }
.toast > div { flex: 1; padding-top: 1px; }
.toast a { color: #ffc58f; font-weight: 600; }
.toast .icon-btn { width: 26px; height: 26px; color: #bbb; }
.toast-success .ic:first-child { color: #4ade80; }
.toast-error { background: #7a271a; }
.toast-error .ic:first-child { color: #fecdca; }
.toast.hide { opacity: 0; transform: translateY(-8px); transition: all .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- Modal ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: var(--shadow-lg); color: var(--ink); }
dialog.modal.wide { width: min(760px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(31, 18, 12, .45); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: modalIn .2s ease-out; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line-2); background: var(--surface-2); }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.spinner { width: 28px; height: 28px; margin: 30px auto; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Timeline (history) ---------- */
.timeline { position: relative; display: flex; flex-direction: column; gap: 0; }
.tl-item { position: relative; padding: 0 0 18px 30px; }
.tl-item::before { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--gray-50); color: var(--ink-2); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.tl-dot.create { background: var(--green-50); color: var(--green); }
.tl-dot.update { background: var(--amber-50); color: var(--amber); }
.tl-dot.void { background: var(--red-50); color: var(--red); }
.tl-dot.restore, .tl-dot.reopen { background: var(--blue-50); color: var(--blue); }
.tl-dot.close { background: var(--brand-50); color: var(--brand); }
.tl-head { font-size: 13.5px; }
.tl-head b { font-weight: 650; }
.tl-meta { font-size: 12px; color: var(--muted); }
.diff { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 12.5px; }
.diff table { width: 100%; border-collapse: collapse; }
.diff td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.diff tr:last-child td { border-bottom: 0; }
.diff .f { color: var(--muted); font-weight: 600; width: 28%; }
.diff .old { color: var(--red); text-decoration: line-through; background: #fffbfa; }
.diff .new { color: var(--green); background: #f6fef9; font-weight: 600; }
.tl-reason { margin-top: 6px; font-size: 12.5px; padding: 6px 10px; background: var(--surface-2); border-left: 3px solid var(--gold); border-radius: 4px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ic { color: #c9bbb0; }
.empty h3 { color: var(--ink); }

/* ---------- Pager ---------- */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line-2); }

/* ---------- Donation page split ---------- */
.split { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px; align-items: start; }
.split-rev { grid-template-columns: minmax(0, 1fr) 380px; }
.split-list .table th, .split-list .table td { padding-left: 10px; padding-right: 10px; }
.table td.donor { min-width: 150px; }
.split.split-single { grid-template-columns: minmax(0, 1fr); }
.split-entry { position: sticky; top: 80px; }
.mobile-switch { display: none; }
.entry-success { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--green-50); border: 1px solid #abefc6; margin-bottom: 14px; }
.entry-success .ic { color: var(--green); }
.entry-success b { display: block; }

/* ---------- Expense detail ---------- */
.ledger { display: flex; flex-direction: column; }
.ledger-item { display: flex; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.ledger-item:last-child { border-bottom: 0; }
.ledger-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.ledger-ic.given { background: var(--red-50); color: var(--red); }
.ledger-ic.returned { background: var(--green-50); color: var(--green); }
.ledger-item.is-void { opacity: .55; }
.ledger-item.is-void .amt { text-decoration: line-through; }
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.file-tile { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.file-tile .thumb { aspect-ratio: 4/3; background: var(--gray-50); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.file-tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-tile .meta { padding: 8px 10px; font-size: 12px; }
.progress { height: 8px; border-radius: 99px; background: var(--gray-50); overflow: hidden; display: flex; }
.progress span { display: block; height: 100%; }

/* ---------- Year cards ---------- */
.year-card.is-active { border-color: #abefc6; box-shadow: 0 0 0 3px rgba(21, 128, 61, .08), var(--shadow-sm); }
.season-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.season-row .grow b { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 200px; }
.chart-box.lg { height: 340px; }
.legend-list { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.legend-list .li { display: flex; align-items: center; gap: 8px; }
.legend-list .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-list .li span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-list .bl-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.bar-list .bl-top span:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-list .bl-bar { height: 8px; background: var(--gray-50); border-radius: 99px; overflow: hidden; }
.bar-list .bl-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--saffron)); border-radius: 99px; }

/* ---------- Quick actions ---------- */
.qa-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.qa { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s; }
.qa:hover { transform: translateY(-1px); box-shadow: var(--shadow); color: var(--ink); }
.qa .qa-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.qa small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.hello { padding: 22px 24px; border-radius: 18px; color: #fff; margin-bottom: 20px; position: relative; overflow: hidden;
  background: radial-gradient(circle at 85% 20%, rgba(var(--accent-rgb), .35), transparent 40%), linear-gradient(120deg, var(--sidebar) 0%, var(--brand-700) 55%, var(--brand-600) 100%); }
.hello h2 { font-size: 22px; font-weight: 750; }
.hello p { color: rgba(255, 255, 255, .8); margin: 4px 0 0; }
.hello .ic-bg { position: absolute; right: -10px; bottom: -24px; opacity: .12; color: #fff; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(circle at 15% 10%, rgba(var(--accent-rgb), .22), transparent 40%), radial-gradient(circle at 90% 90%, rgba(var(--brand-rgb), .25), transparent 45%), linear-gradient(160deg, var(--sidebar), var(--sidebar-2)); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 22px; padding: 32px 28px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .5); }
.auth-card.wide { max-width: 640px; }
.auth-logo { width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 14px; background: linear-gradient(135deg, var(--saffron), var(--gold)); color: #fff; box-shadow: 0 10px 24px -6px rgba(var(--accent-rgb), .6); }
.auth-card h1 { text-align: center; font-size: 21px; }
.auth-card .sub { text-align: center; color: var(--muted); margin: 4px 0 24px; }

/* ---------- Receipt ---------- */
.receipt { max-width: 560px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px; position: relative; overflow: hidden; }
.receipt .r-head { text-align: center; border-bottom: 2px dashed var(--line); padding-bottom: 16px; margin-bottom: 16px; }
.receipt .r-head h2 { font-size: 20px; color: var(--brand); }
.receipt .r-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.receipt .r-row span:first-child { color: var(--muted); }
.receipt .r-row span:last-child { font-weight: 600; text-align: right; }
.receipt .r-amt { text-align: center; padding: 18px 0; }
.receipt .r-amt b { font-size: 34px; font-weight: 800; color: var(--ink); }
.receipt .watermark { position: absolute; inset: 0; display: grid; place-items: center; font-size: 110px; font-weight: 900; color: rgba(180, 35, 24, .12); transform: rotate(-24deg); pointer-events: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .g-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split { grid-template-columns: 360px minmax(0, 1fr); }
  .split.split-rev { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qa-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-102%); transition: transform .25s ease; box-shadow: var(--shadow-lg); width: 290px; }
  body.drawer-open .sidebar { transform: none; }
  body.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; background: rgba(20, 10, 6, .45); z-index: 35; }
  .sb-close { display: inline-grid; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .content { padding: 18px 16px 40px; }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split.split-rev { grid-template-columns: minmax(0, 1fr); }
  .split-entry { position: static; }
}
@media (max-width: 760px) {
  body.has-app { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .topbar .menu-btn { display: none; }
  .topbar { padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
  .tb-title h1 { font-size: 18px; }
  .content { padding: 14px 12px 28px; }
  .hide-m { display: none !important; }
  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .g-4.keep-2, .g-3.keep-2, .g-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid.keep-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 21px; }
  .kpi-ic { width: 30px; height: 30px; right: 10px; top: 10px; }
  .kpi-ic .ic { width: 16px; height: 16px; }
  .kpi-label { padding-right: 34px; }
  .card-head { padding: 14px; }
  .card-body { padding: 14px; }
  .page-head { margin-bottom: 14px; }
  .page-head h2 { font-size: 19px; }
  .qa-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .qa { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .hello { padding: 18px; border-radius: 16px; }
  .hello h2 { font-size: 19px; }
  .table-desktop { display: none; }
  .mlist { display: block; }
  .filterbar .input { min-width: 0; flex: 1 1 140px; }
  .seg { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg a, .seg button { flex: 1 0 auto; justify-content: center; }
  .sumstrip > div { min-width: 50%; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
  .sumstrip > div:nth-child(2n) { border-right: 0; }
  .sumstrip .s-val { font-size: 16px; }
  .toasts { top: calc(60px + env(safe-area-inset-top)); right: 12px; left: 12px; max-width: none; }
  dialog.modal { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  dialog.modal[open] { animation: sheetIn .25s ease-out; }
  .mobile-switch { display: flex; margin-bottom: 14px; }
  .mobile-switch.seg a { flex: 1; }
  .split.show-entry .split-list { display: none; }
  .split.show-list .split-entry { display: none; }
  .chart-box { height: 240px; }
  .receipt { padding: 20px; border-radius: 12px; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; height: calc(64px + env(safe-area-inset-bottom));
    padding: 0 6px env(safe-area-inset-bottom); background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); box-shadow: 0 -6px 20px -10px rgba(0, 0, 0, .15);
  }
  .bottom-nav > a, .bottom-nav > button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none;
    font: inherit; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer;
  }
  .bottom-nav .on { color: var(--brand); }
  .bottom-nav .bn-fab {
    flex: 0 0 58px; height: 58px; margin-top: -22px; border-radius: 18px; color: #fff !important;
    background: linear-gradient(135deg, var(--saffron), var(--brand)); box-shadow: 0 10px 22px -6px rgba(var(--brand-rgb), .6);
  }
  .btn-lg { height: 54px; }
}
@keyframes sheetIn { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* Sticky save bar on phones for entry forms */
@media (max-width: 760px) {
  .sticky-actions { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 5; background: linear-gradient(180deg, rgba(255,255,255,0), #fff 30%); padding-top: 14px; margin: 0 -14px -14px; padding: 14px; border-radius: 0 0 var(--radius) var(--radius); }
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff; font-size: 12px; }
  .sidebar, .topbar, .bottom-nav, .no-print, .toasts, .drawer-backdrop, .alert { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
  .receipt { border: 1px solid #999; box-shadow: none; }
  .table-desktop { display: block !important; }
  .mlist { display: none !important; }
  a { color: inherit; }
}

/* ---------- Donations home ---------- */
.don-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.don-title h2 { font-size: 22px; font-weight: 700; }
.don-title p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.don-title p b { color: var(--brand); font-weight: 600; }
.don-actions { display: flex; gap: 10px; }
.don-actions .btn { height: 46px; padding: 0 18px; font-size: 15px; border-radius: 12px; }
.today-card { display: flex; align-items: stretch; overflow: hidden; }
.today-main { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 18px 24px; min-width: 260px;
  border-right: 1px solid var(--line-2); background: linear-gradient(180deg, var(--brand-50), #fff); }
.today-main .t-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); }
.today-main .t-total { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.today-main .t-sub { font-size: 13px; color: var(--muted); }
.today-stats { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.today-stats > * { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 16px 20px; border-right: 1px solid var(--line-2); color: var(--ink); min-width: 0; }
.today-stats > *:last-child { border-right: 0; }
.today-stats span { font-size: 12px; color: var(--muted); font-weight: 500; }
.today-stats b { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-stats a:hover { background: var(--surface-2); color: var(--ink); }
.entry-wrap { max-width: 640px; margin: 0 auto; }
@media (max-width: 760px) {
  .don-head { margin-bottom: 12px; gap: 12px; }
  .don-title h2 { font-size: 19px; }
  .don-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .don-actions .btn { height: 50px; padding: 0 10px; font-size: 14.5px; gap: 6px; }
  .don-actions .btn:only-child { grid-column: 1 / -1; }
  .today-card { flex-direction: column; }
  .today-main { border-right: 0; border-bottom: 1px solid var(--line-2); padding: 14px 16px; min-width: 0; flex-direction: row; align-items: baseline; flex-wrap: wrap; column-gap: 10px; }
  .today-main .t-label { width: 100%; font-size: 11px; }
  .today-main .t-total { font-size: 26px; }
  .today-stats > * { padding: 10px 12px; }
  .today-stats span { font-size: 11px; }
  .today-stats b { font-size: 15px; }
}
.today-stats b span { font-size: inherit; font-weight: inherit; color: var(--ink); }
.today-stats b span.amber { color: var(--amber); }
.today-stats b span.red { color: var(--red); }
@media (max-width: 760px) { .today-main { justify-content: flex-start; } }
.brand-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sb-logo:has(.brand-img), .auth-logo:has(.brand-img) { background: #fff; padding: 4px; overflow: hidden; }

/* ---------- Settings: logo & theme ---------- */
.logo-row { display: flex; gap: 18px; align-items: flex-start; }
.logo-preview { width: 84px; height: 84px; border-radius: 18px; display: grid; place-items: center; flex-shrink: 0; overflow: hidden; padding: 6px;
  background: linear-gradient(135deg, var(--saffron), var(--gold)); color: #fff; }
.logo-preview:has(.brand-img) { background: #fff; border: 1px solid var(--line); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.theme-opt { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; transition: border-color .12s, box-shadow .12s; }
.theme-opt:hover { border-color: #cfc5bb; }
.theme-opt input { position: absolute; opacity: 0; pointer-events: none; }
.theme-opt:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .15); }
.theme-opt:has(input:checked)::after { content: "✓"; position: absolute; top: 6px; right: 8px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; display: grid; place-items: center; font-weight: 700; }
.theme-swatch { display: flex; height: 34px; border-radius: 8px; overflow: hidden; }
.theme-swatch i { flex: 1; }
.theme-name { font-size: 13px; font-weight: 600; }
.custom-colors { display: none; }
.custom-colors.show { display: grid; }
.color-input { padding: 4px; height: 46px; cursor: pointer; }
.theme-preview { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line); }
@media (max-width: 760px) {
  .logo-row { flex-direction: column; }
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Phone: keyboard-friendly entry ---------- */
@media (max-width: 760px) {
  body.kb-open .bottom-nav { display: none; }
  body.kb-open { padding-bottom: 0; }
  body.kb-open .sticky-actions { position: static; background: none; margin: 0; padding: 4px 0 0; }
  body.kb-open .toasts { display: none; }
  .entry-form { gap: 12px; }
  .entry-form .input { height: 46px; font-size: 16px; }
  .entry-form .input-lg { height: 48px; font-size: 17px; }
  .entry-form textarea.input { height: auto; min-height: 64px; }
  .entry-form .amount-wrap .input { height: 54px; font-size: 24px; }
  .entry-form .chips { gap: 6px; }
  .entry-form .chip { height: 38px; padding: 0 14px; }
  .entry-form .amount-words { min-height: 0; }
  .entry-form .field { gap: 5px; }
  .entry-card > .card-head { display: none; }
  .entry-wrap .entry-card { border-radius: 14px; }
}

/* Segmented radio (expense type) */
.seg label { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; flex: 1; }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); }
.kind-seg { display: flex; width: 100%; }
.badge-kind { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); }

/* ---------- Expense voucher with line items ---------- */
.entry-wide { max-width: 1120px; margin: 0 auto; }
.form-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.items-head, .item-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 110px 140px 120px 130px 34px; gap: 8px; align-items: center; }
.items-head { padding: 0 2px 8px; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line-2); }
.items { display: flex; flex-direction: column; }
.item-row { padding: 8px 2px; border-bottom: 1px solid var(--line-2); }
.ir-l { display: none; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ir-f { min-width: 0; }
.ir-amt .input { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.file-btn { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px dashed #d6c9bd; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; font-weight: 600; cursor: pointer; overflow: hidden; white-space: nowrap; }
.file-btn:hover { border-color: var(--brand); color: var(--brand); }
.file-btn input { display: none; }
.file-btn.has-file { border-style: solid; border-color: #abefc6; background: var(--green-50); color: var(--green); }
.file-btn span { overflow: hidden; text-overflow: ellipsis; }
.items-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.items-foot .amt { font-size: 20px; margin-left: 8px; }
.add-more { color: var(--brand); }
@media (max-width: 1023px) {
  .form-grid.g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .form-grid.g3 { grid-template-columns: minmax(0, 1fr); }
  .items-head { display: none; }
  .items { gap: 10px; }
  .item-row { position: relative; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 8px 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
  .ir-l { display: block; margin-bottom: 3px; }
  .ir-cat { grid-column: 1; padding-right: 0; }
  .ir-amt { grid-column: 2; grid-row: 1; padding-right: 30px; }
  .ir-desc { grid-column: 1 / -1; }
  .ir-bill { grid-column: 1; }
  .ir-date { grid-column: 2; }
  .ir-file { grid-column: 1 / -1; }
  .ir-del { position: absolute; top: 6px; right: 6px; }
  .item-row .input-sm { height: 42px; font-size: 16px; }
  .file-btn { height: 42px; justify-content: center; }
}
dialog.modal.xwide { width: min(1040px, calc(100vw - 24px)); }
.bill-thumb { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--gray-50); color: var(--muted); margin-right: 4px; vertical-align: middle; }
.bill-thumb img { width: 100%; height: 100%; object-fit: cover; }
.inline-attach { display: inline-block; margin: 0; }
.inline-attach .file-btn { height: 32px; }
@media (max-width: 760px) { dialog.modal.xwide { width: 100vw; } }
.kind-pick { max-width: 460px; }
.kind-pick select.input { font-weight: 600; }

/* Donation books */
.book-pick { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.book-pick .field { margin: 0; }
.serial-input { font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.book-hint { font-size: 12.5px; color: var(--muted); margin-top: 8px; min-height: 1em; }
.book-hint:empty { display: none; }
.book-hint.ok { color: var(--green, #15803d); }
.book-hint.bad { color: var(--red); font-weight: 600; }
.serial-ref { color: var(--brand); font-weight: 600; }
.seg-links { display: flex; gap: 6px; flex-wrap: wrap; }
tr.serial-free td, .mitem.serial-free { color: var(--muted); }
tr.serial-free td.mono { color: var(--ink-2); }
