/* Kanjō — soft-extruded ledger.
   Layout: one continuous mist surface. Things you read are raised from it (panels, statements, the menu);
   things you type into are pressed into it (fields, the period switch). The logo's blue carries every action;
   its orange appears once, as the short "macron" bar that marks where you are. */
:root {
  /* surface */
  --bg: #E7ECF2;
  --bg-deep: #DFE5ED;
  --sh-dark: rgba(146, 162, 186, .55);
  --sh-light: rgba(255, 255, 255, .92);
  --hover: rgba(255, 255, 255, .45);
  --line: rgba(118, 134, 158, .2);
  --line-2: rgba(118, 134, 158, .42);
  /* ink */
  --ink: #172133;
  --ink-2: #536075;
  --ink-3: #7D899C;
  /* brand */
  --accent: #1471E0;
  --accent-hi: #0D5FC4;
  --accent-soft: rgba(20, 113, 224, .12);
  --accent-grad: linear-gradient(145deg, #2F9CFF 0%, #1471E0 55%, #0C5CC4 100%);
  --orange: #F28418;
  --orange-grad: linear-gradient(145deg, #FFAE45 0%, #F28418 60%, #E06A0B 100%);
  --on-accent: #FFFFFF;
  /* meaning */
  --good: #0E7A54; --good-bg: rgba(14, 122, 84, .12);
  --warn: #9E5A00; --warn-bg: rgba(242, 132, 24, .17);
  --bad: #C12E2E; --bad-bg: rgba(193, 46, 46, .11);
  --info: #1366CA; --info-bg: rgba(20, 113, 224, .11);
  /* depth */
  --raise: 9px 9px 20px var(--sh-dark), -9px -9px 20px var(--sh-light);
  --raise-sm: 5px 5px 12px var(--sh-dark), -5px -5px 12px var(--sh-light);
  --raise-xs: 2px 2px 6px var(--sh-dark), -2px -2px 6px var(--sh-light);
  --inset: inset 5px 5px 10px var(--sh-dark), inset -5px -5px 10px var(--sh-light);
  --inset-sm: inset 2px 2px 5px var(--sh-dark), inset -2px -2px 5px var(--sh-light);
  --glow: 0 10px 22px -6px rgba(20, 113, 224, .55);
  --glow-orange: 0 10px 22px -8px rgba(242, 132, 24, .6);
  --drawer: -24px 0 48px -12px rgba(23, 33, 51, .28);
  --scrim: rgba(23, 33, 51, .28);
  /* older names the screens still use */
  --rule: var(--line); --rule-2: var(--line-2); --pad: var(--bg-deep); --sheet: var(--bg); --paper: var(--bg); --accent-tint: var(--accent-soft);
  /* type */
  --f-display: "Sora", "Manrope", "Segoe UI", system-ui, sans-serif;
  --f-body: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  /* shape */
  --r: 18px; --r-sm: 12px; --r-lg: 26px;
  --side-w: 268px;
  --tabs-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B2029; --bg-deep: #171B23;
    --sh-dark: rgba(5, 7, 11, .62); --sh-light: rgba(56, 66, 84, .38);
    --hover: rgba(255, 255, 255, .03);
    --line: rgba(160, 176, 202, .12); --line-2: rgba(160, 176, 202, .28);
    --ink: #E8EEF6; --ink-2: #A4AFC0; --ink-3: #758195;
    --accent: #47A3FF; --accent-hi: #6DB6FF; --accent-soft: rgba(71, 163, 255, .15);
    --accent-grad: linear-gradient(145deg, #3FA8FF 0%, #1C79E8 55%, #1262CC 100%);
    --orange: #FF9C35; --orange-grad: linear-gradient(145deg, #FFB24D 0%, #FF9030 60%, #EF7615 100%);
    --good: #52D49C; --good-bg: rgba(82, 212, 156, .13);
    --warn: #FFB45E; --warn-bg: rgba(255, 156, 53, .15);
    --bad: #FF7B73; --bad-bg: rgba(255, 123, 115, .13);
    --info: #82BCFF; --info-bg: rgba(71, 163, 255, .15);
    --glow: 0 10px 24px -6px rgba(28, 121, 232, .6);
    --glow-orange: 0 10px 24px -8px rgba(255, 144, 48, .55);
    --drawer: -24px 0 48px -12px rgba(0, 0, 0, .6);
    --scrim: rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1B2029; --bg-deep: #171B23;
  --sh-dark: rgba(5, 7, 11, .62); --sh-light: rgba(56, 66, 84, .38);
  --hover: rgba(255, 255, 255, .03);
  --line: rgba(160, 176, 202, .12); --line-2: rgba(160, 176, 202, .28);
  --ink: #E8EEF6; --ink-2: #A4AFC0; --ink-3: #758195;
  --accent: #47A3FF; --accent-hi: #6DB6FF; --accent-soft: rgba(71, 163, 255, .15);
  --accent-grad: linear-gradient(145deg, #3FA8FF 0%, #1C79E8 55%, #1262CC 100%);
  --orange: #FF9C35; --orange-grad: linear-gradient(145deg, #FFB24D 0%, #FF9030 60%, #EF7615 100%);
  --good: #52D49C; --good-bg: rgba(82, 212, 156, .13);
  --warn: #FFB45E; --warn-bg: rgba(255, 156, 53, .15);
  --bad: #FF7B73; --bad-bg: rgba(255, 123, 115, .13);
  --info: #82BCFF; --info-bg: rgba(71, 163, 255, .15);
  --glow: 0 10px 24px -6px rgba(28, 121, 232, .6);
  --glow-orange: 0 10px 24px -8px rgba(255, 144, 48, .55);
  --drawer: -24px 0 48px -12px rgba(0, 0, 0, .6);
  --scrim: rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 14.5px; line-height: 1.5; font-weight: 500;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
img { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; margin: 0; }
.num, td.amt, .amt { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--f-mono); font-size: .88em; font-weight: 400; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.eyebrow { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- shell ---------- */
#app { min-height: 100%; }
#side { display: none; }
#pane { min-width: 0; }
#top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 10px;
  display: flex; align-items: center; gap: 12px; min-height: 62px;
}
#top .brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand-mark { width: 40px; height: 40px; flex: none; object-fit: contain; filter: drop-shadow(2px 3px 4px var(--sh-dark)); }
.co-btn { display: flex; flex-direction: column; align-items: flex-start; background: none; border: 0; padding: 4px 8px; cursor: pointer; min-width: 0; border-radius: 12px; text-align: left; }
.co-btn .co-name { font-family: var(--f-display); font-weight: 700; font-size: 16px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; letter-spacing: -0.01em; }
.co-btn .co-sub { font-size: 11.5px; color: var(--ink-2); display: flex; align-items: center; gap: 4px; }
.co-btn:hover { box-shadow: var(--raise-xs); }
.co-btn:active { box-shadow: var(--inset-sm); }
#banner:empty { display: none; }
#banner { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-top: 4px; }
.practice-band {
  border-radius: 14px; padding: 9px 14px; font-size: 12.5px; font-weight: 600;
  background: var(--warn-bg); color: var(--warn); box-shadow: var(--inset-sm);
}
#main {
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 16px calc(var(--tabs-h) + 44px + env(safe-area-inset-bottom, 0px));
  max-width: 1200px;
}
/* phone: a floating tab bar */
#tabs {
  position: fixed; z-index: 25;
  left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  height: var(--tabs-h); padding: 6px; border-radius: 22px;
  background: var(--bg); box-shadow: var(--raise);
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
}
#tabs button { position: relative; background: none; border: 0; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--ink-3); cursor: pointer; }
#tabs button svg { width: 21px; height: 21px; }
#tabs button[aria-current="page"] { color: var(--accent); box-shadow: var(--inset-sm); }
#tabs button[aria-current="page"]::before { content: ""; position: absolute; top: 5px; width: 14px; height: 3px; border-radius: 2px; background: var(--orange-grad); }
.fab {
  position: fixed; z-index: 26; right: calc(18px + env(safe-area-inset-right, 0px));
  bottom: calc(var(--tabs-h) + 24px + env(safe-area-inset-bottom, 0px));
  height: 54px; padding: 0 22px 0 18px; border-radius: 27px; border: 0;
  background: var(--accent-grad); color: var(--on-accent); font-weight: 700; letter-spacing: .01em;
  box-shadow: var(--glow), var(--raise-sm);
  display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.fab svg { width: 20px; height: 20px; }
.fab:active { transform: translateY(1px); box-shadow: var(--glow); }
#top .top-new, #top .top-date { display: none; }

@media (min-width: 960px) {
  #app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
  #side {
    display: flex; flex-direction: column; gap: 3px;
    position: sticky; top: 16px; height: calc(100vh - 32px); overflow-y: auto;
    margin: 16px 0 16px max(16px, env(safe-area-inset-left, 0px));
    padding: 20px 14px 16px; border-radius: var(--r-lg);
    background: var(--bg); box-shadow: var(--raise);
    scrollbar-width: thin; z-index: 22;
  }
  #tabs, .fab { display: none; }
  #top .brand .brand-mark, #top .co-btn { display: none; }
  #top .top-new { display: inline-flex; }
  #top .top-date { display: inline; }
  #top { padding-left: 32px; padding-right: 32px; min-height: 72px; }
  #banner { padding-left: 32px; padding-right: 32px; }
  #main { padding-block: 18px 56px; padding-left: 32px; padding-right: 32px; }
}
.side-brand { display: flex; align-items: center; padding: 2px 8px 18px; }
.brand-lockup { display: block; height: 46px; width: auto; filter: drop-shadow(2px 3px 4px var(--sh-dark)); }
.side-co { border: 0; border-radius: 16px; padding: 12px 14px; background: var(--bg); box-shadow: var(--inset-sm); text-align: left; cursor: pointer; margin-bottom: 8px; display: flex; flex-direction: column; gap: 1px; }
.side-co:hover { box-shadow: var(--inset); }
.side-co .co-name { font-family: var(--f-display); font-weight: 700; letter-spacing: -0.01em; display: block; }
.side-co .co-sub { font-size: 12px; color: var(--ink-2); }
.side-label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; padding: 14px 12px 5px; }
.side-link {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 13px; border: 0; background: none;
  cursor: pointer; text-align: left; color: var(--ink-2); font-weight: 600; transition: box-shadow .15s ease, color .15s ease;
}
.side-link svg { width: 18px; height: 18px; flex: none; }
.side-link:hover { color: var(--ink); box-shadow: var(--raise-xs); }
.side-link[aria-current="page"] { color: var(--accent); box-shadow: var(--inset-sm); }
.side-link[aria-current="page"]::after { content: ""; position: absolute; right: 12px; width: 14px; height: 4px; border-radius: 2px; background: var(--orange-grad); }
.side-foot { margin-top: auto; padding: 14px 4px 0; font-size: 12px; color: var(--ink-3); }
.side-me { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 0; background: var(--bg); box-shadow: var(--raise-sm); border-radius: 16px; padding: 11px 14px; cursor: pointer; text-align: left; font-size: 12px; color: var(--ink-3); }
.side-me:hover { box-shadow: var(--raise-xs); }
.side-me:active { box-shadow: var(--inset-sm); }
.side-me-name { font-weight: 700; font-size: 13.5px; color: var(--ink); }

/* ---------- common ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: clamp(24px, 3.4vw, 32px); }
.page-head .sub { color: var(--ink-2); margin-top: 4px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px; border-radius: 13px; border: 0;
  background: var(--bg); color: var(--ink); box-shadow: var(--raise-sm);
  font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: box-shadow .15s ease, transform .1s ease, color .15s ease;
}
.btn:hover { color: var(--accent); }
.btn:active { box-shadow: var(--inset-sm); }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--accent-grad); color: var(--on-accent); box-shadow: var(--glow), var(--raise-xs); }
.btn.primary:hover { color: var(--on-accent); filter: brightness(1.05); }
.btn.primary:active { transform: translateY(1px); box-shadow: inset 2px 2px 6px rgba(0, 0, 0, .25); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: none; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { box-shadow: var(--raise-xs); color: var(--ink); }
.btn.sm { height: 33px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
.btn.block { width: 100%; height: 48px; font-size: 15px; border-radius: 15px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; filter: none; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 9px; border-radius: 12px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--bg-deep); color: var(--ink-2); }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.void { text-decoration: line-through; }
.seg { display: inline-flex; background: var(--bg); box-shadow: var(--inset-sm); border-radius: 14px; padding: 4px; gap: 3px; flex-wrap: wrap; max-width: 100%; }
.seg button { border: 0; background: none; padding: 7px 13px; border-radius: 10px; font-weight: 700; font-size: 13px; color: var(--ink-3); cursor: pointer; white-space: nowrap; transition: box-shadow .15s ease, color .15s ease; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--bg); color: var(--accent); box-shadow: var(--raise-xs); }
.card { background: var(--bg); border-radius: var(--r); box-shadow: var(--raise); }
.card-pad { padding: 18px 20px; }
.card .list { box-shadow: none; background: transparent; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.empty h3 { color: var(--ink); font-size: 18px; margin-bottom: 6px; }
.empty .row { justify-content: center; margin-top: 16px; }

/* ---------- home ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 20px; }
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi .big { font-family: var(--f-display); font-weight: 700; font-size: 27px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .line { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-2); }
.kpi .line b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 700; font-size: 13px; cursor: pointer; text-align: left; margin-top: 4px; }
.bar { height: 8px; border-radius: 4px; background: var(--bg); box-shadow: var(--inset-sm); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; border-radius: 4px; }
.home-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .home-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } }
.sec-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 10px; }
.sec-title h2 { font-size: 16.5px; }
.check { list-style: none; margin: 0; padding: 4px 18px 16px; display: grid; gap: 4px; }
.check li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-top: 1px dashed var(--line-2); }
.check li:first-child { border-top: 0; }
.check .tick { width: 24px; height: 24px; border-radius: 50%; box-shadow: var(--inset-sm); flex: none; display: grid; place-items: center; margin-top: 1px; }
.check .done .tick { background: var(--accent-grad); box-shadow: var(--glow); color: #fff; }
.check .tick svg { width: 13px; height: 13px; }
.check .body { flex: 1; min-width: 0; }
.check .body b { display: block; }
.check .done .body b { text-decoration: line-through; color: var(--ink-3); }

/* ---------- lists ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search { flex: 1 1 200px; min-width: 0; height: 42px; border: 0; border-radius: 14px; padding: 0 14px; background: var(--bg); box-shadow: var(--inset-sm); }
.search:focus { outline: none; box-shadow: var(--inset-sm), 0 0 0 2px var(--accent); }
.list { background: var(--bg); border-radius: var(--r); box-shadow: var(--raise); overflow: hidden; }
.li {
  display: grid; grid-template-columns: 1fr auto; gap: 3px 14px; padding: 13px 18px; width: 100%; text-align: left;
  border: 0; border-top: 1px solid var(--line); background: none; cursor: pointer; transition: background .12s ease;
}
.li:first-child { border-top: 0; }
.li:hover { background: var(--hover); }
.li .t1 { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .t2 { font-size: 12.5px; color: var(--ink-2); min-width: 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.li .r1 { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.li .r2 { text-align: right; font-size: 12.5px; }
.li.voided .t1, .li.voided .r1 { text-decoration: line-through; color: var(--ink-3); }
.li.off { opacity: .6; }
.li.child .t1::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 8px; transform: translateY(-3px); border-left: 2px solid var(--line-2); border-bottom: 2px solid var(--line-2); border-bottom-left-radius: 3px; }
.li.add-row { display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 700; font-size: 13.5px; padding-block: 11px; }
.li.add-row svg { width: 16px; height: 16px; }
.li.add-row:hover { background: var(--accent-soft); }
.list-sum { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 14px; font-size: 13px; color: var(--ink-2); }
.list-sum b { color: var(--ink); font-variant-numeric: tabular-nums; }
.group-h { padding: 12px 18px 7px; border-top: 1px solid var(--line); background: var(--bg-deep); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; color: var(--ink-3); display: flex; justify-content: space-between; }
.group-h:first-child { border-top: 0; }
.code { font-family: var(--f-mono); color: var(--ink-3); font-size: 12px; font-weight: 400; margin-right: 7px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 700; cursor: pointer; text-align: left; font-size: inherit; }
.linkish:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- statements ---------- */
.rep-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 18px; }
.rep-controls label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.rep-controls input[type="date"] { height: 38px; border: 0; border-radius: 12px; padding: 0 10px; background: var(--bg); box-shadow: var(--inset-sm); }
.stmt {
  background: var(--bg); border-radius: var(--r-lg); max-width: 800px; box-shadow: var(--raise);
  padding: clamp(22px, 4vw, 44px) clamp(18px, 4vw, 52px) clamp(26px, 4vw, 46px);
}
.stmt-head { text-align: center; margin-bottom: 26px; }
.stmt-head .co { font-weight: 700; letter-spacing: .02em; color: var(--ink-2); }
.stmt-head h2 { font-size: 23px; margin: 4px 0 3px; }
.stmt-head .per { color: var(--ink-2); font-size: 13px; }
.stmt-head .tin { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.st { width: 100%; border-collapse: collapse; }
.st td { padding: 4px 0; vertical-align: bottom; }
.st td.amt { text-align: right; width: 9.5rem; min-width: 7.5rem; padding-left: 12px; white-space: nowrap; }
.st tr.h td { padding-top: 18px; font-weight: 700; font-family: var(--f-display); font-size: 15px; letter-spacing: -0.01em; }
.st tr.h2 td { padding-top: 10px; font-weight: 700; color: var(--ink-2); font-size: 13px; }
.st td.i1 { padding-left: 1.1rem; }
.st td.i2 { padding-left: 2.2rem; }
.st tr.acc td:first-child { cursor: pointer; }
.st tr.acc:hover td:first-child { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.st tr.sub td { font-weight: 700; }
.st tr.sub td.amt span { display: inline-block; min-width: 100%; border-top: 1px solid var(--ink); padding-top: 3px; }
.st tr.sub2 td { font-weight: 700; color: var(--ink-2); }
.st tr.sub2 td.amt span { display: inline-block; min-width: 100%; border-top: 1px solid var(--line-2); padding-top: 3px; color: var(--ink); }
.st tr.tot td { font-weight: 800; padding-top: 10px; }
.st tr.tot td.amt span { display: inline-block; min-width: 100%; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); padding: 3px 0 2px; }
.st .cur::before { content: "₱"; float: left; padding-right: 6px; font-weight: inherit; }
.stmt-note { margin-top: 24px; font-size: 12.5px; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 12px; }
.tbl-wrap { overflow-x: auto; }
.tb { width: 100%; border-collapse: collapse; min-width: 460px; }
.tb th { text-align: left; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 800; padding: 8px 10px; border-bottom: 1px solid var(--ink); }
.tb th.amt, .tb td.amt { text-align: right; }
.tb td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
.tb tbody tr:nth-child(even) td { background: var(--bg-deep); }
.tb tr.acc td:nth-child(2) { cursor: pointer; }
.tb tr.acc:hover td:nth-child(2) { color: var(--accent); }
.tb tfoot td { font-weight: 800; border-bottom: 0; padding-top: 10px; }
.tb tfoot td.amt span { display: inline-block; min-width: 100%; border-bottom: 3px double var(--ink); padding-bottom: 2px; }
.balanced { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; font-size: 13px; }

/* ---------- panels that slide in (forms and details) ---------- */
#sheet-root:empty { display: none; }
.scrim { position: fixed; inset: 0; background: var(--scrim); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); z-index: 40; animation: fade .18s ease-out; }
.sheet { position: fixed; z-index: 41; inset: 0; background: var(--bg); display: flex; flex-direction: column; animation: rise .22s ease-out; }
@media (min-width: 760px) {
  .sheet { inset: 12px 12px 12px auto; width: min(800px, calc(100% - 24px)); border-radius: 28px; box-shadow: var(--drawer); animation: slide .22s ease-out; overflow: hidden; }
  .sheet.narrow { width: min(540px, calc(100% - 24px)); }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(16px); opacity: .6; } }
