@font-face { font-family: 'Gmarket'; font-weight: 300; font-display: swap; src: url('../fonts/GmarketSans-Light.woff2') format('woff2'); }
@font-face { font-family: 'Gmarket'; font-weight: 500; font-display: swap; src: url('../fonts/GmarketSans-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Gmarket'; font-weight: 700; font-display: swap; src: url('../fonts/GmarketSans-Bold.woff2') format('woff2'); }

:root {
  color-scheme: light;
  --font: 'Gmarket', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
  --system-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Apple SD Gothic Neo', sans-serif;
  --sec-rgb: 60, 60, 67;
  --fg: #000;
  --fg2: rgba(60, 60, 67, 0.6);
  --fg3: rgba(60, 60, 67, 0.3);
  --sep: rgba(60, 60, 67, 0.29);
  --sep-opaque: #c6c6c8;
  --track: #e5e5ea;
  --gray6: #f2f2f7;
  --bg-page: rgb(244, 244, 249);
  --bg-card: #fff;
  --bg-elev: rgb(254, 254, 255);
  --bg-surface: #fff;
  --bg-field: #f2f2f7;
  --bg-grouped-card: #fff;
  --bubble-bg: #fff;
  --border: rgba(0, 0, 0, 0.055);
  --shadow: rgba(33, 31, 64, 0.075);
  --material: rgba(250, 250, 252, 0.82);
  --tabbar-bg: rgba(255, 255, 255, 0.72);
  --tabicon-cut: #fff;
  --red: #ff3b30;
  --orange: #ff9500;
  --yellow: #ffcc00;
  --green: #34c759;
  --teal: #30b0c7;
  --blue: #007aff;
  --indigo: #5856d6;
  --purple: #af52de;
  --pink: #ff2d55;
  --accent: rgb(94, 82, 245);
  --income: var(--green);
  --expense: var(--red);
  --fixed: var(--indigo);
  --weekly: var(--accent);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --sec-rgb: 235, 235, 245;
    --fg: #fff;
    --fg2: rgba(235, 235, 245, 0.6);
    --fg3: rgba(235, 235, 245, 0.3);
    --sep: rgba(84, 84, 88, 0.6);
    --sep-opaque: #38383a;
    --track: #2c2c2e;
    --gray6: #1c1c1e;
    --bg-page: rgb(9, 9, 13);
    --bg-card: rgb(19, 20, 27);
    --bg-elev: rgb(24, 25, 34);
    --bg-surface: #000;
    --bg-field: #1c1c1e;
    --bg-grouped-card: #1c1c1e;
    --bubble-bg: rgb(43, 43, 48);
    --border: rgba(255, 255, 255, 0.075);
    --shadow: transparent;
    --material: rgba(40, 40, 46, 0.82);
    --tabbar-bg: rgba(30, 30, 34, 0.7);
    --tabicon-cut: #1e1e22;
    --red: #ff453a;
    --orange: #ff9f0a;
    --yellow: #ffd60a;
    --green: #30d158;
    --teal: #40c8e0;
    --blue: #0a84ff;
    --indigo: #5e5ce6;
    --purple: #bf5af2;
    --pink: #ff375f;
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --sec-rgb: 235, 235, 245;
  --fg: #fff;
  --fg2: rgba(235, 235, 245, 0.6);
  --fg3: rgba(235, 235, 245, 0.3);
  --sep: rgba(84, 84, 88, 0.6);
  --sep-opaque: #38383a;
  --track: #2c2c2e;
  --gray6: #1c1c1e;
  --bg-page: rgb(9, 9, 13);
  --bg-card: rgb(19, 20, 27);
  --bg-elev: rgb(24, 25, 34);
  --bg-surface: #000;
  --bg-field: #1c1c1e;
  --bg-grouped-card: #1c1c1e;
  --bubble-bg: rgb(43, 43, 48);
  --border: rgba(255, 255, 255, 0.075);
  --shadow: transparent;
  --material: rgba(40, 40, 46, 0.82);
  --tabbar-bg: rgba(30, 30, 34, 0.7);
  --tabicon-cut: #1e1e22;
  --red: #ff453a;
  --orange: #ff9f0a;
  --yellow: #ffd60a;
  --green: #30d158;
  --teal: #40c8e0;
  --blue: #0a84ff;
  --indigo: #5e5ce6;
  --purple: #bf5af2;
  --pink: #ff375f;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg-page);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 500;
  font-size: 17px;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.ic { display: block; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[hidden] { display: none !important; }

/* MARK: Typography (AppTypography sizes, Gmarket Sans weights) */
.lt { font-size: 34px; } .t1 { font-size: 28px; } .t2 { font-size: 22px; } .t3 { font-size: 20px; }
.hl, .bd { font-size: 17px; } .co { font-size: 16px; } .sh { font-size: 15px; } .fn { font-size: 13px; }
.c1 { font-size: 12px; } .c2 { font-size: 11px; }
.b { font-weight: 700; } .m { font-weight: 500; } .l { font-weight: 300; }
.sec { color: var(--fg2); } .ter { color: var(--fg3); }
.lh { line-height: 1.15; }

/* MARK: App frame */
#app { position: fixed; inset: 0; display: flex; justify-content: center; }
.frame { position: relative; width: 100%; max-width: 520px; height: 100%; overflow: hidden; background: var(--bg-page); }
.view { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.view::-webkit-scrollbar { display: none; }
.view-inner { padding: calc(var(--safe-top) + 12px) 28px calc(var(--safe-bottom) + 110px); display: flex; flex-direction: column; gap: 14px; }
.view-inner.tight { padding-left: 18px; padding-right: 18px; }
.storage-warning { margin: 0; padding: 14px; border-radius: 14px; font-size: 13px; line-height: 1.5; color: var(--fg); background: color-mix(in srgb, var(--orange) 20%, var(--bg-card)); }
.view-fixed { position: absolute; inset: 0; display: flex; flex-direction: column; }
.view-fixed > .scroller { flex: 1; overflow-y: auto; scrollbar-width: none; }
.view-fixed > .scroller::-webkit-scrollbar { display: none; }

/* MARK: Cards */
.card {
  background: var(--bg-card);
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow: 0 6px 24px var(--shadow);
  padding: 20px;
}
.card.elev { background: var(--bg-elev); box-shadow: 0 10px 40px var(--shadow); }
.r20 { border-radius: 20px; } .r24 { border-radius: 24px; } .r28 { border-radius: 28px; } .r18 { border-radius: 18px; }

.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.spacer { flex: 1; min-width: 0; }
.gap4 { gap: 4px; } .gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap10 { gap: 10px; } .gap12 { gap: 12px; } .gap14 { gap: 14px; } .gap16 { gap: 16px; } .gap18 { gap: 18px; }
.divider { height: 1px; background: var(--sep); transform: scaleY(0.5); transform-origin: top; margin: 0; flex: none; }

.circle-btn {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(var(--sec-rgb), 0.048); color: var(--fg); flex: none;
}
.circle-btn.s30 { width: 30px; height: 30px; }
.circle-btn.s42 { width: 42px; height: 42px; background: var(--gray6); }
.circle-btn.s40 { width: 40px; height: 40px; background: rgba(var(--sec-rgb), 0.06); }
.circle-btn:active, .chip-btn:active, .pressable:active { opacity: 0.55; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px;
  color: var(--indigo); background: color-mix(in srgb, var(--indigo) 10%, transparent); font-size: 12px; font-weight: 500; white-space: nowrap;
}
.chip-btn.tall { height: 34px; padding: 0 12px; font-weight: 700; }
.accent-icon {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.count-pill { padding: 6px 10px; border-radius: 999px; background: rgba(var(--sec-rgb), 0.048); color: var(--fg2); font-size: 12px; font-weight: 700; }

/* MARK: Segmented control (iOS 26 capsule) */
.seg {
  position: relative; display: flex; padding: 2px; border-radius: 999px; background: rgba(118, 118, 128, 0.12); height: 36px; flex: none;
}
.seg button {
  position: relative; z-index: 1; flex: 1; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--fg);
  transition: color 0.2s; white-space: nowrap; padding: 0 6px; min-width: 0;
}
.seg .thumb {
  position: absolute; top: 2px; bottom: 2px; border-radius: 999px; background: var(--bg-surface);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04);
  transition: left 0.32s cubic-bezier(0.3, 0.9, 0.3, 1), width 0.32s cubic-bezier(0.3, 0.9, 0.3, 1);
}
:root[data-theme='dark'] .seg .thumb { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .seg .thumb { background: #636366; } }
.seg.small { height: 32px; }

/* MARK: Metrics */
.metric {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 11px 12px; border-radius: 14px;
}
.metric .bar { width: 4px; height: 30px; border-radius: 2px; flex: none; }
.metric .label { font-size: 11px; color: var(--fg2); }
.metric .value { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; padding: 11px 10px; border-radius: 13px;
}
.tile .bar { width: 4px; height: 34px; border-radius: 2px; flex: none; }

.tint-bg { background: color-mix(in srgb, var(--tint) 7.5%, transparent); }
.tint-fg { color: var(--tint); }

/* MARK: Collapsible (HomeVerticalRevealLayout) */
.reveal { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows 0.42s cubic-bezier(0.25, 0.9, 0.3, 1), opacity 0.3s ease; }
.reveal > .reveal-inner { overflow: hidden; min-height: 0; }
.reveal.open { grid-template-rows: 1fr; opacity: 1; }
.chev { transition: transform 0.42s cubic-bezier(0.25, 0.9, 0.3, 1); color: var(--fg2); }
.chev.up { transform: rotate(180deg); }

/* MARK: Rings and bars */
.ring-track { stroke: rgba(var(--sec-rgb), 0.072); }
.progress { position: relative; height: 10px; border-radius: 999px; background: var(--track); overflow: hidden; }
.progress > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 80%, white), var(--tint)); width: 0; }

/* MARK: Calendar */
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); column-gap: 6px; }
.cal-head div { height: 22px; text-align: center; font-size: 12px; color: var(--fg2); line-height: 22px; }
.cal-head div:first-child { color: color-mix(in srgb, var(--red) 75%, transparent); }
.cal-grid { row-gap: 6px; position: relative; }
.cal-cell {
  position: relative; height: 52px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; padding-top: 7px; gap: 2px;
  transition: transform 0.25s cubic-bezier(0.3, 1.6, 0.4, 1), background 0.2s;
}
.cal-cell .dn { height: 24px; line-height: 26px; font-size: 20px; font-weight: 500; }
.cal-cell.today { background: color-mix(in srgb, var(--yellow) 20%, transparent); box-shadow: inset 0 0 0 1.2px color-mix(in srgb, var(--yellow) 85%, transparent), 0 0 0 0 transparent; }
.cal-cell.today .dn, .cal-cell.sel .dn { font-weight: 700; }
.cal-cell.sel { background: var(--indigo); transform: scale(1.04); box-shadow: 0 3px 6px color-mix(in srgb, var(--indigo) 24%, transparent); z-index: 2; }
.cal-cell.sel .dn { color: #fff !important; }
.cal-cell .marks { height: 14px; display: flex; align-items: center; gap: 3px; }
.dot { width: 5px; height: 5px; border-radius: 50%; flex: none; }
.hol {
  height: 14px; line-height: 15px; padding: 0 4px; max-width: 48px; border-radius: 999px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: color-mix(in srgb, var(--red) 82%, transparent); background: color-mix(in srgb, var(--red) 8%, transparent);
}
.c-red { color: var(--red); } .c-blue { color: var(--blue); } .c-green { color: var(--green); } .c-indigo { color: var(--indigo); }
.bubble {
  position: absolute; width: 184px; padding: 11px 14px; border-radius: 16px; background: var(--bubble-bg); border: 1px solid var(--sep);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.18); z-index: 20; pointer-events: none; transform-origin: bottom center;
  animation: bubble-in 0.34s cubic-bezier(0.3, 1.5, 0.45, 1);
}
@keyframes bubble-in { from { transform: scale(0.56); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.range-bar { position: absolute; height: 44px; border-radius: 22px; background: color-mix(in srgb, var(--indigo) 32%, transparent); box-shadow: 0 5px 12px rgba(0, 0, 0, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.55); pointer-events: none; }
.range-bar .cap { position: absolute; top: 0; bottom: 0; border-radius: 22px; background: var(--indigo); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32); }
.cal-cell.inrange .dn { color: #fff !important; font-weight: 700; }
.cal-cell.inrange .dot { background: #fff !important; }

/* MARK: Lists */
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.list-row .lead { width: 34px; height: 34px; display: grid; place-items: center; flex: none; }
.list-sep { height: 1px; background: var(--sep); transform: scaleY(0.5); }

/* MARK: Ledger table */
.ledger-head, .ledger-row { display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; text-align: center; padding: 0 12px; }
.ledger-head { font-size: 15px; font-weight: 700; color: var(--fg2); padding-top: 3px; padding-bottom: 5px; }
.ledger-row { height: 52px; font-size: 15px; border-radius: 12px; }
.ledger-row.today { background: color-mix(in srgb, var(--accent) 9%, transparent); box-shadow: inset 0 0 0 1.2px color-mix(in srgb, var(--accent) 42%, transparent); }
.ledger-row button { height: 100%; display: grid; place-items: center; min-width: 0; }
.ledger-row .pending { height: 24px; padding: 0 8px; border-radius: 999px; color: var(--indigo); background: color-mix(in srgb, var(--indigo) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--indigo) 35%, transparent); display: inline-flex; align-items: center; }
.ledger-row .payout { color: var(--teal); }
.ledger-row .cell-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* MARK: Tab bar (iOS 26 floating glass) */
.tabbar {
  position: absolute; left: 22px; right: 22px; bottom: calc(var(--safe-bottom) + 8px); height: 62px; border-radius: 31px;
  display: flex; padding: 4px; z-index: 50;
  background: var(--tabbar-bg); -webkit-backdrop-filter: blur(22px) saturate(1.8); backdrop-filter: blur(22px) saturate(1.8);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), inset 0 0 0 0.5px rgba(255, 255, 255, 0.6);
}
:root[data-theme='dark'] .tabbar { box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), inset 0 0 0 0.5px rgba(255, 255, 255, 0.12); }
.tabbar button {
  position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-family: var(--system-font); font-size: 10px; font-weight: 600; color: var(--fg); border-radius: 27px;
}
.tabbar button.on { color: var(--accent); }
.tabbar .tab-thumb { position: absolute; top: 4px; bottom: 4px; border-radius: 27px; background: rgba(var(--sec-rgb), 0.12); transition: left 0.38s cubic-bezier(0.3, 1.25, 0.4, 1), width 0.38s; }

