:root {
  --bg: #08090D;
  --card: #12141B;
  --card-2: #161922;
  --text: #f4f4f8;
  --muted: #9a9aaa;
  --red: #ef1a2a;
  --red-soft: rgba(239, 26, 42, 0.14);
  --line: rgba(255, 255, 255, 0.08);
  --ok: #22c55e;
  --warn: #f59e0b;
  --blue: #3b82f6;
  --gold: #eab308;
  --side-w: 220px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  background:
    radial-gradient(ellipse at 6% -6%, rgba(239, 26, 42, 0.14), transparent 40%),
    radial-gradient(ellipse at 96% 0%, rgba(239, 26, 42, 0.05), transparent 34%),
    var(--bg);
  color: var(--text);
}
.muted { color: var(--muted); }
.err { color: #fca5a5; }
.sm-hint { font-size: 12px; margin-left: 4px; }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }

.pz-app { display: flex; min-height: 100vh; }
.pz-side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 30;
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 10px 12px;
  background: linear-gradient(180deg, #0e1016 0%, #090A0F 100%);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.pz-brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
.pz-logo {
  width: 28px; height: 28px; border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(239, 26, 42, 0.28);
}
.pz-brand strong { display: block; font-size: 13px; letter-spacing: 0.08em; }
.pz-brand em { font-style: normal; font-size: 11px; color: var(--muted); }
.pz-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.pz-nav-btn {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  text-align: left; padding: 11px 12px; border-radius: 10px; cursor: pointer;
  font: inherit; font-size: 14px; display: flex; align-items: center; gap: 10px; text-decoration: none;
  position: relative;
}
.pz-nav-btn:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.pz-nav-btn.active {
  background: var(--red-soft); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(239, 26, 42, 0.28);
}
.pz-nav-btn .ico { width: 1.2em; opacity: 0.85; }
.pz-nav-btn .badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; min-width: 18px; height: 18px;
  border-radius: 9px; display: inline-grid; place-items: center; padding: 0 5px;
}
.pz-nav-btn.link, .pz-nav-btn.ghost { font-size: 13px; }
.pz-side-foot { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.pz-main { margin-left: var(--side-w); flex: 1; min-width: 0; padding: 0 20px 48px; }
.pz-top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 16px 0 14px; position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, rgba(8, 9, 13, 0.97), rgba(8, 9, 13, 0.88) 70%, transparent);
  backdrop-filter: blur(8px);
}
.pz-burger { display: none; }
.pz-top-title { flex: 1; min-width: 140px; }
.pz-top-title strong { display: block; font-size: 19px; }
.pz-top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pz-month-nav {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px;
}
.pz-month-nav strong { min-width: 7.5rem; text-align: center; font-size: 14px; }
.pz-view-toggle {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card-2); color: var(--text);
  border-radius: 10px; padding: 10px 15px; font: inherit; font-size: 14px; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn:hover { border-color: rgba(239, 26, 42, 0.35); }