@keyframes slide { from { transform: translateX(28px); opacity: .6; } }
.sheet-head {
  display: flex; align-items: center; gap: 10px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px)); padding-bottom: 12px;
  padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--line);
}
@media (min-width: 760px) { .sheet-head { padding-top: 16px; padding-left: 24px; padding-right: 18px; } }
.sheet-head h2 { font-size: 19px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 0; background: var(--bg); box-shadow: var(--raise-xs); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); flex: none; }
.icon-btn:hover { color: var(--ink); }
.icon-btn:active { box-shadow: var(--inset-sm); }
.icon-btn[disabled] { opacity: .4; cursor: not-allowed; box-shadow: none; }
.icon-btn svg { width: 19px; height: 19px; }
.sheet-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px)); padding-block: 20px 28px;
}
@media (min-width: 760px) { .sheet-body { padding-left: 24px; padding-right: 24px; } }
.sheet-foot {
  border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; justify-content: flex-end; flex-wrap: wrap;
  padding-top: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px));
}
@media (min-width: 760px) { .sheet-foot { padding: 14px 24px 16px; } }
.sheet-foot .msg { flex: 1 1 200px; font-size: 13px; font-weight: 600; color: var(--bad); min-width: 0; }
.sheet-foot .msg:empty { display: none; }