/* MARK: Overlays */
.overlay-layer { position: absolute; inset: 0; z-index: 80; pointer-events: none; }
.overlay-layer > * { pointer-events: auto; }
.page {
  position: absolute; inset: 0; background: var(--bg-surface); display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.42s cubic-bezier(0.2, 0.9, 0.25, 1);
  padding-top: var(--safe-top);
}
.page.shown { transform: none; }
.page.dark-window { --bg-surface: rgb(27, 29, 34); background: rgb(27, 29, 34); color: #fff; }
.page-scroll { flex: 1; overflow-y: auto; scrollbar-width: none; }
.page-scroll::-webkit-scrollbar { display: none; }
.page-footer {
  display: flex; gap: 10px; padding: 14px 26px calc(18px + var(--safe-bottom)); background: var(--bg-surface);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}
.btn { height: 52px; flex: 1; border-radius: 14px; font-size: 16px; font-weight: 500; display: grid; place-items: center; }
.btn.primary { background: var(--indigo); color: #fff; }
.btn.danger { background: color-mix(in srgb, var(--red) 10%, transparent); color: var(--red); }
.btn.plain { background: rgba(var(--sec-rgb), 0.06); }
.btn:disabled { opacity: 0.4; }
.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.22); opacity: 0; transition: opacity 0.22s; }
.scrim.shown { opacity: 1; }