.btn.primary {
  background: linear-gradient(145deg, #e01828, #a0101c); border-color: transparent; font-weight: 700;
  box-shadow: 0 4px 14px rgba(239, 26, 42, 0.18);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 11px; font-size: 13px; }
.btn.danger { color: #fca5a5; }
.btn.warn { color: var(--warn); border-color: rgba(245, 158, 11, 0.35); }

/* Auth wall */
body.logged-out .pz-side,
body.logged-out .pz-top,
body.logged-out #mainView {
  display: none !important;
}
body.logged-out .pz-main {
  margin-left: 0;
  padding: 0;
  min-height: 100vh;
}
body.logged-out .pz-login {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse at 8% -8%, rgba(239, 26, 42, 0.16), transparent 38%),
    var(--bg);
}
body.is-authed .pz-login,
.pz-login[hidden] {
  display: none !important;
}
.pz-login { display: grid; place-items: center; min-height: 70vh; }
.pz-login-card {
  width: min(380px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 24px; display: grid; gap: 8px;
  box-shadow: 0 0 0 1px rgba(239, 26, 42, 0.08), 0 20px 50px rgba(0, 0, 0, 0.45);
}
.pz-login-card input, .form-grid input, .form-grid select, .form-grid textarea, .search {
  width: 100%; background: #0c0e14; border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 11px 12px; font: inherit; font-size: 14px;
}
.pz-login-card input:focus, .form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .search:focus {
  outline: none; border-color: rgba(239, 26, 42, 0.45);
}

.kpi-row {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px;
}
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px; min-height: 100px;
}
.kpi span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi strong { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi em { font-style: normal; font-size: 11px; color: var(--muted); line-height: 1.3; }
.kpi.green { box-shadow: inset 3px 0 0 var(--ok); }
.kpi.red { box-shadow: inset 3px 0 0 var(--red); }
.kpi.blue { box-shadow: inset 3px 0 0 var(--blue); }
.kpi.gold { box-shadow: inset 3px 0 0 var(--gold); }
.kpi.ok { box-shadow: inset 3px 0 0 var(--ok); }
.kpi.warn { box-shadow: inset 3px 0 0 var(--warn); }
.kpi.gauge { align-items: center; text-align: center; justify-content: center; }
.gauge-ring {
  --pct: 0;
  width: 72px; height: 72px; border-radius: 50%;
  background: conic-gradient(var(--red) calc(var(--pct) * 1%), rgba(255, 255, 255, 0.08) 0);
  display: grid; place-items: center; margin-bottom: 4px;
}
.gauge-ring::before {
  content: ""; width: 54px; height: 54px; border-radius: 50%; background: var(--card);
  grid-area: 1 / 1;
}
.gauge-ring strong { grid-area: 1 / 1; z-index: 1; font-size: 15px; }
.kpi-sub { font-size: 12.5px; margin-bottom: 16px; line-height: 1.5; }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px; margin-bottom: 14px;
}
.panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2, .panel h2 { margin: 0; font-size: 16px; letter-spacing: 0.01em; }
.panel-head > .btn { margin-left: auto; }
.search { max-width: 220px; margin-left: auto; padding: 9px 11px; }
.pz-grid-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; }

.table-scroll {
  overflow: auto;
  max-height: min(58vh, 640px);
  border-radius: 10px;
  border: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}
.pz-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.pz-table th, .pz-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap;
}
.pz-table th {
  position: sticky; top: 0; background: #151822; z-index: 2; font-weight: 600;
  color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em;
}
.pz-table .month-subhead th { top: 38px; font-size: 11px; text-align: center; text-transform: none; letter-spacing: 0; padding: 6px 4px; }
.pz-table .month-subhead th.mo-h.is-current,
.pz-table td.cell-pay.is-current {
  background: rgba(239, 26, 42, 0.06);
}
.pz-table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.pz-table .col-sticky {
  position: sticky; left: 0; z-index: 1; background: var(--card);
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.2);
}
.pz-table thead .col-sticky { z-index: 3; background: #151822; }
.pz-table.year-mode .col-meta { display: none; }
.pay-mode {
  display: inline-block; font-size: 11px; line-height: 1.2;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.06); color: var(--muted);
  white-space: nowrap;
}
.pay-mode.auto_debit {
  background: rgba(59, 130, 246, 0.15); color: #93c5fd;
}
.pay-mode.manual_pay {
  background: rgba(245, 158, 11, 0.12); color: #fbbf24;
}
.cal-ev.exp.auto { border-left: 2px solid #60a5fa; }
.pz-table.year-mode td.cell-pay,
.pz-table.year-mode .month-subhead th.mo-h { padding-left: 3px; padding-right: 3px; }

/* Clear checkbox-like payment cells */
.cell-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1.5px solid rgba(255, 255, 255, 0.16);
  background: #0a0c12; color: transparent; cursor: pointer;
  display: inline-grid; place-items: center; font-size: 15px; font-weight: 700;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
  vertical-align: middle;
}
.cell-btn:hover:not(:disabled) {
  border-color: rgba(239, 26, 42, 0.45);
  transform: scale(1.06);
}
.cell-btn:active:not(:disabled) { transform: scale(0.96); }
.cell-btn.empty {
  color: transparent;
  background-image: linear-gradient(transparent, transparent);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.12);
}
.cell-btn.paid {
  background: rgba(34, 197, 94, 0.28); border-color: rgba(34, 197, 94, 0.65); color: #4ade80;
}
.cell-btn.due_soon {
  background: rgba(245, 158, 11, 0.2); border-color: rgba(245, 158, 11, 0.55); color: var(--warn);
}
.cell-btn.overdue {
  background: rgba(239, 26, 42, 0.22); border-color: rgba(239, 26, 42, 0.55); color: #ff6b75;
}
.cell-btn.partial {
  background: rgba(59, 130, 246, 0.22); border-color: rgba(59, 130, 246, 0.55); color: #60a5fa;
}
.cell-btn.na, .cell-btn.skipped {
  background: rgba(255, 255, 255, 0.03); border-color: transparent; color: #555; cursor: default;
}
.cell-btn:disabled { opacity: 0.45; cursor: default; transform: none; }