/* ---------- forms ---------- */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.field small { font-size: 12px; color: var(--ink-3); }
.inp, select.inp, textarea.inp {
  width: 100%; min-width: 0; height: 44px; border: 0; border-radius: 13px; padding: 0 13px;
  background: var(--bg); box-shadow: var(--inset-sm); transition: box-shadow .15s ease;
}
select.inp { cursor: pointer; }
textarea.inp { height: auto; min-height: 70px; padding: 11px 13px; resize: vertical; }
.inp.money { text-align: right; font-variant-numeric: tabular-nums; }
.inp:focus { outline: none; box-shadow: var(--inset-sm), 0 0 0 2px var(--accent); }
.inp.static { display: flex; align-items: center; color: var(--ink-2); background: var(--bg-deep); box-shadow: none; }
.form-sec { margin-top: 24px; }
.form-sec > h3 { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-family: var(--f-body); font-weight: 800; margin-bottom: 12px; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check-row input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.lines { display: grid; gap: 12px; }
.ln { border-radius: 16px; padding: 14px; display: grid; gap: 12px; grid-template-columns: 1fr 1fr; background: var(--bg); box-shadow: var(--raise-sm); }
.ln .f-desc, .ln .f-acct { grid-column: 1 / -1; }
.ln .ln-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.ln .ln-foot b { color: var(--ink); font-variant-numeric: tabular-nums; }
@media (min-width: 640px) {
  .ln { grid-template-columns: minmax(0, 2.2fr) minmax(0, 2fr) 72px minmax(0, 1.2fr) minmax(0, 1.25fr) 38px; align-items: end; padding: 12px; }
  .ln .f-desc, .ln .f-acct { grid-column: auto; }
  .ln .ln-foot { grid-column: 1 / -1; }
  .ln.exp { grid-template-columns: minmax(0, 2.2fr) minmax(0, 2fr) minmax(0, 1.3fr) minmax(0, 1.25fr) 38px; }
  .ln.jl { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 2fr) 38px; }
  .ln .ln-del { align-self: end; margin-bottom: 3px; }
}
.ln .ln-del { justify-self: end; }
.totals { margin-top: 20px; margin-left: auto; max-width: 390px; display: grid; gap: 2px; }
.totals .tr { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; font-size: 14px; }
.totals .tr span:last-child { font-variant-numeric: tabular-nums; }
.totals .tr.muted { color: var(--ink-2); font-size: 13px; }
.totals .tr.grand { border-top: 1px solid var(--ink); margin-top: 4px; padding-top: 9px; font-weight: 800; font-size: 17px; font-family: var(--f-display); letter-spacing: -0.01em; }
.totals .tr.grand span:last-child { border-bottom: 3px double var(--ink); }
.totals .tr.bad { color: var(--bad); font-weight: 700; }
.inline-note { font-size: 12.5px; color: var(--ink-2); background: var(--bg); box-shadow: var(--inset-sm); border-radius: 13px; padding: 11px 14px; margin-top: 12px; }

