﻿
:root {
  --bg: #000000;
  --bg-elev: #0d0d0d;
  --surface: #171717;
  --surface-elev: #1f1f1f;
  --text-primary: #f1f1f1;
  --text-secondary: #a6a6a6;
  --text-tertiary: #777777;
  --income: #f0f0f0;
  --expense: #cecece;
  --transfer: #9f9f9f;
  --accent: #ffffff;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.18);
  --danger: #d9d9d9;
  --quick-send-bg: #151515;
  --quick-send-border: rgba(255, 255, 255, 0.42);
  --danger-bg: rgba(255, 255, 255, 0.08);
  --danger-border: rgba(255, 255, 255, 0.28);
  --danger-text: #f1f1f1;
  --tab-active-bg: rgba(255, 255, 255, 0.14);
  --tab-active-border: rgba(255, 255, 255, 0.46);
  --period-tab-inactive: #8b8b8b;
  --period-tab-active-bg: rgba(255, 255, 255, 0.18);
  --period-tab-active-border: rgba(255, 255, 255, 0.58);
  --type-tab-inactive: #8a8a8a;
  --type-expense-bg: rgba(255, 255, 255, 0.12);
  --type-expense-border: rgba(255, 255, 255, 0.34);
  --type-expense-text: #f1f1f1;
  --type-income-bg: rgba(255, 255, 255, 0.2);
  --type-income-border: rgba(255, 255, 255, 0.42);
  --type-income-text: #ffffff;
  --donut-total: #d8d8d8;
  --chip-active-bg: rgba(255, 255, 255, 0.12);
  --chip-active-border: rgba(255, 255, 255, 0.45);
  --bar-grad-start: #f0f0f0;
  --bar-grad-end: rgba(255, 255, 255, 0.28);
  --seg-active-bg: rgba(255, 255, 255, 0.15);
  --seg-active-border: rgba(255, 255, 255, 0.9);
  --home-record-title: #d0d0d0;
  --nav-active-pill: rgba(255, 255, 255, 0.2);
  --install-border: rgba(255, 255, 255, 0.45);
  --install-bg: rgba(20, 20, 20, 0.95);
  --install-text: #efefef;
  --badge-error: #ffd4d4;
  --frame-width-effective: 430px;
  --shell-pad-x: 16px;
  --frame-inner-width: calc(min(100%, var(--frame-width-effective)) - (var(--shell-pad-x) * 2));
  --bottom-nav-height: 104px;
}

body[data-theme="warm"] {
  --bg: #000000;
  --bg-elev: #121110;
  --surface: #23201e;
  --surface-elev: #2a2522;
  --text-primary: #f5f2ef;
  --text-secondary: #9e9690;
  --text-tertiary: #6f6862;
  --income: #9fd4a6;
  --expense: #f2a692;
  --transfer: #ffe082;
  --accent: #f4b74f;
  --glass: rgba(255, 249, 245, 0.1);
  --glass-border: rgba(255, 249, 245, 0.22);
  --danger: #ff6d6d;
  --quick-send-bg: #2c251d;
  --quick-send-border: rgba(244, 183, 79, 0.45);
  --danger-bg: rgba(255, 109, 109, 0.14);
  --danger-border: rgba(255, 109, 109, 0.36);
  --danger-text: #ffb8b8;
  --tab-active-bg: rgba(255, 183, 77, 0.14);
  --tab-active-border: rgba(255, 183, 77, 0.46);
  --period-tab-inactive: #7d7670;
  --period-tab-active-bg: rgba(244, 183, 79, 0.16);
  --period-tab-active-border: rgba(244, 183, 79, 0.62);
  --type-tab-inactive: #7f7871;
  --type-expense-bg: rgba(121, 56, 46, 0.36);
  --type-expense-border: rgba(235, 151, 135, 0.44);
  --type-expense-text: #f5aa97;
  --type-income-bg: rgba(35, 80, 55, 0.44);
  --type-income-border: rgba(125, 198, 146, 0.44);
  --type-income-text: #9fd4a6;
  --donut-total: #d8d0ca;
  --chip-active-bg: rgba(255, 183, 77, 0.14);
  --chip-active-border: rgba(255, 183, 77, 0.46);
  --bar-grad-start: #ffb49b;
  --bar-grad-end: rgba(255, 151, 112, 0.35);
  --seg-active-bg: rgba(244, 183, 79, 0.16);
  --seg-active-border: rgba(244, 183, 79, 0.92);
  --home-record-title: #cdc7c2;
  --nav-active-pill: rgba(244, 183, 79, 0.2);
  --install-border: rgba(255, 183, 77, 0.45);
  --install-bg: rgba(30, 24, 12, 0.95);
  --install-text: #ffd9a8;
  --badge-error: #ffb3b3;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: "Roboto", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

html {
  scrollbar-gutter: stable both-edges;
  overflow-y: scroll;
}

body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  scroll-padding-bottom: calc(var(--bottom-nav-height) + 24px);
  overflow-x: hidden;
}