.reminder {
  position: absolute; left: 18px; right: 18px; bottom: calc(20px + var(--safe-bottom)); padding: 20px; border-radius: 24px;
  background: var(--material); -webkit-backdrop-filter: blur(30px) saturate(1.6); backdrop-filter: blur(30px) saturate(1.6);
  box-shadow: 0 10px 48px rgba(0, 0, 0, 0.18), inset 0 0 0 1px rgba(var(--sec-rgb), 0.06);
  display: flex; flex-direction: column; gap: 18px; transform: scale(0.96); opacity: 0; transition: transform 0.22s, opacity 0.22s;
}
.reminder.shown { transform: none; opacity: 1; }

.quick-menu {
  position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 80px); width: 244px; height: 58px; margin-left: -122px; z-index: 60;
  display: flex; align-items: center; padding: 0 8px; border-radius: 18px; background: var(--bg-surface); border: 1px solid var(--sep);
  box-shadow: 0 9px 36px rgba(0, 0, 0, 0.18); transform-origin: bottom center; animation: quick-in 0.3s cubic-bezier(0.3, 1.4, 0.45, 1);
}
@keyframes quick-in { from { transform: scale(0.72); opacity: 0; } to { transform: none; opacity: 1; } }
.quick-menu button { flex: 1; height: 100%; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 15px; font-weight: 700; }
.quick-menu .vsep { width: 1px; height: 34px; background: var(--sep); }