/* documents inside panels */
.doc { border-radius: 20px; padding: clamp(18px, 3vw, 30px); background: var(--bg); box-shadow: var(--raise-sm); }
.doc-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 14px; }
.doc-top .who b { font-size: 15px; }
.doc-top .who div { font-size: 12.5px; color: var(--ink-2); }
.doc-top .what { text-align: right; }
.doc-top .what h3 { font-size: 20px; letter-spacing: .06em; text-transform: uppercase; }
.doc-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.doc-meta .k { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 800; }
.doc-lines { width: 100%; border-collapse: collapse; margin-top: 8px; min-width: 420px; }
.doc-lines th { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 800; text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line-2); }
.doc-lines td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc-lines .amt { text-align: right; white-space: nowrap; }
.je { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 360px; }
.je td, .je th { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.je th { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 800; }
.je .amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.je td.cr { padding-left: 24px; }
details.acct-view { margin-top: 20px; border-radius: 16px; background: var(--bg); box-shadow: var(--inset-sm); }
details.acct-view summary { padding: 12px 16px; cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
details.acct-view .tbl-wrap { padding: 0 16px 14px; }
.pay-list { margin-top: 20px; }
.confirm-box { background: var(--bad-bg); border-radius: 16px; padding: 16px; margin-top: 18px; }
.confirm-box p { margin: 0 0 12px; }

.menu-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.menu-item { display: flex; gap: 13px; align-items: flex-start; text-align: left; padding: 16px; border: 0; border-radius: 18px; background: var(--bg); box-shadow: var(--raise-sm); cursor: pointer; transition: box-shadow .15s ease; }
.menu-item:hover { box-shadow: var(--raise-xs); }
.menu-item:active { box-shadow: var(--inset-sm); }
.menu-item .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--bg); box-shadow: var(--inset-sm); color: var(--accent); display: grid; place-items: center; flex: none; }
.menu-item .ico svg { width: 19px; height: 19px; }
.menu-item b { display: block; margin-bottom: 2px; }
.menu-item span.d { font-size: 12.5px; color: var(--ink-2); }