body.onboarding-open {
  overflow: hidden;
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
  animation: splashFadeOut 0.4s ease-in-out 2.2s forwards;
}

.splash-screen::before,
.splash-screen::after {
  content: none;
}

.splash-screen::before {
  display: none;
}

.splash-screen::after {
  display: none;
}

.splash-media {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: min(40vw, 188px);
  min-width: 122px;
  padding: 16px 14px 14px;
  position: relative;
  z-index: 2;
}

.splash-image {
  width: 90px;
  height: auto;
  border-radius: 22px;
  margin-bottom: 20px;
  opacity: 0;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08) brightness(1.04);
  animation: popIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

.splash-name {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 2px;
  line-height: 1;
  color: #333333;
  user-select: none;
  text-align: center;
}

.splash-slogan {
  margin: 0;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 4px;
  color: #222222;
  padding-left: 4px;
  white-space: nowrap;
  user-select: none;
}

.char {
  display: inline-block;
  opacity: 0;
  transform: translateX(-8px);
}

.splash-screen.is-exiting {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes lightUp {
  0% {
    opacity: 0;
    transform: translateX(-8px);
    color: #333333;
  }
  100% {
    opacity: 1;
    transform: translateX(0);
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
  }
}

@keyframes lightUpSlogan {
  0% {
    opacity: 0;
    transform: translateX(-5px);
    color: #222222;
  }
  100% {
    opacity: 1;
    transform: translateX(0);
    color: #aaaaaa;
  }
}

@keyframes splashFadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

@keyframes showMainContent {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash-screen,
  .splash-media,
  .splash-image,
  .char,
  .app-shell {
    animation: none !important;
  }
  .char {
    opacity: 1;
    transform: none;
  }
  .splash-screen {
    opacity: 1;
  }
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button:disabled,
input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.app-shell {
  width: min(100%, var(--frame-width-effective));
  max-width: var(--frame-width-effective);
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px var(--shell-pad-x) calc(var(--bottom-nav-height) + 24px + env(safe-area-inset-bottom));
  background: var(--bg);
}

body.splash-active .app-shell {
  opacity: 0;
  pointer-events: none;
}

body.app-revealing .app-shell {
  opacity: 0;
  animation: showMainContent 0.8s ease-in-out 2.4s forwards;
}

body.splash-active {
  overflow: hidden;
}

body.splash-done .app-shell {
  pointer-events: auto;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 12px;
}

#appTitle {
  margin: 0;
  font-size: clamp(28px, 5vw, 56px);
  line-height: 1.1;
  letter-spacing: 0;
  font-weight: 700;
}

.title-sub {
  display: none;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.header-actions .icon-btn {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 8px;
}

.icon-btn {
  border: 0;
  background: transparent;
  border-radius: 999px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  color: var(--text-secondary);
}

.icon-only {
  display: grid;
  place-items: center;
}

.icon-only svg {
  width: 24px;
  height: 24px;
  overflow: visible;
}

.icon-only svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.screen {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.screen > * {
  min-width: 0;
}

.hidden {
  display: none !important;
}

.card {
  background: var(--surface-elev);
  border: 1px solid var(--glass-border);
  border-radius: 30px;
  padding: 20px;
}

.card-title {
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-size: 15px;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 700;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kpi {
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 16px 18px;
}

.kpi-label {
  color: var(--text-secondary);
  font-size: 14px;
}

.kpi-value {
  margin-top: 8px;
  font-size: clamp(34px, 10vw, 58px);
  font-family: "Consolas", "SF Mono", monospace;
  font-weight: 700;
}

.kpi-value.expense {
  color: var(--expense);
}

.kpi-value.income {
  color: var(--income);
}

.budget-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.budget-card {
  cursor: pointer;
}

.budget-subrow {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
}

.budget-subrow span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
}

.mini-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
}

.mini-icon svg {
  width: 16px;
  height: 16px;
}

.mini-icon svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.budget-ring {
  width: 122px;
  height: 122px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.budget-ring-inner {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  font-family: "Consolas", "SF Mono", monospace;
  font-size: 24px;
  font-weight: 700;
}

.home-budget-card .kpi-value {
  font-size: calc(clamp(46px, 14vw, 90px) * var(--budget-value-scale, 1));
  line-height: 0.96;
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-budget-card {
  --budget-value-scale: 1;
  --budget-ring-scale: 1;
  --budget-ring-base: 122px;
  --budget-ring-inner-base: 90px;
  --budget-ring-font-base: 24px;
}

.home-budget-card .budget-main {
  min-width: 0;
}

.home-budget-card .budget-ring {
  width: calc(var(--budget-ring-base) * var(--budget-ring-scale, 1));
  height: calc(var(--budget-ring-base) * var(--budget-ring-scale, 1));
  min-width: calc(var(--budget-ring-base) * var(--budget-ring-scale, 1));
}

.home-budget-card .budget-ring-inner {
  width: calc(var(--budget-ring-inner-base) * var(--budget-ring-scale, 1));
  height: calc(var(--budget-ring-inner-base) * var(--budget-ring-scale, 1));
  font-size: clamp(16px, calc(var(--budget-ring-font-base) * var(--budget-ring-scale, 1)), 24px);
}

.home-wave-card {
  margin: 0 -2px;
  padding: 2px 0 0;
}

.home-wave-card .bar-chart {
  height: 146px;
}

.home-input-card {
  background: transparent;
  border: 0;
  padding: 0;
}

.home-records {
  display: grid;
  gap: 10px;
}

.home-records-title {
  font-size: 18px;
  color: var(--home-record-title);
  margin-bottom: 2px;
}

.quick-input {
  display: flex;
  gap: 10px;
  align-items: center;
}

.quick-input input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--glass-border);
  background: var(--surface);
  border-radius: 999px;
  padding: 16px 22px;
  font-size: 22px;
}

.primary-btn,
.secondary-btn,
.text-btn {
  border-radius: 18px;
  border: 1px solid transparent;
  padding: 12px 18px;
  cursor: pointer;
}

.primary-btn {
  background: var(--accent);
  color: #000;
  font-weight: 700;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--glass-border);
}

.quick-send {
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--quick-send-bg);
  border: 1px solid var(--quick-send-border);
  color: var(--accent);
  font-size: 22px;
}

