/* Expense Management — switchboard theme
   Graphite rail, panel-grey page, white work surfaces, lamp-amber actions. */

@font-face { font-family: "Plex"; font-weight: 400; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Plex"; font-weight: 500; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Plex"; font-weight: 700; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Plex Cond"; font-weight: 500; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Plex Cond"; font-weight: 600; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-condensed-latin-600-normal.woff2") format("woff2"); }

:root {
  --ink: #1d2227;
  --ink-2: #4b545c;
  --ink-3: #6b757e;
  --panel: #edeeea;
  --surface: #ffffff;
  --line: #d3d6d0;
  --line-2: #e5e7e2;
  --rail: #23282d;
  --rail-hover: #2d343a;
  --rail-ink: #d3d8dc;
  --rail-dim: #939ca4;
  --lamp: #d9890b;
  --lamp-dark: #b87206;
  --lamp-ink: #1c1303;
  --lamp-soft: #fbf1dc;
  --ok: #2f7d4f;
  --ok-soft: #e3f0e8;
  --fault: #b83a2b;
  --fault-soft: #f8e5e1;
  --info: #1f5f8b;
  --info-soft: #e1edf5;
  --r-ctl: 4px;
  --r-panel: 6px;
  --rail-w: 244px;
  --font: "Plex", "Noto Sans Sinhala", "Iskoola Pota", "Nirmala UI", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-cond: "Plex Cond", "Plex", "Noto Sans Sinhala", "Iskoola Pota", system-ui, sans-serif;

  --bs-body-font-family: var(--font);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--panel);
  --bs-border-color: var(--line);
  --bs-link-color: var(--info);
  --bs-link-hover-color: #174a6c;
  --bs-primary: var(--lamp);
  --bs-primary-rgb: 217, 137, 11;
}

html { font-size: 15px; }
body { font-family: var(--font); background: var(--panel); color: var(--ink); line-height: 1.45; font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.005em; }
.text-muted, .text-secondary { color: var(--ink-3) !important; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--lamp); color: var(--lamp-ink); padding: .5rem 1rem; z-index: 1000; }
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }

/* ---------- frame ---------- */
body.app { display: flex; min-height: 100vh; }
.rail {
  width: var(--rail-w); flex: 0 0 var(--rail-w); background: var(--rail); color: var(--rail-ink);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; z-index: 40;
}
.rail-brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.1rem 1rem; color: #fff; text-decoration: none; border-bottom: 1px solid #343b42; }
.rail-mark { width: 34px; height: 34px; border-radius: var(--r-ctl); background: var(--lamp); color: var(--lamp-ink); display: grid; place-items: center; font-size: 1.15rem; }
.rail-name { font-family: var(--font-cond); font-weight: 600; font-size: 1.02rem; line-height: 1.1; letter-spacing: .01em; }
.rail-nav { padding: .5rem 0 1rem; flex: 1; }
.rail-group { padding: .65rem .6rem .2rem; }
.rail-title { font-family: var(--font-cond); font-weight: 600; font-size: .82rem; color: var(--rail-dim); padding: 0 .6rem .3rem; letter-spacing: .02em; }
.rail-link {
  display: flex; align-items: center; gap: .65rem; padding: .42rem .6rem; border-radius: var(--r-ctl);
  color: var(--rail-ink); text-decoration: none; font-size: .94rem; border-left: 3px solid transparent;
}
.rail-link i { color: var(--rail-dim); font-size: 1rem; width: 1.1rem; text-align: center; }
.rail-link:hover { background: var(--rail-hover); color: #fff; }
.rail-link.is-active { background: var(--rail-hover); color: #fff; border-left-color: var(--lamp); }
.rail-link.is-active i { color: var(--lamp); }
.rail-user { border-top: 1px solid #343b42; padding: .8rem 1.1rem; font-size: .9rem; }
.rail-user-name { color: #fff; font-weight: 500; }
.rail-user-links { display: flex; gap: 1rem; margin-top: .25rem; }
.rail-user-links a { color: var(--rail-dim); text-decoration: none; }
.rail-user-links a:hover { color: #fff; text-decoration: underline; }
.rail-scrim { display: none; }

.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
body.bare .shell { align-items: center; justify-content: center; padding: 1rem; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .9rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 1.35rem; margin: 0; line-height: 1.2; }
.topbar-title p { margin: .1rem 0 0; color: var(--ink-3); font-size: .9rem; }
.topbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.rail-toggle { display: none; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-ctl); width: 40px; height: 40px; font-size: 1.4rem; line-height: 1; }
.page { padding: 1.25rem 1.5rem 3rem; max-width: 1500px; width: 100%; }

@media (max-width: 991.98px) {
  .rail { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .18s ease; }
  body.rail-open .rail { transform: none; }
  body.rail-open .rail-scrim { display: block; position: fixed; inset: 0; background: rgba(20,24,28,.5); z-index: 35; }
  .rail-toggle { display: grid; place-items: center; }
  .topbar { padding: .7rem 1rem; }
  .page { padding: 1rem 1rem 3rem; }
}

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); margin-bottom: 1.1rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line-2); }
.panel-head h2 { font-size: 1.02rem; margin: 0; }
.panel-body { padding: 1rem; }
.panel-body.flush { padding: 0; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--ink-3); }
.empty-state i { font-size: 2rem; color: var(--line); }
.empty-state h2 { font-size: 1.1rem; color: var(--ink); margin: .5rem 0 .25rem; }