.badge-pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.badge-pill.ok { background: rgba(34, 197, 94, 0.15); color: var(--ok); }
.badge-pill.warn { background: rgba(245, 158, 11, 0.15); color: var(--warn); }
.badge-pill.danger { background: rgba(239, 26, 42, 0.18); color: #ff8a93; }
.badge-pill.muted { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.row-actions { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.icon-btn {
  appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 6px 8px; border-radius: 7px; font: inherit; font-size: 14px; line-height: 1;
}
.icon-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }
.icon-btn.ok:hover { color: var(--ok); background: rgba(34, 197, 94, 0.12); }
.icon-btn.danger:hover { color: #fca5a5; background: rgba(239, 26, 42, 0.12); }

.twin { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.simple-list { display: flex; flex-direction: column; gap: 8px; }
.simple-item {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 12px 14px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--line);
}
.simple-item strong { display: block; font-size: 14px; }
.simple-item .amt { font-variant-numeric: tabular-nums; font-weight: 700; }
.simple-item .meta { font-size: 12px; color: var(--muted); }

.form-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px;
}
.form-grid.narrow { max-width: 520px; }
.form-grid label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.form-grid label.check { display: flex; align-items: center; gap: 8px; margin-top: 22px; color: var(--text); }
.form-grid .span2 { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.editor-tabs { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.form-kind-hint { margin: 0 0 12px; }
.chip {
  appearance: none; border: 1px solid transparent; background: transparent; color: var(--muted);
  border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.chip.active { background: var(--red-soft); color: #fff; border-color: rgba(239, 26, 42, 0.3); }
/* Kind-specific form fields: show only what belongs to the active tab */
#itemForm[data-kind="expense"] .fld-income,
#itemForm[data-kind="income"] .fld-expense,
#itemForm[data-kind="variable"] .fld-expense,
#itemForm[data-kind="variable"] .fld-income,
#itemForm[data-kind="variable"] .fld-not-var {
  display: none !important;
}
#itemForm .muted-hint {
  color: var(--muted); font-size: 12px; line-height: 1.4; margin: 0;
}
#itemForm .opt-tag {
  font-weight: 500; color: var(--muted); font-size: 11px; letter-spacing: 0.01em;
}
.inc-mode {
  display: inline-block; margin-top: 4px; padding: 2px 7px; border-radius: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
}
.inc-mode.auto { background: rgba(132, 204, 22, 0.15); color: #a3e635; }
.inc-mode.confirm { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.inc-mode.wait { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.simple-item .row-actions { display: flex; gap: 4px; justify-content: flex-end; margin-top: 4px; }

.var-list { gap: 12px; }
.var-card {
  padding: 12px 14px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
}
.var-head {
  display: flex; justify-content: space-between; gap: 10px; align-items: flex-start;
}
.var-head strong { display: block; font-size: 14px; }
.var-head-right { text-align: right; flex-shrink: 0; }
.var-head-right .row-actions { flex-wrap: wrap; justify-content: flex-end; }
.var-head .remain { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; }
.var-head .remain.ok { color: #86efac; }
.var-head .remain.empty { color: var(--muted); }
.var-head .remain.over { color: #fca5a5; }
.var-head .remain-lbl { font-weight: 500; font-size: 11px; color: var(--muted); }
.var-spends {
  list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px;
  border-top: 1px solid var(--line); padding-top: 8px;
}
.var-spends li {
  display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center;
  font-size: 13px; padding: 4px 0;
}
.var-spend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.var-spend-date { font-variant-numeric: tabular-nums; font-size: 12px; }
.var-spend-amt { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 4.5em; text-align: right; }
.var-spends-empty { margin: 0; padding-top: 4px; }
@media (max-width: 720px) {
  .var-spends li { grid-template-columns: 1fr auto auto; }
  .var-spend-date { display: none; }
}
.icon-btn.recv {
  min-width: auto; padding: 4px 8px; font-size: 11px; font-weight: 600;
  color: #86efac; border: 1px solid rgba(34, 197, 94, 0.35);
}
.form-more {
  border: 1px solid var(--line); border-radius: 10px; padding: 0; background: rgba(0, 0, 0, 0.18);
}
.form-more > summary {
  cursor: pointer; padding: 11px 14px; color: var(--muted); font-size: 13px; user-select: none;
  list-style: none;
}
.form-more > summary::-webkit-details-marker { display: none; }
.form-more > summary::before { content: "▸ "; color: var(--red); }
.form-more[open] > summary::before { content: "▾ "; }
.form-more[open] > summary { border-bottom: 1px solid var(--line); color: var(--text); }
.form-more-grid { padding: 12px 14px 14px; }
.form-more[hidden] { display: none !important; }

.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 64px 1fr 64px; gap: 8px; align-items: center; font-size: 12px; }
.bar-track { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; }
.bar-fill.inc { background: var(--ok); }
.bar-fill.exp { background: var(--red); }

.donut-wrap { display: flex; gap: 14px; align-items: center; }
.donut {
  width: 110px; height: 110px; border-radius: 50%; flex: 0 0 auto;
  background: conic-gradient(#ef1a2a 0 49%, #f59e0b 0 78%, #3b82f6 0 92%, #22c55e 0);
}
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.donut-legend span { display: flex; justify-content: space-between; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }

.timeline { display: flex; flex-direction: column; gap: 4px; }
.tl-item {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: start;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.tl-item:last-child { border-bottom: 0; }
.tl-day { font-weight: 700; color: #ff7a84; font-variant-numeric: tabular-nums; }
.tl-tag {
  font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: var(--red-soft); color: #ffb4b9; white-space: nowrap;
}
.tl-actions { margin-top: 6px; }

.cat-legend { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px;
  border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); font-size: 12px;
}

.view-panel { display: none; }
.view-panel.active { display: block; }

.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px;
}
.cal-head { text-align: center; font-size: 11px; color: var(--muted); padding: 4px; }
.cal-day {
  min-height: 72px; background: var(--card-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px; font-size: 11px;
}
.cal-day.empty { opacity: 0.35; }
.cal-day .n { font-weight: 700; margin-bottom: 4px; }
.cal-ev {
  display: block; padding: 2px 4px; border-radius: 4px; margin-bottom: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-ev.exp { background: rgba(239, 26, 42, 0.2); }
.cal-ev.inc { background: rgba(34, 197, 94, 0.2); }

.trend-chart { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; align-items: end; min-height: 180px; }
.trend-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.trend-bars { display: flex; gap: 4px; align-items: flex-end; height: 140px; width: 100%; justify-content: center; }
.trend-bars i {
  display: block; width: 14px; border-radius: 4px 4px 0 0; min-height: 2px;
}
.trend-bars i.inc { background: var(--ok); }
.trend-bars i.exp { background: var(--red); }
.trend-bars i.rem { background: var(--gold); }
.trend-col span { font-size: 11px; color: var(--muted); }

.overview-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.overview-cards article {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
}
.overview-cards span { display: block; font-size: 12px; color: var(--muted); }
.overview-cards strong { font-size: 18px; font-variant-numeric: tabular-nums; }

.export-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #1a1d27; border: 1px solid rgba(239, 26, 42, 0.28); color: #fff;
  padding: 11px 16px; border-radius: 10px; z-index: 100; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  font-size: 14px; max-width: min(520px, calc(100% - 24px)); text-align: center;
}
.toast.toast-ok { border-color: rgba(34, 197, 94, 0.45); }
.toast.toast-err { border-color: rgba(239, 26, 42, 0.65); background: #2a1216; }

.pz-user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin: 0 4px 10px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line);
}
.pz-avatar {
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--red-soft); color: #fff; font-weight: 700; font-size: 14px;
}
.pz-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pz-user-meta strong { display: block; font-size: 13px; line-height: 1.2; }
.pz-user-meta em { font-style: normal; font-size: 11px; color: var(--muted); }

.pz-sheet-wrap {
  display: flex; flex-direction: column; gap: 6px;
  padding: 0 8px 12px; font-size: 12px; color: var(--muted);
}
.pz-sheet-wrap select {
  width: 100%; appearance: none; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--text); padding: 9px 10px; font: inherit; font-size: 13px;
}
.pz-new-sheet { width: 100%; justify-content: center; }

.sheet-members { display: flex; flex-direction: column; gap: 8px; }
.sheet-member-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2);
}
.member-pick { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow: auto; }
.member-pick-btn {
  appearance: none; border: 1px solid var(--line); background: var(--card-2); color: var(--text);
  text-align: left; padding: 10px 12px; border-radius: 10px; cursor: pointer; font: inherit;
}
.member-pick-btn:hover { border-color: rgba(239, 26, 42, 0.4); background: var(--red-soft); }

.pz-dialog {
  border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text);
  padding: 0; width: min(400px, calc(100% - 24px));
}
.pz-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.pz-dialog form { display: grid; gap: 10px; padding: 18px; }
.pz-dialog h3 { margin: 0; }

/* Mobile card alternative for expense grid */
.expense-cards { display: none; flex-direction: column; gap: 10px; margin-top: 12px; }
.exp-card {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.exp-card header {
  display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 10px;
}
.exp-card .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.exp-card-months {
  display: flex; flex-wrap: nowrap; gap: 4px; overflow-x: auto; padding-bottom: 8px;
  -webkit-overflow-scrolling: touch; margin-bottom: 8px;
}
.exp-card .row-actions { gap: 6px; }

@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi.gauge { grid-column: 1 / -1; }
  .pz-grid-layout { grid-template-columns: 1fr; }
  .twin { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .pz-side {
    transform: translateX(-105%); transition: transform 0.2s ease;
  }
  .pz-app.side-open .pz-side { transform: none; }
  .pz-main { margin-left: 0; padding: 0 12px 36px; }
  .pz-burger {
    display: inline-grid; place-items: center; width: 42px; height: 42px;
    border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: #fff; cursor: pointer;
  }
  .form-grid { grid-template-columns: 1fr; }
  .trend-chart { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .table-scroll { max-height: none; display: none; }
  .expense-cards { display: flex; }
  .sm-hint { display: none; }
  .kpi strong { font-size: 20px; }
}
@media print {
  .pz-side, .pz-top-actions, .form-panel, .pz-burger, .expense-cards { display: none !important; }
  .table-scroll { display: block !important; max-height: none; overflow: visible; }
  .pz-main { margin: 0; }
  body { background: #fff; color: #111; }
  .panel, .kpi { border-color: #ccc; background: #fff; }
}