.text-btn {
  background: transparent;
  border-color: var(--glass-border);
  color: var(--text-secondary);
}

.danger-btn {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.list {
  display: grid;
  gap: 12px;
}

.tx-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  border-radius: 22px;
  border: 1px solid var(--glass-border);
  background: var(--surface);
  padding: 16px 18px;
}

.tx-main {
  min-width: 0;
  cursor: pointer;
}

.tx-cat {
  font-size: 22px;
  line-height: 1.2;
}

.tx-note {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-amount {
  font-size: 24px;
  font-family: "Consolas", "SF Mono", monospace;
  font-weight: 700;
}

.tx-amount.expense {
  color: var(--expense);
}

.tx-amount.income {
  color: var(--income);
}

.tx-tools {
  display: flex;
  gap: 6px;
}

.tx-tool {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.tx-tool svg {
  width: 22px;
  height: 22px;
}

.tx-tool svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.tab-btn {
  border: 1px solid var(--glass-border);
  background: var(--surface);
  border-radius: 18px;
  padding: 10px 18px;
  min-width: 92px;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--tab-active-bg);
  border-color: var(--tab-active-border);
  color: var(--accent);
}

.summary-period-panel,
.summary-type-panel {
  background: transparent;
  border: 0;
  padding: 0;
}

.summary-period-panel .tabs {
  gap: 6px;
  justify-content: space-between;
}

.summary-period-panel .tab-btn {
  min-width: 78px;
  padding: 9px 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--period-tab-inactive);
  font-size: 22px;
}

