/* Presentation layer only: shared depth tokens, no changes to records or routes.
   Shadows use static layers; hover feedback never moves financial rows. */
body {
  --depth-accent: #7134c4;
  --depth-accent-end: #54218f;
  --depth-raised: 0 2px 3px #39135c08, 0 10px 26px #39135c0c, inset 0 1px 0 #ffffffc0;
  --depth-button: 0 2px 3px #39135c12, 0 4px 9px #39135c0c, inset 0 1px 0 #ffffffc0;
  --depth-inset: inset 0 1px 3px #39135c12;
  --depth-radius: 18px;
  --depth-duration: 180ms;
  --bg: #f6f0fb; --p: #fefcff; --ink: #2c193d; --muted: #685674;
  --line: #e3d5ef; --b: #7134c4; --g: #17663f; --income: #17663f; --r: #b42336;
  --ui-accent: #7134c4; --ui-surface: #fefcff; --ui-background: #f6f0fb;
  --popup-panel: var(--p); --popup-ink: var(--ink); --popup-muted: var(--muted);
  --popup-line: var(--line); --popup-header: #f0e4fb; --popup-footer: #f8f2fc;
  background: radial-gradient(ellipse at 85% 0%, #e8d8f840, transparent 55%), var(--bg);
  color: var(--ink);
}
body.clean-dashboard-on { --bg: #f6f0fb; --p: #fefcff; --ink: #2c193d; --muted: #685674; --line: #e3d5ef; --b: #7134c4; --g: #17663f; --income: #17663f; --r: #b42336; }
body.dark, body.dark.clean-dashboard-on {
  --bg: #171020; --p: #281d35; --ink: #f6eefc; --muted: #cbbbd9;
  --line: #4c365e; --b: #d2aff5; --g: #93dfb3; --income: #93dfb3; --r: #ffa6b2;
  --ui-surface: #281d35; --ui-background: #171020;
  --popup-header: #342144; --popup-footer: #24182f;
  --depth-raised: 0 2px 4px #0003, 0 12px 28px #0003, inset 0 1px 0 #ffffff12;
  --depth-button: 0 2px 5px #0004, inset 0 1px 0 #ffffff15;
  --depth-inset: inset 0 2px 4px #0003;
}
body :is(.clean-card, .card, .panel, .more-menu-list, #moreAccountProfile) {
  border-color: var(--line); border-radius: var(--depth-radius);
  background-color: var(--p); box-shadow: var(--depth-raised);
}
body :is(.modal .dialog, .host-modal-card, dialog, .overview-day-preview) {
  border: 1px solid var(--line); border-radius: 22px;
  box-shadow: 0 24px 72px #19052f40, inset 0 1px 0 #ffffff25;
}
body :is(.btn, .scope-chip, .category-filter-chip, .settings-tab, .report-tab, .quick-entry-choice) {
  border-radius: 12px; box-shadow: var(--depth-button);
}
body :is(.btn, .scope-chip, .category-filter-chip, .report-tab) { min-height: 44px; }
body :is(input, select, textarea) {
  border-color: var(--line); border-radius: 11px; background-color: var(--p);
  color: var(--ink); box-shadow: var(--depth-inset);
}
body :is(.main, .modal, .host-modal, dialog) .btn.primary,
body .host-auth-submit,
body #cleanControls .btn.primary,
body #pocketDesktopQuickAdd {
  background: linear-gradient(145deg, var(--depth-accent), var(--depth-accent-end)) !important;
  color: #fff !important; border-color: #6025a5 !important;
  box-shadow: 0 3px 7px #54218f2b, inset 0 1px 0 #ffffff35;
}
/* Quick Add remains purple in both themes, including the mobile disc. */
body .side #nav #mobileQuickAdd .quick-add-disc {
  background: linear-gradient(145deg, #8644df, #6423b2) !important;
  color: #fff !important;
  box-shadow: 0 0 0 5px var(--p), 0 5px 12px #54218f40, inset 0 2px 0 #ffffff40;
}
body #compactAppBar {
  background: linear-gradient(110deg, #311446, #4d2468); color: #fff;
  box-shadow: 0 3px 14px #25103722, inset 0 -1px 0 #ffffff16;
}
body #compactProfile { box-shadow: inset 0 1px 0 #fff9, 0 3px 8px #17052630; }
body.compact-shell .side, body #desktopMorePanel {
  background: var(--p); border-color: var(--line);
  box-shadow: 3px 0 16px #39135c08;
}
body.compact-shell #nav button.on,
body.compact-shell.desktop-more-open #nav button[data-view="more"] {
  background: color-mix(in srgb, var(--b) 15%, var(--p)) !important;
  color: var(--ink) !important; border-color: var(--line);
  box-shadow: var(--depth-button);
}
body .more-menu-row:hover, body #accounts .inner-nav-row:hover {
  background: color-mix(in srgb, var(--b) 9%, var(--p)) !important;
}
body .main :is(.scope-chip, .category-filter-chip, .settings-tab, .report-tab, [data-goal-filter]):is(.on, .active, [aria-pressed="true"], [aria-selected="true"]) {
  background: color-mix(in srgb, var(--b) 16%, var(--p)) !important;
  color: var(--ink) !important; border-color: var(--b); box-shadow: var(--depth-button);
}
/* Keep the balance and complete calendar in separate surfaces. */
body #defaultDashboard .clean-balance {
  background: var(--p) !important; color: var(--ink) !important;
  border-color: var(--line); box-shadow: var(--depth-raised);
}
body #defaultDashboard .clean-balance .clean-card-head,
body #defaultDashboard .clean-balance .clean-insight { color: var(--ink); }
body #defaultDashboard .overview-balance-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
body #defaultDashboard .overview-balance-figures {
  padding: 24px; min-width: 0; border-radius: 16px;
  background: linear-gradient(125deg, #54218f, #7938bf 65%, #874ac7);
  border: 1px solid #ffffff25; box-shadow: 0 8px 20px #54218f26, inset 0 1px 0 #ffffff40;
  color: #fff;
}
body #defaultDashboard .overview-balance-figures .clean-balance-value { color: #fff; }
body #defaultDashboard .overview-balance-figures .clean-caption { color: #f1e5fc; }
body #defaultDashboard .clean-totals { display: flex; flex-wrap: wrap; gap: 12px; }
body #defaultDashboard .clean-totals > div {
  flex: 1 1 160px; min-width: 0; padding: 12px 16px; border: 1px solid #ffffff50;
  border-radius: 12px; background: #f8f2ff; box-shadow: inset 0 1px 0 #fff, 0 2px 6px #29104612;
}
body #defaultDashboard .clean-totals > div span { color: #51405e; }
body #defaultDashboard .clean-totals > div:first-child b { color: #17663f; }
body #defaultDashboard .clean-totals > div:nth-child(2) b { color: #b42336; }
body #defaultDashboard .clean-totals > small { flex-basis: 100%; color: #f1e5fc; }
body #defaultDashboard .overview-calendar { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--p); box-shadow: var(--depth-inset); }
body #defaultDashboard .overview-calendar-head h3,
body #defaultDashboard .overview-calendar-head b,
body #defaultDashboard .overview-calendar-grid button { color: var(--ink); }
body #defaultDashboard .overview-calendar-week,
body #defaultDashboard .overview-calendar-hint { color: var(--muted); }
body #defaultDashboard .overview-calendar-head button { background: var(--p); color: var(--ink); border-color: var(--line); box-shadow: var(--depth-button); min-height: 44px; min-width: 44px; }
body #defaultDashboard .overview-calendar-grid button { min-height: 44px; }
body #defaultDashboard .overview-calendar-grid [data-has-transactions="true"] { background: color-mix(in srgb, var(--b) 10%, var(--p)); }
body #defaultDashboard .overview-calendar-grid [data-has-transactions="true"] i { background: var(--b); }
body #defaultDashboard .overview-calendar-grid [data-today="true"],
body #defaultDashboard .overview-calendar-grid [aria-expanded="true"] { border-color: var(--b); box-shadow: var(--depth-button); }
body #defaultDashboard .overview-calendar-grid button:hover { background: color-mix(in srgb, var(--b) 18%, var(--p)); border-color: var(--b); }
body :is(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--b); outline-offset: 3px;
}
body #defaultDashboard .overview-calendar button:focus-visible { outline: 3px solid var(--b); outline-offset: 2px; }
body :is(button, .btn):disabled { box-shadow: none; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  body :is(.btn, .scope-chip, .more-menu-row, .quick-entry-choice) { transition: background-color var(--depth-duration), box-shadow var(--depth-duration), border-color var(--depth-duration); }
  body .btn:not(:disabled):hover { box-shadow: 0 4px 12px #54218f24, inset 0 1px 0 #ffffff30; }
  body .btn:not(:disabled):active { box-shadow: var(--depth-inset); }
}
@media (max-width: 680px) {
  body #defaultDashboard .overview-balance-figures { padding: 18px 16px; }
  body #defaultDashboard .clean-totals > div { flex-basis: 120px; padding: 10px 12px; }
  body #defaultDashboard .overview-calendar { padding: 12px; }
  body #defaultDashboard .overview-calendar-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  body #defaultDashboard .overview-calendar-head > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  body :is(.clean-card, .panel) { border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  body :is(.btn, .scope-chip, .more-menu-row, .quick-entry-choice) { transition: none; }
}
@media (forced-colors: active) {
  body :is(.card, .panel, .clean-card, .btn, .scope-chip) { border: 1px solid CanvasText; box-shadow: none; }
  body #defaultDashboard .overview-balance-figures { background: Canvas; color: CanvasText; }
  body #defaultDashboard .overview-balance-figures :is(.clean-balance-value, .clean-caption) { color: CanvasText; }
}
/* Override legacy summary selectors at their original scope. */
body #defaultDashboard .clean-balance .clean-totals { display:flex; flex-wrap:wrap; gap:12px; }
body #defaultDashboard .clean-balance .clean-totals > div { background:#f8f2ff; border:1px solid #ffffff50 !important; border-radius:12px; padding:12px 16px !important; min-width:0; --summary-income:#17663f; --summary-expense:#b42336; }
body #defaultDashboard .clean-balance .clean-card-head :is(small,.balance-visibility),
body #defaultDashboard .clean-balance .clean-insight :is(strong,span) { color:var(--ink); }
body #defaultDashboard .clean-balance .clean-totals > small { color:#f1e5fc; }
@media(max-width:680px){
 body #defaultDashboard .clean-activity li { display:grid; grid-template-columns:minmax(0,1fr); gap:10px; }
 body #defaultDashboard .clean-activity li > * { min-width:0; max-width:100%; }
 body #defaultDashboard .clean-activity .clean-row-amount { max-width:100%; width:100%; text-align:right; }
}
@media(max-width:680px){
 body #defaultDashboard .clean-activity li > * { grid-area:auto; }
 body #defaultDashboard .clean-activity li > .clean-row-icon { display:none; }
 body #defaultDashboard .clean-activity li > time { justify-self:start; font-size:12px; color:var(--muted); }
}
@media(max-width:680px){
 body #defaultDashboard .clean-activity li.money-stacked { grid-template-columns:minmax(0,1fr); }
 body #defaultDashboard .clean-activity li .clean-row-amount { grid-column:1; grid-row:auto; width:auto; box-sizing:border-box; justify-self:stretch; margin:0; }
 body #defaultDashboard .clean-activity li .clean-row-copy, body #defaultDashboard .clean-activity li time { grid-column:1; grid-row:auto; }
}
@media(max-width:680px){
 body #defaultDashboard .clean-balance .clean-totals > div { flex:1 1 100%; box-sizing:border-box; }
}
/* Restore the purple calendar identity in both light and dark themes. */
body #defaultDashboard .clean-balance .overview-calendar {
 background:linear-gradient(135deg,#5a258f,#7135ad 70%,#8047bb);
 color:#fff; border:1px solid #8f60c3;
 box-shadow:0 8px 22px #54218f24,inset 0 1px 0 #ffffff35;
}
body #defaultDashboard .clean-balance .overview-calendar :is(.overview-calendar-head h3,.overview-calendar-head b,.overview-calendar-grid button) { color:#fff; }
body #defaultDashboard .clean-balance .overview-calendar :is(.overview-calendar-week,.overview-calendar-hint) { color:#f0e3fc; }
body #defaultDashboard .clean-balance .overview-calendar .overview-calendar-head button { background:#ffffff14; color:#fff; border-color:#d8bbef; box-shadow:inset 0 1px 0 #ffffff20,0 2px 4px #23094120; }
body #defaultDashboard .clean-balance .overview-calendar [data-has-transactions="true"] { background:#ffffff18; }
body #defaultDashboard .clean-balance .overview-calendar [data-has-transactions="true"] i { background:#f0dfff; }
body #defaultDashboard .clean-balance .overview-calendar :is([data-today="true"],[aria-expanded="true"]) { background:#ead7fb; color:#3c165d; border-color:#fff; box-shadow:0 2px 6px #23094130; }
body #defaultDashboard .clean-balance .overview-calendar :is([data-today="true"],[aria-expanded="true"]) i { background:#7134c4; }
body #defaultDashboard .clean-balance .overview-calendar button:hover { background:#ffffff29; color:#fff; border-color:#fff; }
body #defaultDashboard .clean-balance .overview-calendar button:focus-visible { outline:3px solid #fff; outline-offset:2px; }
@media(forced-colors:active){
 body #defaultDashboard .clean-balance .overview-calendar { background:Canvas; color:CanvasText; border-color:CanvasText; box-shadow:none; }
 body #defaultDashboard .clean-balance .overview-calendar :is(h3,b,.overview-calendar-week,.overview-calendar-hint,button) { color:CanvasText; }
 body #defaultDashboard .clean-balance .overview-calendar button:focus-visible { outline-color:Highlight; }
}
/* Leave the mobile navigation and raised Quick Add visible beneath daily logs. */
@media(max-width:680px){
 body #overviewDayPreview.overview-day-sheet { bottom:calc(128px + env(safe-area-inset-bottom)) !important; max-height:max(140px,calc(100dvh - 220px)); }
}
body #defaultDashboard .clean-balance .overview-calendar .overview-calendar-grid button:is([data-today="true"],[aria-expanded="true"]) { color:#3c165d; }
body #defaultDashboard .clean-balance .overview-calendar .overview-calendar-grid button:is([data-today="true"],[aria-expanded="true"]):hover { background:#ead7fb; color:#3c165d; }
/* Bring back visible purple tile fills while preserving semantic amount colors. */
body {
 --tile-fill:linear-gradient(145deg,#ead8fa,#f3e7fc);
 --tile-line:#d4b5ec;
 --tile-inner:#e5cff6;
 --tile-summary:#ead7fa;
}
body.dark {
 --tile-fill:linear-gradient(145deg,#432957,#34213f);
 --tile-line:#76528e;
 --tile-inner:#4b305d;
 --tile-summary:#4b305d;
}
body #defaultDashboard .clean-card:not(.clean-balance),
body .main .goal-card,
body .main .subscription-card,
body .main .account.card,
body #moreAccountProfile {
 background:var(--tile-fill);border-color:var(--tile-line);box-shadow:var(--depth-raised);
}
body #defaultDashboard .clean-account-balances li {
 background:var(--tile-inner);border-color:var(--tile-line);border-inline-start-color:var(--b);
}
body #defaultDashboard .clean-balance .clean-totals > div {
 background:var(--tile-summary);border-color:#dfc4f3 !important;
 --summary-income:#17663f;--summary-expense:#b42336;
}
body.dark #defaultDashboard .clean-balance .clean-totals > div {
 border-color:#9872ae !important;--summary-income:#a6efc2;--summary-expense:#ffb1bd;
}
body #reports .report-summary > .card.metric {
 background:var(--tile-fill);border-color:var(--tile-line);box-shadow:var(--depth-raised);
}
body .main .more-card:not(.host-more-workspace),
body #accounts .manage-hub-grid {
 background:var(--tile-fill);border-color:var(--tile-line);
}
body #accounts .inner-nav-row { background:transparent; }
@media(forced-colors:active){
 body #defaultDashboard .clean-card:not(.clean-balance),body .main .goal-card,
 body #defaultDashboard .clean-account-balances li,body #reports .report-summary > .card.metric,
 body #defaultDashboard .clean-balance .clean-totals > div {
  background:Canvas;border-color:CanvasText !important;box-shadow:none;
 }
}