.toast {
  position: absolute; left: 50%; top: calc(var(--safe-top) + 14px); transform: translate(-50%, -20px); opacity: 0; z-index: 120;
  padding: 10px 16px; border-radius: 999px; background: var(--material); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14); font-size: 13px; transition: transform 0.3s, opacity 0.3s; white-space: nowrap;
}
.toast.shown { transform: translate(-50%, 0); opacity: 1; }

/* MARK: Forms */
.form { display: flex; flex-direction: column; gap: 30px; padding: 34px 26px 28px; }
.form.dense { gap: 24px; padding-top: 20px; }
.erow { display: flex; align-items: center; gap: 18px; min-height: 50px; }
.erow > .elabel { width: 58px; flex: none; font-size: 16px; }
.field {
  flex: 1; min-width: 0; height: 50px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 10px;
  background: var(--bg-field); box-shadow: inset 0 0 0 1px var(--sep), inset 0 1.5px 2px rgba(var(--sec-rgb), 0.18);
}
.field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; height: 100%; padding: 0; }
.field input::placeholder { color: var(--fg3); }
.field .suffix { color: var(--fg2); font-size: 16px; }
.field .clear { color: color-mix(in srgb, var(--fg2) 55%, transparent); }
.select {
  position: relative; display: inline-flex; align-items: center; gap: 4px; color: var(--indigo); font-size: 16px; min-height: 34px;
}
.select select { position: absolute; inset: 0; opacity: 0; width: 100%; font-size: 16px; }
.toggle { position: relative; width: 63px; height: 28px; flex: none; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; z-index: 1; cursor: pointer; }
.toggle i { position: absolute; inset: 0; border-radius: 999px; background: rgba(120, 120, 128, 0.16); transition: background 0.25s; }
.toggle i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 37px; height: 24px; border-radius: 999px; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.06); transition: transform 0.3s cubic-bezier(0.3, 1.3, 0.5, 1); }
.toggle input:checked + i { background: var(--indigo); }
.toggle input:checked + i::after { transform: translateX(22px); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 16px; min-height: 44px; }