.summary-period-panel .tab-btn.active {
  background: var(--period-tab-active-bg);
  border-color: var(--period-tab-active-border);
  color: var(--accent);
}

.summary-kpi-grid {
  gap: 12px;
}

.summary-kpi-grid .kpi {
  border-radius: 26px;
  padding: 14px 16px;
}

.summary-kpi-grid .kpi-label {
  font-size: 13px;
}

.summary-kpi-grid .kpi-value {
  font-size: clamp(30px, 8vw, 48px);
}

.summary-type-panel .tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.summary-type-panel .tab-btn {
  min-width: 0;
  border-radius: 20px;
  padding: 12px 0;
  background: transparent;
  border-color: transparent;
  color: var(--type-tab-inactive);
  font-size: 22px;
}

.summary-type-panel .tab-btn.active {
  background: var(--type-expense-bg);
  border-color: var(--type-expense-border);
  color: var(--type-expense-text);
}

.summary-type-panel .tab-btn.active[data-type="INCOME"] {
  background: var(--type-income-bg);
  border-color: var(--type-income-border);
  color: var(--type-income-text);
}

.summary-donut-card,
.summary-trend-card,
.summary-ai-card {
  padding: 18px 18px 16px;
}

.summary-trend-inner {
  margin-top: 8px;
  min-width: 0;
}

.custom-range-inline {
  margin-top: 8px;
}

.donut-wrap {
  display: grid;
  place-items: center;
  margin-top: 2px;
}

.donut-ring {
  width: min(68vw, 280px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.donut-center {
  width: 64%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--surface-elev);
  display: grid;
  place-items: center;
  text-align: center;
}

.donut-total {
  font-size: 24px;
  font-family: "Consolas", "SF Mono", monospace;
  color: var(--donut-total);
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--glass-border);
  background: var(--surface);
  border-radius: 10px;
  padding: 7px 12px;
  color: var(--text-secondary);
  cursor: pointer;
}

.chip.active {
  background: var(--chip-active-bg);
  border-color: var(--chip-active-border);
  color: var(--accent);
}

.bar-chart {
  width: 100%;
  height: 180px;
}

.bars-wrap {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(24px, 1fr);
  align-items: end;
  gap: 14px;
  min-height: 214px;
  overflow-x: auto;
  max-width: 100%;
  padding: 0 8px 4px;
}

.bars-wrap-year {
  grid-auto-columns: minmax(0, 1fr);
  gap: 8px;
  overflow-x: hidden;
}

.bars-wrap-year .bar-col {
  min-width: 0;
}

.bars-wrap-year .bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-col {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  gap: 10px;
  cursor: pointer;
}