/* users */
.role-list { display: grid; gap: 10px; }
.role-opt { display: flex; gap: 11px; align-items: flex-start; border-radius: 15px; padding: 12px 14px; cursor: pointer; background: var(--bg); box-shadow: var(--raise-xs); transition: box-shadow .15s ease; }
.role-opt:has(input:checked) { box-shadow: var(--inset-sm); }
.role-opt:has(input:checked) b { color: var(--accent); }
.role-opt input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.role-opt > span > span { display: block; }
.role-legend { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.role-legend > div { display: flex; flex-direction: column; gap: 2px; }

#toasts { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs-h) + 92px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
@media (min-width: 960px) { #toasts { bottom: 26px; } }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-size: 13.5px; font-weight: 600; box-shadow: 0 12px 28px -10px rgba(0, 0, 0, .45); animation: rise .2s ease-out; }
.toast.err { background: var(--bad); color: #fff; }
.loading { padding: 64px 0; text-align: center; color: var(--ink-2); }
.dots::after { content: "…"; }

/* ---------- sign-in and installer pages ---------- */
.auth-body {
  min-height: 100vh; display: flex; justify-content: center; align-items: flex-start;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: clamp(28px, 8vh, 72px) 48px;
}
.auth { width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: stretch; gap: 26px; }
.auth.wide { max-width: 760px; }
.auth-brand { display: flex; justify-content: center; }
.auth-brand img { height: 74px; width: auto; filter: drop-shadow(3px 5px 7px var(--sh-dark)); }
.auth-card { background: var(--bg); border-radius: 30px; padding: clamp(22px, 5vw, 38px); box-shadow: var(--raise); display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.auth-card h1 { font-size: 26px; }
.auth-card h2 { font-size: 16.5px; margin-top: 14px; display: flex; align-items: center; gap: 11px; }
.auth-card p { margin: 0; }
.auth-card .step { width: 28px; height: 28px; border-radius: 50%; background: var(--bg); box-shadow: var(--raise-xs); color: var(--accent); display: grid; place-items: center; font-size: 13px; font-family: var(--f-body); font-weight: 800; flex: none; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-note { background: var(--info-bg); color: var(--info); border-radius: 13px; padding: 11px 14px; font-size: 13.5px; font-weight: 600; }
.auth-error { background: var(--bad-bg); color: var(--bad); border-radius: 13px; padding: 11px 14px; font-size: 13.5px; font-weight: 600; }
.auth-error ul { margin: 6px 0 0; padding-left: 18px; font-weight: 500; }
.auth-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.auth-foot { text-align: center; font-size: 12px; color: var(--ink-3); }