/* MARK: Settings */
.settings-section { display: flex; flex-direction: column; gap: 10px; }
.settings-section > .head { padding: 0 4px; display: flex; flex-direction: column; gap: 3px; }
.settings-card { background: var(--bg-grouped-card); border-radius: 20px; box-shadow: inset 0 0 0 1px rgba(var(--sec-rgb), 0.048); overflow: hidden; }
.icon-tile { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; color: var(--tint); background: color-mix(in srgb, var(--tint) 14%, transparent); }
.color-well { position: relative; width: 30px; height: 30px; border-radius: 50%; flex: none; }
.color-well::before { content: ''; position: absolute; inset: -6px; border-radius: 50%; background: conic-gradient(from 0deg, #ff3b30, #ffcc00, #34c759, #30b0c7, #007aff, #af52de, #ff2d55, #ff3b30); }
.color-well::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; background: var(--bg-grouped-card); }
.color-well span { position: absolute; inset: 0; border-radius: 50%; z-index: 1; }
.color-well input { position: absolute; inset: -6px; opacity: 0; z-index: 2; cursor: pointer; }

/* MARK: Charts */
.chart-svg { display: block; width: 100%; overflow: visible; }
.chart-svg text { font-family: var(--font); }
.legend { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--fg2); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 24px 12px; color: var(--fg2); }
.empty .title { color: var(--fg); font-size: 20px; font-weight: 700; }
.empty .ic { color: var(--fg2); }