.bar-fill {
  width: 100%;
  border-radius: 12px 12px 4px 4px;
  background: linear-gradient(180deg, var(--bar-grad-start) 0%, var(--bar-grad-end) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.bar-label {
  text-align: center;
  font-size: 14px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.legend {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.legend-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 16px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.ai-box {
  min-height: 0;
  margin-top: 12px;
  border: 0;
  border-radius: 0;
  padding: 2px 2px 0;
  background: transparent;
  color: var(--text-secondary);
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 18px;
}

.ai-entry {
  margin-top: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 22px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

.ai-entry.disabled {
  opacity: 0.7;
  cursor: progress;
}

.ai-entry-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 18px;
}

.ai-entry-left svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.ai-entry-left svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-entry-gear {
  width: 36px;
  height: 36px;
  min-width: 36px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: min(100%, var(--frame-width-effective));
  max-width: var(--frame-width-effective);
  margin: 0 auto;
  background: var(--bg-elev);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 12px 10px calc(10px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: var(--bottom-nav-height);
  z-index: 20;
}

.nav-btn {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  padding: 4px 8px;
  display: grid;
  place-items: center;
  gap: 6px;
  cursor: pointer;
}

.nav-btn.active {
  background: transparent;
  color: var(--accent);
}

.nav-icon {
  display: inline-flex;
  width: 92px;
  height: 52px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 24px;
  height: 24px;
}

.nav-icon svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  font-size: 20px;
}

.nav-btn.active .nav-icon {
  background: var(--nav-active-pill);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 40;
}

.onboarding-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(2px);
}

.onboarding-panel {
  width: min(var(--frame-width-effective), calc(100vw - 24px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  border-radius: 28px;
  border: 1px solid rgba(0, 0, 0, 0.22);
  background:
    radial-gradient(circle at 22% 16%, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0) 42%),
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.035) 0px, rgba(0, 0, 0, 0.035) 1px, transparent 1px, transparent 30px),
    linear-gradient(180deg, #ffffff 0%, #fefefc 100%);
  padding: 18px 18px 16px;
}

.onboarding-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.onboarding-counter {
  font-family: "Consolas", "SF Mono", monospace;
  color: #2a2a2a;
  font-size: 12px;
  letter-spacing: 0.22em;
}

.onboarding-skip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: rgba(255, 255, 255, 0.84);
  color: #1a1a1a;
  min-height: 0;
}

.onboarding-art {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.onboarding-line {
  height: 1px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.06));
}

.onboarding-art-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.26);
  display: grid;
  place-items: center;
  color: #111111;
}

.onboarding-art-icon svg {
  width: 22px;
  height: 22px;
}

.onboarding-art-icon svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.onboarding-title {
  margin: 14px 0 8px;
  color: #111111;
  font-size: clamp(28px, 6.2vw, 42px);
  line-height: 1.06;
}

.onboarding-desc {
  margin: 0;
  color: #1d1d1d;
  font-size: 17px;
  line-height: 1.58;
}

.onboarding-tip {
  margin: 10px 0 0;
  color: #5b5b5b;
  font-size: 13px;
  letter-spacing: 0.08em;
  line-height: 1.45;
}

.onboarding-dots {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.onboarding-dot {
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.16);
}

.onboarding-dot.active {
  background: rgba(0, 0, 0, 0.85);
}

.onboarding-actions {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.onboarding-actions .primary-btn {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
}

.onboarding-actions .secondary-btn {
  background: rgba(255, 255, 255, 0.85);
  color: #1a1a1a;
  border-color: rgba(0, 0, 0, 0.22);
}

.modal {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(var(--frame-width-effective), 100vw);
  max-height: calc(100vh - 8px);
  overflow: auto;
  z-index: 50;
  border: 1px solid var(--glass-border);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: var(--bg-elev);
  padding: 18px;
}

.sheet-grip {
  width: 42px;
  height: 4px;
  border-radius: 99px;
  margin: 2px auto 12px;
  background: rgba(255, 255, 255, 0.24);
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-row {
  display: grid;
  gap: 6px;
}

.form-row label {
  color: var(--text-secondary);
  font-size: 12px;
}

.form-row input,
.form-row select,
.form-row textarea {
  border: 1px solid var(--glass-border);
  background: var(--surface);
  border-radius: 18px;
  padding: 12px 14px;
  min-height: 48px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-cell {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
}

.config-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.config-title {
  font-size: 52px;
  line-height: 1.05;
}

.config-block-title {
  margin: 22px 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: #beb8b3;
}

.seg-grid {
  display: grid;
  gap: 10px;
}

.seg-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.seg-btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #222325;
  color: var(--text-secondary);
  border-radius: 20px;
  min-height: 58px;
  padding: 10px 14px;
  font-size: 20px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--seg-active-bg);
  border-color: var(--seg-active-border);
  color: var(--accent);
  font-weight: 700;
}

.close-icon-btn {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 50%;
}

.config-close-btn {
  background: rgba(255, 255, 255, 0.08);
}

.day-close-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  background: transparent;
}