/* ---------- forms ---------- */
.form-label { font-weight: 500; font-size: .9rem; margin-bottom: .25rem; color: var(--ink-2); }
.form-control, .form-select { border-radius: var(--r-ctl); border-color: #c4c8c1; background-color: #fff; color: var(--ink); font-size: .95rem; padding: .42rem .65rem; }
.form-control:focus, .form-select:focus { background-color: #fff; color: var(--ink); border-color: var(--lamp); box-shadow: 0 0 0 .2rem rgba(217,137,11,.22); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--fault); background-image: none; }
.invalid-feedback { color: var(--fault); }
textarea.form-control { min-height: 4.2rem; }
.form-check-input:checked { background-color: var(--lamp); border-color: var(--lamp); }
.form-text { color: var(--ink-3); }

.btn { border-radius: var(--r-ctl); font-weight: 500; font-size: .93rem; padding: .42rem .9rem; }
.btn-primary { --bs-btn-bg: var(--lamp); --bs-btn-border-color: var(--lamp); --bs-btn-color: var(--lamp-ink);
  --bs-btn-hover-bg: var(--lamp-dark); --bs-btn-hover-border-color: var(--lamp-dark); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--lamp-dark); --bs-btn-active-border-color: var(--lamp-dark); --bs-btn-active-color: #fff;
  --bs-btn-focus-shadow-rgb: 217,137,11; --bs-btn-disabled-bg: var(--lamp); --bs-btn-disabled-border-color: var(--lamp); --bs-btn-disabled-color: var(--lamp-ink); }
.btn-outline-secondary { --bs-btn-color: var(--ink-2); --bs-btn-border-color: #c4c8c1; --bs-btn-hover-bg: var(--panel); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #a9aea6; --bs-btn-active-bg: var(--line-2); --bs-btn-active-color: var(--ink); }
.btn-outline-danger { --bs-btn-color: var(--fault); --bs-btn-border-color: #e1b4ad; --bs-btn-hover-bg: var(--fault); --bs-btn-hover-border-color: var(--fault); }
.btn-danger { --bs-btn-bg: var(--fault); --bs-btn-border-color: var(--fault); --bs-btn-hover-bg: #9a2f22; --bs-btn-hover-border-color: #9a2f22; }
.btn-sm { padding: .22rem .55rem; font-size: .85rem; }
.btn-icon { padding: .22rem .45rem; line-height: 1; }

.alert { border-radius: var(--r-ctl); border: 1px solid; font-size: .94rem; }
.alert-success { background: var(--ok-soft); border-color: #b9d8c5; color: #1c5535; }
.alert-danger { background: var(--fault-soft); border-color: #e7bdb6; color: #7d2a1f; }
.alert-info { background: var(--info-soft); border-color: #b7d2e4; color: #174a6c; }
.alert-warning { background: var(--lamp-soft); border-color: #ecd29b; color: #6b4503; }

/* ---------- filter bar ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .6rem .8rem; align-items: flex-end; padding: .8rem 1rem; border-bottom: 1px solid var(--line-2); background: #f7f8f5; border-radius: var(--r-panel) var(--r-panel) 0 0; }
.filters .f { display: flex; flex-direction: column; min-width: 0; }
.filters .f label { font-size: .8rem; color: var(--ink-3); margin-bottom: .15rem; font-weight: 500; }
.filters .form-control, .filters .form-select { padding: .3rem .55rem; font-size: .9rem; }
.filters .f-grow { flex: 1 1 14rem; }
.filters .range-only, .filters .month-only, .filters .year-only, .filters .day-only { display: none; }
.filters[data-period="range"] .range-only, .filters[data-period="month"] .month-only,
.filters[data-period="year"] .year-only, .filters[data-period="day"] .day-only { display: flex; }

/* ---------- ledger tables ---------- */
.ledger-wrap { overflow: auto; max-height: 68vh; }
table.ledger { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .93rem; margin: 0; }
.ledger th { position: sticky; top: 0; z-index: 2; background: var(--surface); font-family: var(--font-cond); font-weight: 600; font-size: .86rem; color: var(--ink-2);
  text-align: left; padding: .55rem .75rem; border-bottom: 2px solid var(--ink); white-space: nowrap; letter-spacing: .01em; }
.ledger td { padding: .5rem .75rem; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.ledger tbody tr:hover td { background: #f8f9f6; }
.ledger .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger .act { text-align: right; white-space: nowrap; width: 1%; }
.ledger .wrap { min-width: 14rem; max-width: 34rem; overflow-wrap: anywhere; }
.ledger .dim { color: var(--ink-3); }
.ledger tr.row-done td { color: var(--ink-3); }
.ledger tr.row-hot td:first-child { box-shadow: inset 3px 0 0 var(--fault); }
.ledger tr.row-warm td:first-child { box-shadow: inset 3px 0 0 var(--lamp); }
.ledger tr.row-ok td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.ledger-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1.6rem; padding: .7rem 1rem; border-top: 2px solid var(--ink); background: #fafaf8; border-radius: 0 0 var(--r-panel) var(--r-panel); }
.ledger-foot .k { color: var(--ink-3); font-size: .86rem; margin-right: .35rem; }
.ledger-foot .v { font-weight: 600; font-size: 1.05rem; }
.ledger-foot .grow { flex: 1; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: var(--r-ctl); border: 1px solid var(--line); background: #fff; }

.tag { display: inline-block; padding: .08rem .5rem; border-radius: 99px; font-size: .8rem; font-weight: 500; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.tag-ok { background: var(--ok-soft); color: #1c5535; }
.tag-warn { background: var(--lamp-soft); color: #6b4503; }
.tag-fault { background: var(--fault-soft); color: #7d2a1f; }
.tag-info { background: var(--info-soft); color: #174a6c; }

.pager { display: flex; gap: .25rem; align-items: center; margin-left: auto; }
.pager a, .pager span { padding: .2rem .6rem; border: 1px solid var(--line); border-radius: var(--r-ctl); color: var(--ink-2); text-decoration: none; font-size: .88rem; background: #fff; }
.pager .on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager a:hover { background: var(--panel); }

/* ---------- dashboard ---------- */
.readout { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.readout > div { padding: 1rem 1.1rem; border-right: 1px solid var(--line-2); min-width: 0; }
.readout > div:last-child { border-right: 0; }
.readout .k { color: var(--ink-3); font-size: .88rem; }
.readout .v { font-size: 1.7rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.15; margin-top: .15rem; }
.readout .v small { font-size: .8rem; color: var(--ink-3); font-weight: 500; letter-spacing: 0; margin-right: .2rem; }
.readout .d { font-size: .85rem; margin-top: .2rem; color: var(--ink-3); }
.readout .up { color: var(--fault); }
.readout .down { color: var(--ok); }
@media (max-width: 767.98px) {
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readout > div:nth-child(2) { border-right: 0; }
  .readout > div:nth-child(-n+2) { border-bottom: 1px solid var(--line-2); }
}
.chart-box { position: relative; height: 280px; padding: .5rem 1rem 1rem; }
.chart-box.short { height: 220px; }

.remind { list-style: none; margin: 0; padding: 0; }
.remind li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 1rem; border-bottom: 1px solid var(--line-2); }
.remind li:last-child { border-bottom: 0; }
.remind .t { font-weight: 500; }
.remind .s { color: var(--ink-3); font-size: .86rem; }
.remind .when { white-space: nowrap; font-weight: 600; text-align: right; }
.remind .hot .when { color: var(--fault); }
.remind .warm .when { color: #946105; }


/* ---------- login ---------- */
.login { width: 100%; max-width: 380px; }
.login-mark { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.login-mark .rail-mark { width: 44px; height: 44px; font-size: 1.4rem; }
.login-mark h1 { font-size: 1.3rem; margin: 0; line-height: 1.15; }
.login-mark p { margin: 0; color: var(--ink-3); font-size: .9rem; }

/* ---------- misc ---------- */
.quick-amount { font-size: 1.15rem; font-weight: 600; text-align: right; }
.sticky-form { position: sticky; top: 76px; }
.modal-content { border-radius: var(--r-panel); border-color: var(--line); }
.modal-header { border-bottom-color: var(--line-2); }
.modal-footer { border-top-color: var(--line-2); }
.vault-secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--panel); padding: .1rem .4rem; border-radius: 3px; }
.detail-grid { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; }
.detail-grid dt { color: var(--ink-3); font-weight: 500; }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; }

@media print {
  .rail, .topbar, .filters, .no-print, .rail-scrim, .alert { display: none !important; }
  body.app { display: block; background: #fff; }
  .page { padding: 0; max-width: none; }
  .panel { border: 0; }
  .ledger-wrap { max-height: none; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.ledger .nw { white-space: nowrap; }

/* password vault */
.vault-list-old { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(21rem, 100%), 1fr)); align-items: start; margin-top: 1rem; }
.vault-card { margin: 0; }
.vault-card .panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.vault-card .panel-head h2 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.vault-rows { padding: .25rem 1rem .75rem; }
.vault-row { display: grid; grid-template-columns: 7.5rem 1fr auto; gap: .5rem; align-items: center; padding: .3rem 0; border-top: 1px solid var(--line-2); }
.vault-row:first-child { border-top: 0; }
.vault-k { color: var(--ink-3, #6b757e); font-size: .85rem; }
.vault-v { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.vault-t { white-space: nowrap; }
@media (max-width: 575px) { .vault-list { grid-template-columns: minmax(0, 1fr); } .vault-row { grid-template-columns: 6rem 1fr auto; } }
.vault-card .panel-head > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.vault-card .panel-head { flex-wrap: wrap; }

/* ================= colourful, raised look ================= */
:root { --panel: #eef0fb; --line: #dcdff2; --line-2: #e8eaf7; --info: #3b5bdb; }
body, body.app { background: linear-gradient(160deg, #eef0fb 0%, #f5eefb 55%, #eaf6fb 100%) fixed; }
.topbar { background: rgba(255,255,255,.9); backdrop-filter: blur(6px); box-shadow: 0 2px 10px rgba(79,70,229,.08); }
.panel { border: 0; border-radius: 14px; box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 8px 20px -10px rgba(67,56,202,.28), 0 2px 4px rgba(67,56,202,.08); }
.panel-head { border-bottom: 1px solid var(--line-2); }
.btn-primary { background: linear-gradient(180deg, #fbb024, #e8890a); border: 0; color: #2b1a02; font-weight: 600; box-shadow: 0 3px 0 #b86a05, 0 8px 14px -6px rgba(232,137,10,.6); }
.btn-primary:hover { background: linear-gradient(180deg, #fcbc40, #f0930f); color: #2b1a02; }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #b86a05; }

/* sidebar */
.rail { background: linear-gradient(180deg, #1e1b4b 0%, #2e2a73 60%, #3b2d7a 100%); }
.rail-brand { border-bottom-color: rgba(255,255,255,.12); }
.rail-mark { background: linear-gradient(135deg, #fbbf24, #f97316); color: #3b1d00; box-shadow: 0 4px 10px rgba(249,115,22,.5); }
.rail-nav { padding: .6rem .6rem 1rem; }
.rail-top { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: 10px; color: #e8e8ff; text-decoration: none; cursor: pointer; font-weight: 500; list-style: none; margin-bottom: .15rem; }
.rail-top::-webkit-details-marker { display: none; }
.rail-top > i:first-child { width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: 9px; font-size: 1rem; color: #fff; background: var(--tone, #6366f1); box-shadow: 0 3px 8px -2px var(--tone, #6366f1), inset 0 1px 0 rgba(255,255,255,.35); }
.rail-top:hover { background: rgba(255,255,255,.09); color: #fff; }
.rail-top.is-active { background: rgba(255,255,255,.16); color: #fff; }
.rail-caret { margin-left: auto; font-size: .8rem; opacity: .7; transition: transform .15s ease; }
details[open] > summary .rail-caret { transform: rotate(180deg); }
.rail-sub { margin: .1rem 0 .4rem 1.05rem; padding-left: .55rem; border-left: 2px solid rgba(255,255,255,.14); }
.rail-sub .rail-link { border-left: 0; border-radius: 8px; padding: .42rem .6rem; color: #cfd0f5; }
.rail-sub .rail-link i { color: #a5a8f0; }
.rail-sub .rail-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.rail-sub .rail-link.is-active { background: rgba(255,255,255,.18); color: #fff; }
.rail-sub .rail-link.is-active i { color: #fde68a; }
.rail-user { border-top-color: rgba(255,255,255,.12); }
.rail-user-links a { color: #b9bbf0; }
.tone-0 { --tone: #6366f1; } .tone-1 { --tone: #10b981; } .tone-2 { --tone: #06b6d4; } .tone-3 { --tone: #f59e0b; }
.tone-4 { --tone: #ec4899; } .tone-5 { --tone: #8b5cf6; } .tone-6 { --tone: #ef4444; } .tone-7 { --tone: #14b8a6; }

/* dashboard tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.1rem; margin-bottom: 1.6rem; perspective: 900px; }
.tile { position: relative; overflow: hidden; border-radius: 16px; padding: 1.05rem 1.15rem 1rem; color: #fff; min-width: 0;
  background: linear-gradient(145deg, var(--c1), var(--c2));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.4), inset 0 -5px 0 rgba(0,0,0,.16), 0 5px 0 var(--c3), 0 16px 24px -10px var(--c2);
  transition: transform .18s ease, box-shadow .18s ease; transform-style: preserve-3d; }
.tile:hover { transform: translateY(-3px) rotateX(5deg); }
.tile .k { font-size: .9rem; opacity: .92; font-weight: 500; }
.tile .v { font-size: 1.65rem; font-weight: 700; line-height: 1.2; margin-top: .2rem; text-shadow: 0 2px 4px rgba(0,0,0,.22); overflow-wrap: anywhere; }
.tile .v small { font-size: .8rem; opacity: .85; font-weight: 600; margin-right: .25rem; }
.tile .d { font-size: .82rem; margin-top: .25rem; opacity: .92; }
.tile-ico { position: absolute; right: -.3rem; bottom: -.9rem; font-size: 4.6rem; opacity: .22; transform: rotate(-10deg); }
.t-blue   { --c1: #22d3ee; --c2: #2563eb; --c3: #1e40af; }
.t-green  { --c1: #34d399; --c2: #059669; --c3: #065f46; }
.t-orange { --c1: #fbbf24; --c2: #ea580c; --c3: #9a3412; }
.t-purple { --c1: #c084fc; --c2: #7c3aed; --c3: #4c1d95; }
@media (max-width: 991px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .tile .v { font-size: 1.35rem; } }

/* 3D pie */
.pie3d { position: relative; height: 210px; margin: .2rem auto .6rem; max-width: 320px; }
.pie3d canvas { position: absolute; left: 50%; top: 50%; width: 300px; height: 300px; margin: -150px 0 0 -150px; }
#pieTop { transform: perspective(900px) rotateX(56deg); }
#pieShadow { transform: translateY(15px) perspective(900px) rotateX(56deg); filter: drop-shadow(0 14px 10px rgba(30,27,75,.3)); }
.pie-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.pie-legend li { display: grid; grid-template-columns: .8rem 1fr auto 3rem; gap: .6rem; align-items: center; padding: .28rem 0; border-top: 1px solid var(--line-2); font-size: .92rem; }
.pie-legend li:first-child { border-top: 0; }
.pie-legend .dot { width: .8rem; height: .8rem; border-radius: 4px; box-shadow: inset 0 -2px 0 rgba(0,0,0,.2), 0 2px 3px rgba(0,0,0,.2); }
.pie-legend .nm { overflow-wrap: anywhere; }
.pie-legend .am { text-align: right; font-variant-numeric: tabular-nums; }
.pie-legend .pc { text-align: right; color: var(--ink-3); }
.chart-box { padding: .5rem .75rem 0; }
.qa-tabs { display: flex; gap: .4rem; padding: .7rem 1rem 0; }
.qa-tab { flex: 1; border: 0; padding: .5rem .6rem; border-radius: 10px 10px 0 0; background: #eceefb; color: var(--ink-2); font-weight: 600; box-shadow: inset 0 -3px 0 rgba(0,0,0,.06); }
.qa-tab.is-on { background: linear-gradient(180deg, #6366f1, #4f46e5); color: #fff; box-shadow: 0 -2px 8px -3px rgba(79,70,229,.6); }

.vault-list { margin-top: 1rem; }
.vault-table td { vertical-align: top; }
.vault-table td.wrap { min-width: 10rem; }
.vault-table .vv { overflow-wrap: anywhere; }
.vault-table .ledger-wrap, .vault-list .ledger-wrap { max-height: none; }
.vault-table { min-width: 960px; }
.vault-table td.secret, .vault-table .btn { white-space: nowrap; }
.vault-table td:nth-child(4) { min-width: 9rem; }

/* card headers: coloured band like the old template */
.panel > .panel-head, details.panel > summary.panel-head { background: linear-gradient(90deg, #2563eb, #4f46e5); color: #fff; border-radius: 14px 14px 0 0; border-bottom: 0; }
.panel > .panel-head h2, details.panel > summary.panel-head h2 { color: #fff; }
.panel > .panel-head a, .panel > .panel-head .text-muted, details.panel > summary.panel-head .text-muted { color: #e0e7ff !important; }
.panel > .panel-head .btn-outline-secondary { color: #fff; border-color: rgba(255,255,255,.6); }
.panel > .panel-head .btn-outline-secondary:hover { background: rgba(255,255,255,.18); }
.filters { border-radius: 0; }

/* dashboard calendar */
.widget-cal { background: linear-gradient(160deg, #34b567, #1f9c4a); color: #fff; }
.widget-cal > .panel-head { background: transparent; }
.widget-cal .cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.widget-cal .cal-nav button { border: 0; background: rgba(255,255,255,.18); color: #fff; width: 2.1rem; height: 2.1rem; border-radius: 10px; }
.widget-cal .cal-nav button:hover { background: rgba(255,255,255,.3); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; text-align: center; }
.cal-dow { font-weight: 700; padding: .3rem 0; font-size: .9rem; }
.cal-day { border: 0; background: transparent; color: #fff; padding: .45rem 0; border-radius: 9px; font-size: .95rem; position: relative; }
.cal-day:hover { background: rgba(255,255,255,.2); }
.cal-day.is-other { color: rgba(255,255,255,.45); }
.cal-day.is-today { background: #166a33; box-shadow: inset 0 -3px 0 rgba(0,0,0,.2); font-weight: 700; }
.cal-day.is-picked { background: #4be07a; color: #0b3a1a; font-weight: 700; box-shadow: 0 4px 8px -3px rgba(0,0,0,.35); }
.cal-day.has-note::after { content: ""; position: absolute; right: 5px; top: 5px; border: 4px solid transparent; border-top-color: #fde047; border-right-color: #fde047; }
.cal-note { margin-top: .7rem; padding: .55rem .75rem; background: rgba(0,0,0,.16); border-radius: 10px; font-size: .92rem; overflow-wrap: anywhere; }
/* dashboard calculator */
.widget-calc { background: linear-gradient(160deg, #3b3a8f, #1e1b4b); color: #fff; }
.widget-calc > .panel-head { background: transparent; }
.calc { max-width: 22rem; margin: 0 auto; outline: none; }
.calc:focus-visible { outline: 2px solid #fde047; outline-offset: 4px; border-radius: 12px; }
.calc-screen { background: #0f0d2e; border-radius: 12px; padding: .6rem .9rem; text-align: right; box-shadow: inset 0 3px 8px rgba(0,0,0,.5); margin-bottom: .8rem; }
.calc-hist { min-height: 1.2rem; color: #a5a8f0; font-size: .85rem; }
.calc-disp { font-size: 2rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: .55rem; }
.calc-keys button { border: 0; border-radius: 12px; padding: .75rem 0; font-size: 1.15rem; font-weight: 600; color: #1e1b4b; background: linear-gradient(180deg, #ffffff, #dfe2ff); box-shadow: 0 4px 0 #9a9fe0, 0 8px 10px -4px rgba(0,0,0,.4); }
.calc-keys button:active { transform: translateY(3px); box-shadow: 0 1px 0 #9a9fe0; }
.calc-keys .k-fn { background: linear-gradient(180deg, #fecaca, #f87171); box-shadow: 0 4px 0 #b91c1c, 0 8px 10px -4px rgba(0,0,0,.4); color: #450a0a; }
.calc-keys .k-op { background: linear-gradient(180deg, #fde68a, #f59e0b); box-shadow: 0 4px 0 #b45309, 0 8px 10px -4px rgba(0,0,0,.4); color: #3b1d00; }
.calc-keys .k-eq { background: linear-gradient(180deg, #6ee7b7, #10b981); box-shadow: 0 4px 0 #047857, 0 8px 10px -4px rgba(0,0,0,.4); color: #022c22; }
.widget-cal > .panel-head, .widget-calc > .panel-head { border-radius: 14px 14px 0 0; }

/* card header colours: blue (default), green, red, orange, purple */
.panel.hd-blue > .panel-head, details.panel.hd-blue > summary.panel-head { background: linear-gradient(90deg, #2563eb, #4f46e5); }
.panel.hd-green > .panel-head, details.panel.hd-green > summary.panel-head { background: linear-gradient(90deg, #16a34a, #0d9488); }
.panel.hd-red > .panel-head, details.panel.hd-red > summary.panel-head { background: linear-gradient(90deg, #ef4444, #db2777); }
.panel.hd-orange > .panel-head { background: linear-gradient(90deg, #f59e0b, #ea580c); }
.panel.hd-purple > .panel-head { background: linear-gradient(90deg, #8b5cf6, #6d28d9); }
.panel-head .btn-outline-secondary { background: rgba(255,255,255,.15); }

/* coloured notification rows */
.ledger tr.row-hot > td { background: #fde2e2; color: #7f1d1d; }
.ledger tr.row-warm > td { background: #fdf0c8; color: #78350f; }
.ledger tr.row-ok > td { background: #cfeedb; color: #14532d; }
.ledger tr.row-hot > td:first-child { box-shadow: inset 4px 0 0 #dc2626; }
.ledger tr.row-warm > td:first-child { box-shadow: inset 4px 0 0 #f59e0b; }
.ledger tr.row-ok > td:first-child { box-shadow: inset 4px 0 0 #16a34a; }
.ledger tr.row-hot:hover > td, .ledger tr.row-warm:hover > td, .ledger tr.row-ok:hover > td { filter: brightness(.97); }

/* expense summary */
.es-form { display: flex; flex-wrap: wrap; gap: .9rem 1.6rem; align-items: center; }
.es-mode { display: flex; flex-wrap: wrap; gap: .5rem .7rem; align-items: center; }
.es-mode .form-control { width: auto; }
.es-range { color: var(--ink-3); font-size: .9rem; margin-bottom: .6rem; }
.es-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(23rem, 100%), 1fr)); gap: .3rem 2rem; }
.es-row { display: grid; grid-template-columns: minmax(6rem, 1fr) 7.5rem 4.6rem; gap: .5rem; align-items: center; padding: .3rem 0; border-bottom: 1px dashed var(--line); position: relative; }
.es-name { font-weight: 600; overflow-wrap: anywhere; }
.es-amt { text-align: right; padding: .2rem .5rem; background: #f4f5fd; border-radius: 6px; font-variant-numeric: tabular-nums; }
.es-pc { text-align: right; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.es-row.has .es-amt { background: #e0e7ff; color: #312e81; font-weight: 600; }
.es-row.has .es-pc { color: #4338ca; }
.es-bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: transparent; overflow: hidden; }
.es-bar i { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #ec4899); border-radius: 4px; }
.es-total { display: flex; justify-content: space-between; margin-top: .8rem; padding: .7rem 1rem; border-radius: 10px; background: linear-gradient(90deg, #2563eb, #4f46e5); color: #fff; font-size: 1.05rem; }

/* matching heights: panels in the same row line up */
.eqrow { margin-bottom: 1.1rem; }
.eqrow > [class*="col"] > .panel, .eqrow > [class*="col"] > form.panel { height: 100%; margin-bottom: 0; display: flex; flex-direction: column; }
.eqrow > [class*="col"] > .panel > .panel-body, .eqrow > [class*="col"] > .panel > .qa-form { flex: 1 1 auto; }
.widget-cal > .panel-body { display: flex; flex-direction: column; }
.widget-cal .cal-grid { flex: 1 1 auto; grid-template-rows: auto repeat(6, minmax(2.4rem, 1fr)); }
.widget-cal .cal-day { padding: 0; }
.widget-calc > .panel-body { display: flex; align-items: center; justify-content: center; }
.widget-calc .calc { width: 100%; }
/* summary rows all the same height */
.es-bar { background: #eef0fb; }
.es-row { padding: .35rem 0 .3rem; }
.es-row:not(.has) .es-name { color: var(--ink-2); font-weight: 500; }
.es-grid { grid-auto-rows: 3.2rem; align-items: center; }

/* expense summary: one simple list, like the old page */
.es-list { max-width: 34rem; }
.es-line { display: grid; grid-template-columns: 11rem 1fr 5.5rem; gap: .6rem; align-items: center; margin-bottom: .35rem; }
.es-line .es-name { font-weight: 700; overflow-wrap: anywhere; }
.es-line .es-amt { text-align: left; padding: .4rem .6rem; background: #fff; border: 1px solid #b9bcd6; border-radius: 6px; font-variant-numeric: tabular-nums; }
.es-line.has .es-amt { background: #e8ecff; border-color: #6366f1; color: #1e1b4b; font-weight: 700; }
.es-line .es-pc { font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.es-line.has .es-pc { color: #4338ca; }
.es-line.es-sum { margin-top: .8rem; }
.es-line.es-sum .es-amt { background: linear-gradient(90deg, #2563eb, #4f46e5); border-color: transparent; color: #fff; font-weight: 700; }
@media (max-width: 480px) { .es-line { grid-template-columns: 8rem 1fr 4.6rem; } }

/* 3D pie, Google-chart style: tilted disc with thickness, % on the slices, legend beside it */
.pie-wrap { display: flex; flex-wrap: wrap; gap: .8rem 1.4rem; align-items: center; justify-content: center; }
.pie3d { position: relative; flex: 0 0 300px; width: 300px; height: 200px; margin: 0; max-width: 100%; }
.pie3d canvas { position: absolute; left: 0; top: 50%; width: 300px; height: 300px; margin: -150px 0 0 0; }
#pieTop { transform: scaleY(.6); }
#pieShadow { transform: translateY(16px) scaleY(.6); filter: drop-shadow(0 10px 8px rgba(30,27,75,.3)); }
.pie-labels { position: absolute; inset: 0; pointer-events: none; }
.pie-labels span { position: absolute; transform: translate(-50%, -50%); color: #fff; font-weight: 700; font-size: .85rem; text-shadow: 0 1px 2px rgba(0,0,0,.45); white-space: nowrap; }
.pie-legend { flex: 1 1 11rem; min-width: 10rem; max-width: 18rem; }
.pie-legend li { grid-template-columns: .8rem 1fr auto; }
.pie-legend .dot { border-radius: 50%; }
.nowrap { white-space: nowrap; }