.page-dots { display: flex; justify-content: center; gap: 5px; position: absolute; bottom: 7px; left: 0; right: 0; pointer-events: none; }
.page-dots i { height: 5px; width: 5px; border-radius: 3px; background: rgba(var(--sec-rgb), 0.144); transition: width 0.3s, background 0.3s; }
.page-dots i.on { width: 15px; background: var(--accent); }
.carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.carousel > * { flex: 0 0 100%; scroll-snap-align: start; }

.hscroll { overflow-x: auto; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }

.popup-chip {
  position: absolute; transform: translateX(-50%); white-space: nowrap; padding: 0 9px; height: 27px; line-height: 28px; border-radius: 999px;
  background: var(--material); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), inset 0 0 0 1px var(--sep);
  font-size: 11px; font-weight: 700; pointer-events: none; animation: bubble-in 0.3s cubic-bezier(0.3, 1.4, 0.45, 1);
}

/* MARK: Delivery */
.dv-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.dv-tabs button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 7px; border-radius: 14px; color: var(--fg2); font-size: 12px; }
.dv-tabs button.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); font-weight: 700; }
.dv-cal .cal-cell { height: 56px; padding-top: 5px; gap: 1px; }
.dv-cal .cal-cell .dn { font-size: 15px; height: 18px; line-height: 20px; }
.dv-cal .amt { font-size: 10.5px; line-height: 12px; color: var(--accent); font-weight: 700; white-space: nowrap; }
.dv-cal .pay { font-size: 9px; line-height: 12px; padding: 0 4px; border-radius: 999px; color: var(--teal); background: color-mix(in srgb, var(--teal) 13%, transparent); }
.dv-cal .cal-cell.sel .amt, .dv-cal .cal-cell.sel .pay { color: #fff; background: transparent; }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.week-strip button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; border-radius: 14px; }
.week-strip button .wd { font-size: 11px; color: var(--fg2); }
.week-strip button .dd { font-size: 17px; }
.week-strip button .mk { width: 5px; height: 5px; border-radius: 50%; }
.week-strip button.sel { background: var(--indigo); color: #fff; }
.week-strip button.sel .wd { color: rgba(255, 255, 255, 0.8); }
.week-strip button.today:not(.sel) { background: color-mix(in srgb, var(--yellow) 20%, transparent); box-shadow: inset 0 0 0 1.2px color-mix(in srgb, var(--yellow) 85%, transparent); }
.status-badge { height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; white-space: nowrap; color: var(--tint); background: color-mix(in srgb, var(--tint) 12%, transparent); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; gap: 4px; }
.stat-grid .k { font-size: 11px; color: var(--fg2); }
.stat-grid .v { font-size: 14px; font-weight: 700; margin-top: 5px; white-space: nowrap; }
.stat-grid .s { font-size: 10px; color: var(--fg2); margin-top: 3px; }
.month-row { display: flex; align-items: center; gap: 8px; padding: 14px 16px; }
.mini-input { width: 100%; }
.kind-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.kind-chips button { height: 34px; padding: 0 14px; border-radius: 999px; background: rgba(var(--sec-rgb), 0.06); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.kind-chips button.on { background: var(--indigo); color: #fff; }
.ledger-row .cell-text { display: inline-block; }
.ledger-row .pending { max-width: calc(100% - 4px); padding: 0 6px; }
[data-fit] { min-width: 0; }
.kind-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.kind-chips button { justify-content: center; padding: 0 6px; gap: 4px; font-size: 13px; }
.erow > .elabel { white-space: nowrap; }

/* MARK: Forced dark scope (iPad windows use preferredColorScheme(.dark)) */
.theme-dark {
  color-scheme: dark;
  --sec-rgb: 235, 235, 245;
  --fg: #fff;
  --fg2: rgba(235, 235, 245, 0.6);
  --fg3: rgba(235, 235, 245, 0.3);
  --sep: rgba(84, 84, 88, 0.6);
  --sep-opaque: #38383a;
  --track: #2c2c2e;
  --gray6: #1c1c1e;
  --bg-page: rgb(9, 9, 13);
  --bg-card: rgb(19, 20, 27);
  --bg-elev: rgb(24, 25, 34);
  --bg-surface: #000;
  --bg-field: #1c1c1e;
  --bg-grouped-card: #1c1c1e;
  --bubble-bg: rgb(43, 43, 48);
  --border: rgba(255, 255, 255, 0.075);
  --shadow: transparent;
  --material: rgba(40, 40, 46, 0.82);
  --tabicon-cut: #1e1e22;
  --red: #ff453a;
  --orange: #ff9f0a;
  --yellow: #ffd60a;
  --green: #30d158;
  --teal: #40c8e0;
  --blue: #0a84ff;
  --indigo: #5e5ce6;
  --purple: #bf5af2;
  --pink: #ff375f;
  color: var(--fg);
}
.theme-dark .seg .thumb { background: #636366; }

/* MARK: iPad shell (IPadAppShell) */
.sidebar, .sidebar-rule { display: none; }
.frame.wide { max-width: none; }
.frame.wide > .tabbar { display: none; }
.frame.wide > .view { left: calc(var(--sidebar-w, 258px) + 1px); }
.frame.wide > .sidebar {
  display: flex; flex-direction: column; position: absolute; left: 0; top: 0; bottom: 0; width: var(--sidebar-w, 258px); z-index: 5;
  background: var(--bg-surface); padding: var(--safe-top) 0 var(--safe-bottom); overflow-y: auto; scrollbar-width: none;
}
.frame.wide > .sidebar::-webkit-scrollbar { display: none; }
.frame.wide > .sidebar-rule { display: block; position: absolute; top: 0; bottom: 0; left: var(--sidebar-w, 258px); width: 1px; z-index: 5; background: color-mix(in srgb, var(--fg) 7%, transparent); }
.sb-brand { display: flex; align-items: center; gap: 13px; padding: 20px 22px 24px; }
.sb-logo {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; color: #fff; --wallet-cut: var(--indigo);
  background: linear-gradient(135deg, var(--indigo), color-mix(in srgb, var(--indigo) 68%, transparent));
  box-shadow: 0 5px 10px color-mix(in srgb, var(--indigo) 24%, transparent);
}
.sb-label { font-size: 11px; font-weight: 700; color: var(--fg2); letter-spacing: 1.2px; }
.sb-nav { display: flex; flex-direction: column; gap: 6px; padding: 0 12px; --tabicon-cut: var(--bg-surface); }
.sb-nav button { height: 58px; display: flex; align-items: center; gap: 13px; padding: 0 14px; border-radius: 16px; font-size: 15px; font-weight: 700; text-align: left; transition: background 0.24s, color 0.24s; }
.sb-nav button .sb-ic { width: 24px; display: grid; place-items: center; color: var(--fg2); transition: color 0.24s; }
.sb-nav button.on { background: var(--indigo); color: #fff; --tabicon-cut: var(--indigo); }
.sb-nav button.on .sb-ic { color: #fff; }
.sb-nav button:not(.on):active { background: rgba(var(--sec-rgb), 0.08); }
.sb-quick { display: flex; gap: 10px; }
.sb-quick button {
  flex: 1; min-width: 0; height: 66px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border-radius: 16px;
  font-size: 12px; font-weight: 700; color: var(--tint); white-space: nowrap;
  background: color-mix(in srgb, var(--tint) 10%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tint) 14%, transparent);
}
.sb-quick button:active { opacity: 0.6; }
.sb-status { margin: 0 14px 18px; padding: 14px; border-radius: 18px; display: flex; align-items: center; gap: 11px; background: color-mix(in srgb, var(--fg) 4.5%, transparent); }
.sb-status .sb-status-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; color: var(--tint); background: color-mix(in srgb, var(--tint) 10%, transparent); }

/* Wide content column (frame(maxWidth: 1180) + horizontal 30 / top 22) */
.wide-inner { width: 100%; max-width: 1240px; margin: 0 auto; padding: calc(var(--safe-top) + 22px) 30px calc(var(--safe-bottom) + 28px); display: flex; flex-direction: column; gap: 18px; }
.wide-row { display: flex; align-items: flex-start; gap: 18px; }
.wide-row > * { min-width: 0; }
.wide-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.ipad-metric {
  flex: 1; min-width: 0; min-height: 86px; display: flex; align-items: center; gap: 12px; padding: 15px 16px; border-radius: 18px;
  background: color-mix(in srgb, var(--tint) 7.5%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tint) 10%, transparent);
}
.ipad-metric .bar { width: 5px; height: 44px; border-radius: 3px; background: var(--tint); flex: none; }
.frame.wide .ledger-row { height: 58px; margin: 7px 0 !important; }

/* MARK: Centered windows (IPadRecentTransactionsWindow, BudgetCategoryDetailWindow) */
.window-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.34); opacity: 0; transition: opacity 0.4s; }
.window-scrim.shown { opacity: 1; }
.page.window {
  inset: auto; left: 50%; top: 50%; width: min(var(--win-w, 940px), calc(100% - 48px)); height: min(var(--win-h, 700px), calc(100% - 48px));
  padding-top: 0; border-radius: 30px; overflow: hidden; opacity: 0; transform: translate(-50%, calc(-50% + 70px));
  transition: transform 0.58s cubic-bezier(0.85, 0, 0.15, 1), opacity 0.45s;
  box-shadow: 0 18px 68px rgba(0, 0, 0, 0.32), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.page.window.shown { transform: translate(-50%, -50%); opacity: 1; }
.range-slider { width: 100%; accent-color: var(--indigo); }