.block-btn {
  min-height: 56px;
  font-size: 18px;
}

.test-result {
  margin-top: 10px;
  min-height: 22px;
}

.full-width-actions {
  justify-content: stretch;
}

.full-save-btn {
  width: 100%;
  min-height: 62px;
  font-size: 24px;
  border-radius: 22px;
}

.modal-full {
  top: 0;
  bottom: 0;
  width: min(var(--frame-width-effective), 100vw);
  max-height: 100vh;
  border-radius: 0;
  border: 0;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
}

.modal-full .sheet-grip {
  display: none;
}

.modal-center {
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  width: min(var(--frame-width-effective), calc(100vw - 24px));
  max-height: 84vh;
  border-radius: 34px;
  border: 1px solid var(--glass-border);
}

.modal-center .sheet-grip {
  display: none;
}

.day-detail-modal {
  padding: 22px 20px;
}

.day-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.day-detail-head h3 {
  margin: 0;
  font-size: clamp(26px, 7vw, 44px);
}

.day-detail-list {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.day-detail-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.day-empty {
  color: var(--text-tertiary);
  text-align: center;
  font-size: 22px;
  padding: 120px 0;
}

body[data-device-mode="tablet"] .app-shell {
  --shell-pad-x: 22px;
}

body[data-device-mode="tablet"] .card {
  border-radius: 34px;
  padding: 24px;
}

body[data-device-mode="tablet"] #appTitle {
  font-size: clamp(34px, 4vw, 58px);
}

body[data-device-mode="tablet"] .summary-period-panel .tab-btn,
body[data-device-mode="tablet"] .summary-type-panel .tab-btn {
  font-size: 24px;
}

body[data-device-mode="tablet"] .donut-ring {
  width: min(46vw, 360px);
}

.install-hint {
  position: fixed;
  right: 10px;
  left: 10px;
  bottom: 90px;
  z-index: 24;
  border-radius: 14px;
  border: 1px solid var(--install-border);
  background: var(--install-bg);
  color: var(--install-text);
  padding: 10px 12px;
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 60;
  min-width: 120px;
  max-width: calc(100vw - 30px);
  text-align: center;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(18, 17, 16, 0.95);
  padding: 10px 14px;
  font-size: 13px;
}

.small {
  color: var(--text-secondary);
  font-size: 12px;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-top-color: #000;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.badge-ok {
  color: var(--income);
}

.badge-error {
  color: var(--badge-error);
}

@media (max-width: 640px) {
  :root {
    --shell-pad-x: 12px;
  }

  .app-shell {
    padding-bottom: calc(var(--bottom-nav-height) + 16px + env(safe-area-inset-bottom));
  }

  #appTitle {
    font-size: clamp(24px, 8vw, 44px);
  }

  .card {
    border-radius: 24px;
    padding: 16px;
  }

  .kpi-value {
    font-size: clamp(28px, 8vw, 56px);
  }

  .budget-ring {
    width: 104px;
    height: 104px;
  }

  .budget-ring-inner {
    width: 76px;
    height: 76px;
    font-size: 20px;
  }

  .home-budget-card {
    --budget-ring-base: 104px;
    --budget-ring-inner-base: 76px;
    --budget-ring-font-base: 20px;
  }

  .quick-input input {
    font-size: 16px;
    padding: 14px 18px;
  }

  .tx-item {
    grid-template-columns: 1fr auto auto;
    border-radius: 18px;
    padding: 14px;
  }

  .tx-cat {
    font-size: 18px;
  }

  .tx-note {
    font-size: 14px;
  }

  .tx-amount {
    font-size: 18px;
  }

  .budget-layout {
    grid-template-columns: 1fr;
  }

  .day-detail-head h3 {
    font-size: clamp(24px, 8vw, 38px);
  }

  .day-empty {
    font-size: 24px;
    padding: 72px 0;
  }
}

@media (min-width: 760px) {
  .modal:not(.modal-full):not(.modal-center) {
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    border-radius: 18px;
    border-bottom: 1px solid var(--glass-border);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
