:root {
  color-scheme: light;
  --primary: #123f36;
  --primary-strong: #0b312a;
  --on-primary: #ffffff;
  --accent: #b8f34a;
  --accent-soft: #ebfacd;
  --background: #f4f7f2;
  --surface: #ffffff;
  --surface-subtle: #edf3ef;
  --text: #16211d;
  --text-muted: #66736e;
  --border: #dce5e0;
  --border-strong: #c5d2cc;
  --income: #087a5b;
  --income-soft: #def5ec;
  --danger: #b93636;
  --danger-soft: #fce8e8;
  --warning: #9a5d09;
  --warning-soft: #fff1d5;
  --shadow: 0 12px 34px rgba(26, 60, 49, 0.09);
  --shadow-float: 0 24px 70px rgba(5, 24, 18, 0.26);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --visual-viewport-height: 100dvh;
  --keyboard-inset: 0px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --primary: #b8f34a;
  --primary-strong: #d0ff78;
  --on-primary: #123f36;
  --accent: #b8f34a;
  --accent-soft: #253c20;
  --background: #0e1714;
  --surface: #16231f;
  --surface-subtle: #1c2c27;
  --text: #f1f6f3;
  --text-muted: #9dada6;
  --border: #2a3a34;
  --border-strong: #3c4e47;
  --income: #69d9b1;
  --income-soft: #15392e;
  --danger: #ff9999;
  --danger-soft: #402323;
  --warning: #f2bf68;
  --warning-soft: #3d321d;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.2);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: #0b2b24; }
body { margin: 0; min-width: 320px; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; background: #0b2b24; color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button { color: inherit; touch-action: manipulation; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
input, textarea, select { scroll-margin-block: 88px; }
button { cursor: pointer; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; min-height: 44px; display: inline-flex; align-items: center; padding: 10px 14px; background: var(--surface); color: var(--text); border-radius: 10px; transform: translateY(-160%); transition: transform 180ms ease; }
.skip-link:focus { transform: translateY(0); }

button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary), transparent 58%); outline-offset: 2px; }
input { min-width: 0; color: var(--text); }
input::placeholder { color: color-mix(in srgb, var(--text-muted), transparent 18%); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.auth-gate { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; overflow-y: auto; padding: 24px; background: radial-gradient(circle at 18% 12%, rgba(184,243,74,.18), transparent 30%), #0b2b24; }
.auth-gate[hidden] { display: none; }
.login-card { width: min(430px, 100%); padding: 30px 26px; border-radius: 30px; background: var(--background); box-shadow: var(--shadow-float); }
.login-brand { display: flex; align-items: center; gap: 11px; font-size: 14px; font-weight: 760; }
.login-copy { margin: 38px 0 24px; }
.login-copy h1 { font-size: 32px; }
.login-copy p { margin-top: 9px; color: var(--text-muted); font-size: 13px; line-height: 1.6; }
.login-form { display: flex; flex-direction: column; gap: 4px; }
.login-form .field { margin-top: 12px; }
.password-wrap { padding-right: 4px; }
.password-wrap button { flex: 0 0 44px; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--text-muted); }
.password-wrap button:hover { background: var(--surface-subtle); color: var(--primary); }
.password-wrap button svg { width: 19px; height: 19px; }
.login-error { min-height: 20px; margin: 5px 0; color: var(--danger); font-size: 11px; }
.prototype-notice { display: flex; gap: 9px; margin-top: 18px; padding: 13px; border-radius: 15px; background: var(--accent-soft); color: var(--text-muted); }
.prototype-notice > svg { flex: 0 0 auto; width: 18px; height: 18px; color: var(--primary); }
.prototype-notice p { font-size: 10px; line-height: 1.55; }
.prototype-notice strong { display: block; margin-bottom: 2px; color: var(--text); }

.desktop-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(280px, 1fr) 430px minmax(28px, 0.25fr); align-items: center; gap: clamp(32px, 6vw, 96px); padding: 28px; background: radial-gradient(circle at 16% 16%, rgba(184, 243, 74, 0.12), transparent 28%), #0b2b24; }
.desktop-intro { justify-self: end; width: min(480px, 100%); color: white; }
.brand-lockup { display: flex; align-items: center; gap: 12px; font-weight: 750; }
.brand-lockup--large { font-size: 20px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: #123f36; background: var(--accent); transform: rotate(-8deg); }
.brand-mark svg { width: 26px; height: 26px; }
.desktop-intro > p { margin: 42px 0 36px; font-size: clamp(30px, 3.4vw, 54px); line-height: 1.2; font-weight: 720; letter-spacing: -0.04em; }
.court-lines { display: flex; align-items: center; gap: 10px; width: 230px; }
.court-lines span { height: 5px; border-radius: 999px; background: rgba(255,255,255,.26); }
.court-lines span:nth-child(1) { width: 110px; background: var(--accent); }
.court-lines span:nth-child(2) { width: 52px; }
.court-lines span:nth-child(3) { width: 24px; }

.app-shell { position: relative; width: 430px; height: min(900px, calc(100vh - 56px)); min-height: 680px; overflow: hidden; background: var(--background); border: 1px solid rgba(255,255,255,.2); border-radius: 34px; box-shadow: var(--shadow-float); transition: background 180ms ease; }
.app-main { height: 100%; overflow: hidden; }
.screen { display: none; height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding-bottom: calc(102px + var(--safe-bottom)); }
.screen::-webkit-scrollbar { display: none; }
.screen.is-active { display: block; animation: screen-in 210ms cubic-bezier(.2,.7,.2,1); }
@keyframes screen-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.app-header { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 26px 20px 18px; background: color-mix(in srgb, var(--background), transparent 6%); }
.app-header--stacked { display: block; padding-bottom: 12px; }
.header-title-row { display: flex; align-items: center; justify-content: space-between; }
.eyebrow, .section-kicker { display: block; margin-bottom: 4px; color: var(--text-muted); font-size: 12px; line-height: 1.4; font-weight: 680; letter-spacing: .06em; }
h1, h2, p { margin: 0; }
h1, h2 { scroll-margin-top: 84px; text-wrap: balance; }
h1 { font-size: 27px; line-height: 1.18; letter-spacing: -.035em; }
h2 { font-size: 18px; line-height: 1.35; letter-spacing: -.015em; }
.icon-button { display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 48px; padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); transition: background 180ms ease, border-color 180ms ease, opacity 180ms ease; }
.icon-button:hover { background: var(--surface-subtle); border-color: var(--border-strong); }
.icon-button:active { opacity: .72; }
.icon-button--filled { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
.icon-button--filled:hover { background: var(--primary-strong); }
.theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }
html[data-theme="dark"] .theme-icon-moon { display: none; }

.content-stack { display: flex; flex-direction: column; gap: 24px; padding: 0 20px 24px; }
.home-content { gap: 28px; }
.hero-card { position: relative; overflow: hidden; min-height: 190px; padding: 22px; border-radius: 24px; background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow); }
.hero-card__pattern { position: absolute; right: -46px; top: -62px; width: 190px; height: 190px; border: 24px solid color-mix(in srgb, var(--accent), transparent 73%); border-radius: 50%; }
.hero-card__pattern::after { content: ""; position: absolute; left: -78px; bottom: -72px; width: 148px; height: 148px; border: 1px solid color-mix(in srgb, var(--on-primary), transparent 75%); transform: rotate(35deg); }
.hero-card__topline, .hero-card__footer { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 13px; }
.hero-card__topline > span:first-child { opacity: .78; }
.hero-amount { position: relative; margin: 18px 0 21px; font-size: 40px; line-height: 1; font-weight: 760; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.hero-amount small, .personal-total-card strong small { margin-right: 4px; font-size: .5em; font-weight: 650; }
.hero-card__footer { padding-top: 16px; border-top: 1px solid color-mix(in srgb, var(--on-primary), transparent 82%); }
.status-pill { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 4px 9px; border-radius: 999px; color: var(--text-muted); background: var(--surface-subtle); font-size: 11px; font-weight: 680; white-space: nowrap; }
.status-pill svg { width: 14px; height: 14px; }
.status-pill--light { color: var(--on-primary); background: color-mix(in srgb, var(--on-primary), transparent 86%); }
.status-pill--success { color: var(--income); background: var(--income-soft); }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--primary); font-size: 13px; font-weight: 680; }
.text-button svg { width: 16px; height: 16px; }
.text-button--light { color: var(--on-primary); }

.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 13px; }
.section-heading--inline { align-items: center; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick-card { min-height: 146px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; padding: 16px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); text-align: left; box-shadow: 0 6px 18px rgba(25,60,49,.04); transition: background 180ms ease, border-color 180ms ease, opacity 180ms ease; }
.quick-card:hover { border-color: var(--border-strong); background: var(--surface-subtle); }
.quick-card:active { opacity: .75; }
.quick-card--primary { color: var(--on-primary); background: var(--primary); border-color: var(--primary); }
.quick-card--primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.quick-card__icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: auto; border-radius: 13px; color: var(--primary); background: var(--accent-soft); }
.quick-card--primary .quick-card__icon { background: var(--accent); color: #123f36; }
.quick-card strong { margin: 16px 0 3px; font-size: 16px; }
.quick-card > span:last-child { color: var(--text-muted); font-size: 12px; }
.quick-card--primary > span:last-child { color: color-mix(in srgb, var(--on-primary), transparent 30%); }

.activity-card { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); box-shadow: 0 8px 24px rgba(25,60,49,.05); }
.activity-card__date { flex: 0 0 48px; height: 59px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 15px; color: var(--primary); background: var(--accent-soft); }
.activity-card__date strong { font-size: 20px; line-height: 1; }
.activity-card__date span { margin-top: 3px; font-size: 11px; }
.activity-card__body { min-width: 0; flex: 1; }
.activity-card__title { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.activity-card__title > strong { max-width: 168px; font-size: 15px; line-height: 1.45; }
.activity-meta { display: flex; flex-wrap: wrap; gap: 7px 12px; margin-top: 10px; color: var(--text-muted); font-size: 11px; }
.activity-meta span { display: inline-flex; align-items: center; gap: 4px; }
.activity-meta svg { width: 14px; height: 14px; }
.activity-split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 12px; padding: 13px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.activity-split div { display: flex; flex-direction: column; gap: 3px; }
.activity-split span { color: var(--text-muted); font-size: 10px; }
.activity-split strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.primary-button, .secondary-button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 17px; border-radius: 14px; font-weight: 700; transition: background 180ms ease, border-color 180ms ease, color 180ms ease, opacity 180ms ease; }
.primary-button { border: 1px solid var(--primary); background: var(--primary); color: var(--on-primary); }
.primary-button:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.primary-button:active, .secondary-button:active { opacity: .72; }
.primary-button svg, .secondary-button svg { width: 18px; height: 18px; }
.secondary-button { border: 1px solid var(--border-strong); background: var(--surface); color: var(--primary); }
.secondary-button:hover { background: var(--surface-subtle); border-color: var(--primary); }
.full-width { width: 100%; }
.activity-card .secondary-button { min-height: 44px; padding: 8px 11px; font-size: 12px; }
.activity-detail-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 11px; border: 0; border-radius: 13px; color: var(--primary); background: var(--accent-soft); font-size: 12px; font-weight: 700; transition: opacity 180ms ease, background 180ms ease; }
.activity-detail-button:hover { background: color-mix(in srgb, var(--accent-soft), var(--accent) 18%); }
.activity-detail-button:active { opacity: .7; }
.activity-detail-button svg { width: 17px; height: 17px; }
.activity-card .activity-detail-button, .history-card .activity-detail-button { margin-bottom: 8px; }
.insight-card, .balance-tip { display: flex; gap: 12px; padding: 16px; border-radius: 18px; background: var(--accent-soft); }
.insight-card__icon { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 12px; background: var(--surface); color: var(--primary); }
.insight-card strong, .balance-tip strong { display: block; margin-bottom: 4px; font-size: 13px; }
.insight-card p, .balance-tip p { color: var(--text-muted); font-size: 12px; line-height: 1.6; }

.progress-strip { display: flex; align-items: center; margin-top: 20px; color: var(--text-muted); font-size: 11px; }
.progress-strip span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.progress-strip i { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-subtle); font-size: 10px; font-style: normal; font-weight: 700; }
.progress-strip i svg { width: 13px; height: 13px; }
.progress-strip b { flex: 1; height: 1px; margin: 0 7px; background: var(--border); }
.progress-strip .is-done { color: var(--primary); font-weight: 680; }
.progress-strip .is-done i { color: var(--on-primary); background: var(--primary); }
.calculator-form { gap: 16px; padding-top: 4px; }
.form-card { padding: 18px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); }
.card-heading, .card-heading__group { display: flex; align-items: center; gap: 11px; }
.card-heading { margin-bottom: 18px; }
.card-heading--action { justify-content: space-between; }
.card-heading__icon { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 14px; color: var(--primary); background: var(--accent-soft); }
.card-heading__icon svg { width: 21px; height: 21px; }
.card-heading div > span, .settings-card__heading div > span { display: block; color: var(--text-muted); font-size: 10px; line-height: 1.25; }
.card-heading h2, .settings-card__heading h2 { font-size: 16px; }
.small-action { min-height: 44px; display: inline-flex; align-items: center; gap: 4px; padding: 0 9px; border: 0; color: var(--primary); background: transparent; font-size: 12px; font-weight: 700; }
.small-action svg { width: 16px; height: 16px; }
.field-grid { display: grid; gap: 12px; }
.field-grid--2 { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 7px; margin-top: 13px; }
.field-grid .field { margin-top: 0; }
.field > span:first-child, .field > label:first-child { color: var(--text-muted); font-size: 12px; font-weight: 620; }
.field > small { color: var(--text-muted); font-size: 10px; line-height: 1.5; }
.field-help { margin-top: 9px; color: var(--text-muted); font-size: 10px; line-height: 1.55; }
.label-with-action { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.label-with-action label { color: var(--text-muted); font-size: 12px; font-weight: 620; }
.inline-help-button { min-height: 44px; padding: 0 3px; border: 0; background: transparent; color: var(--primary); font-size: 11px; font-weight: 700; }
.inline-help-button:hover { opacity: .7; }
.field input, .input-wrap { width: 100%; height: 52px; border: 1px solid var(--border); border-radius: 14px; background: var(--background); transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease; }
.field > input { padding: 0 13px; }
.field input:focus, .input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary), transparent 82%); outline: none; }
.input-wrap { display: flex; align-items: center; padding: 0 12px; }
.input-wrap > svg { flex: 0 0 auto; width: 18px; height: 18px; margin-right: 8px; color: var(--text-muted); }
.input-wrap > b { flex: 0 0 auto; margin-right: 5px; color: var(--text-muted); font-size: 14px; }
.input-wrap input { height: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.input-wrap input:focus { box-shadow: none; }
.ball-list { display: flex; flex-direction: column; gap: 12px; }
.ball-row { padding: 14px; border-radius: 16px; background: var(--background); }
.ball-row__head, .ball-row__sum { display: flex; justify-content: space-between; align-items: center; }
.ball-row__head { margin-bottom: 13px; }
.ball-row__head strong { font-size: 13px; }
.batch-hint { display: inline-flex; align-items: center; gap: 4px; color: var(--income); font-size: 10px; }
.batch-hint svg { width: 13px; height: 13px; }
.field-grid--ball { grid-template-columns: 1.45fr .65fr .8fr; }
.field-grid--ball .field { gap: 5px; }
.field-grid--ball .field > input, .field-grid--ball .input-wrap { height: 48px; background: var(--surface); }
.field-grid--ball .field > input { padding: 0 10px; }
.ball-row__sum { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border-strong); color: var(--text-muted); font-size: 11px; }
.ball-row__sum strong { color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.stepper-list { display: flex; flex-direction: column; }
.stepper-row { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.stepper-row:first-child { padding-top: 0; }
.stepper-row > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.stepper-row > div:first-child strong { font-size: 14px; }
.stepper-row > div:first-child span { color: var(--text-muted); font-size: 10px; }
.stepper { display: grid; grid-template-columns: 44px 44px 44px; align-items: center; gap: 3px; }
.stepper button { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-subtle); color: var(--primary); }
.stepper button:active { opacity: .68; }
.stepper button svg { width: 17px; height: 17px; }
.stepper input { width: 44px; height: 44px; padding: 0; border: 0; background: transparent; text-align: center; font-weight: 750; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field--discount { margin-top: 15px; }
.form-card--disclosure { padding: 0; overflow: hidden; }
.mine-disclosure { width: 100%; min-height: 84px; display: grid; grid-template-columns: minmax(0, 1fr) auto 20px; align-items: center; gap: 10px; padding: 16px 18px; border: 0; background: transparent; text-align: left; transition: background 180ms ease, opacity 180ms ease; }
.mine-disclosure:hover { background: var(--surface-subtle); }
.mine-disclosure:active { opacity: .72; }
.card-heading--disclosure { min-width: 0; margin: 0; }
.card-heading--disclosure > span:last-child { min-width: 0; }
.card-heading--disclosure small, .card-heading--disclosure strong { display: block; }
.card-heading--disclosure small { margin-bottom: 2px; color: var(--text-muted); font-size: 10px; }
.card-heading--disclosure strong { font-size: 16px; line-height: 1.35; }
.mine-disclosure__summary { min-width: 72px; text-align: right; }
.mine-disclosure__summary strong, .mine-disclosure__summary small { display: block; }
.mine-disclosure__summary strong { color: var(--primary); font-size: 15px; font-variant-numeric: tabular-nums; }
.mine-disclosure__summary small { max-width: 112px; margin-top: 3px; overflow: hidden; color: var(--text-muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.mine-disclosure__chevron { width: 18px; height: 18px; color: var(--text-muted); transform-origin: center; transition: transform 180ms ease; }
.mine-disclosure[aria-expanded="true"] .mine-disclosure__chevron { transform: rotate(90deg); }
.mine-settings { padding: 0 18px 18px; border-top: 1px solid var(--border); }
.mine-settings > .segmented-control { margin-top: 16px; }
.segmented-control { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-subtle); }
.segmented-control button { min-height: 44px; padding: 8px; border: 0; border-radius: 11px; background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 650; }
.segmented-control button.is-active { background: var(--surface); color: var(--primary); box-shadow: 0 3px 10px rgba(15,50,41,.09); }
.subsection-label { display: flex; justify-content: space-between; margin: 18px 0 8px; }
.subsection-label span { font-size: 12px; font-weight: 680; }
.subsection-label small { color: var(--text-muted); font-size: 10px; }
.compact-steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compact-steppers > div { display: flex; flex-direction: column; gap: 7px; padding: 12px 4px; border-radius: 14px; background: var(--background); }
.compact-steppers > div > span { color: var(--text-muted); font-size: 11px; }
.stepper--small { width: 100%; grid-template-columns: 44px 1fr 44px; gap: 2px; }
.stepper--small button { background: var(--surface); }
.stepper--small input { width: 100%; }
.live-mine-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 14px; border-radius: 15px; background: var(--accent-soft); }
.live-mine-summary > div { display: flex; flex-direction: column; gap: 3px; }
.live-mine-summary span { font-size: 12px; font-weight: 720; }
.live-mine-summary small { color: var(--text-muted); font-size: 9px; }
.live-mine-summary strong { color: var(--primary); font-size: 21px; font-variant-numeric: tabular-nums; }
.inline-total { display: flex; align-items: center; justify-content: space-between; padding: 5px 3px; }
.inline-total span { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: 13px; }
.inline-total svg { width: 18px; height: 18px; }
.inline-total strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.primary-button--large { min-height: 56px; border-radius: 17px; font-size: 16px; }
.form-note { display: flex; align-items: flex-start; justify-content: center; gap: 5px; color: var(--text-muted); font-size: 10px; line-height: 1.5; text-align: center; }
.form-note svg { flex: 0 0 auto; width: 14px; height: 14px; }

.ledger-summary { overflow: hidden; border-radius: 24px; background: var(--primary); color: var(--on-primary); }
.ledger-summary__main { padding: 22px; }
.ledger-summary__main > span { font-size: 12px; opacity: .75; }
.ledger-summary__main > strong { display: block; margin: 10px 0 6px; font-size: 34px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.ledger-summary__main > strong small { font-size: 18px; }
.ledger-summary__main p { font-size: 11px; opacity: .64; }
.ledger-summary__split { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid color-mix(in srgb, var(--on-primary), transparent 82%); background: color-mix(in srgb, var(--on-primary), transparent 92%); }
.ledger-summary__split div { display: flex; flex-direction: column; gap: 5px; padding: 14px 20px; }
.ledger-summary__split div + div { border-left: 1px solid color-mix(in srgb, var(--on-primary), transparent 82%); }
.ledger-summary__split span { font-size: 10px; opacity: .7; }
.ledger-summary__split strong { color: var(--on-primary); font-size: 13px; }
.filter-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 4px; border-radius: 15px; background: var(--surface-subtle); }
.filter-row button { min-height: 44px; padding: 8px; border: 0; border-radius: 12px; background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 650; }
.filter-row button.is-active { color: var(--primary); background: var(--surface); box-shadow: 0 3px 10px rgba(15,50,41,.08); }
.date-filter-button { width: 100%; min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); text-align: left; transition: background 180ms ease, border-color 180ms ease, opacity 180ms ease; }
.date-filter-button:hover { border-color: var(--border-strong); background: var(--surface-subtle); }
.date-filter-button:active { opacity: .72; }
.date-filter-button > span { display: flex; align-items: center; gap: 11px; }
.date-filter-button > span > svg { width: 20px; height: 20px; color: var(--primary); }
.date-filter-button > span > span { display: flex; flex-direction: column; gap: 3px; }
.date-filter-button small { color: var(--text-muted); font-size: 10px; }
.date-filter-button strong { font-size: 13px; }
.date-filter-button > svg { width: 17px; height: 17px; color: var(--text-muted); }
.ledger-list { overflow: hidden; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.ledger-item { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 11px; min-height: 82px; padding: 14px; }
.ledger-item + .ledger-item { border-top: 1px solid var(--border); }
.ledger-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; }
.ledger-icon svg { width: 21px; height: 21px; }
.ledger-icon--income { color: var(--income); background: var(--income-soft); }
.ledger-icon--expense { color: var(--danger); background: var(--danger-soft); }
.ledger-item > div:nth-child(2) { min-width: 0; }
.ledger-item > div:nth-child(2) strong, .ledger-item > div:nth-child(2) span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-item > div:nth-child(2) strong { font-size: 13px; }
.ledger-item > div:nth-child(2) span { margin-top: 5px; color: var(--text-muted); font-size: 10px; }
.ledger-amount { text-align: right; }
.ledger-amount strong { display: block; font-size: 13px; font-variant-numeric: tabular-nums; }
.status-text { display: block; margin-top: 5px; color: var(--text-muted); font-size: 9px; }
.status-text--success { color: var(--income); }
.income-text { color: var(--income); }
.expense-text { color: var(--danger); }
.balance-tip { background: var(--warning-soft); }
.balance-tip > svg { flex: 0 0 auto; width: 20px; height: 20px; color: var(--warning); }
.empty-state { padding: 28px 18px; border: 1px dashed var(--border-strong); border-radius: 20px; background: var(--surface); text-align: center; }
.empty-state[hidden] { display: none; }
.empty-state svg { width: 28px; height: 28px; margin-bottom: 10px; color: var(--text-muted); }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { font-size: 13px; }
.empty-state span { margin-top: 4px; color: var(--text-muted); font-size: 10px; }

.personal-total-card { padding: 24px; border-radius: 24px; background: var(--primary); color: var(--on-primary); }
.personal-total-card > span { font-size: 12px; opacity: .72; }
.personal-total-card > strong { display: block; margin: 13px 0 24px; font-size: 36px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.personal-total-card > div { display: flex; gap: 8px; }
.personal-total-card > div span { padding: 7px 10px; border-radius: 999px; background: color-mix(in srgb, var(--on-primary), transparent 86%); font-size: 10px; }
.expense-breakdown { display: flex; flex-direction: column; gap: 12px; }
.expense-breakdown article { overflow: hidden; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.expense-record-button { width: 100%; min-height: 44px; padding: 16px; border: 0; background: transparent; color: var(--text); text-align: left; transition: background 180ms ease, opacity 180ms ease; }
.expense-record-button:hover { background: var(--surface-subtle); }
.expense-record-button:active { opacity: .72; }
.expense-breakdown__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.expense-breakdown__top div strong, .expense-breakdown__top div span { display: block; }
.expense-breakdown__top div strong { font-size: 14px; }
.expense-breakdown__top div span { margin-top: 4px; color: var(--text-muted); font-size: 10px; }
.expense-breakdown__top > strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.cost-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.cost-chips span { padding: 6px 8px; border-radius: 999px; color: var(--text-muted); background: var(--surface-subtle); font-size: 9px; }
.record-view-hint { display: flex; align-items: center; justify-content: flex-end; gap: 3px; margin-top: 11px; color: var(--primary); font-size: 10px; font-weight: 680; }
.record-view-hint svg { width: 14px; height: 14px; }
.settings-card { overflow: hidden; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.settings-card__heading { display: flex; align-items: center; gap: 11px; padding: 16px; border-bottom: 1px solid var(--border); }
.settings-card button { width: 100%; min-height: 66px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border: 0; background: transparent; text-align: left; }
.settings-card button + button { border-top: 1px solid var(--border); }
.settings-card button:hover { background: var(--surface-subtle); }
.settings-card button span strong, .settings-card button span small { display: block; }
.settings-card button span strong { font-size: 13px; }
.settings-card button span small { max-width: 270px; margin-top: 4px; color: var(--text-muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-card button > svg { width: 17px; height: 17px; color: var(--text-muted); }

.bottom-nav { position: absolute; z-index: 10; left: 0; right: 0; bottom: 0; min-height: calc(80px + var(--safe-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); align-items: start; padding: 8px 14px calc(8px + var(--safe-bottom)); border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface), transparent 4%); backdrop-filter: blur(18px); transition: transform 180ms ease, opacity 180ms ease; }
.bottom-nav button { min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 4px 6px; border: 0; background: transparent; color: var(--text-muted); }
.bottom-nav button > span { width: 43px; height: 30px; display: grid; place-items: center; border-radius: 999px; transition: background 180ms ease, color 180ms ease, opacity 180ms ease; }
.bottom-nav button svg { width: 21px; height: 21px; }
.bottom-nav button small { font-size: 10px; font-weight: 600; }
.bottom-nav button.is-active { color: var(--primary); font-weight: 750; }
.bottom-nav button.is-active > span { background: var(--accent-soft); }
.bottom-nav button:active > span { opacity: .64; }

.sheet-backdrop { position: fixed; z-index: 50; inset: 0; display: flex; justify-content: center; align-items: flex-end; padding: 20px; background: rgba(4, 14, 11, .54); backdrop-filter: blur(4px); }
.sheet-backdrop[hidden] { display: none; }
.bottom-sheet { width: min(430px, 100%); max-height: min(780px, calc(var(--visual-viewport-height) - 18px)); overflow-y: auto; overscroll-behavior: contain; scroll-padding-bottom: 92px; padding: 9px 20px calc(20px + var(--safe-bottom)); border: 1px solid var(--border); border-radius: 26px 26px 22px 22px; background: var(--background); box-shadow: var(--shadow-float); animation: sheet-in 240ms cubic-bezier(.2,.8,.2,1); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
.sheet-handle { width: 44px; height: 4px; margin: 0 auto 15px; border-radius: 999px; background: var(--border-strong); }
.sheet-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.sheet-header h2 { font-size: 22px; }
.result-main { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0 12px; }
.result-price { padding: 17px; border-radius: 18px; background: var(--primary); color: var(--on-primary); }
.result-price--female { color: #123f36; background: var(--accent); }
.result-price span, .result-price small { display: block; font-size: 10px; }
.result-price span { opacity: .72; }
.result-price strong { display: block; margin: 7px 0 6px; font-size: 24px; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.result-price small { opacity: .68; }
.result-details { overflow: hidden; border: 1px solid var(--border); border-radius: 17px; background: var(--surface); }
.result-details > div { min-height: 44px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; }
.result-details > div + div { border-top: 1px solid var(--border); }
.result-details span { color: var(--text-muted); font-size: 11px; }
.result-details strong { font-size: 12px; font-variant-numeric: tabular-nums; }
.result-details .my-result { min-height: 58px; background: var(--accent-soft); }
.my-result > span { display: flex; flex-direction: column; gap: 3px; color: var(--text); font-weight: 680; }
.my-result > span small { color: var(--text-muted); font-size: 9px; font-weight: 500; }
.my-result strong { color: var(--primary); font-size: 18px; }
.warning-text { color: var(--warning); }
.message-preview { margin-top: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 17px; background: var(--surface); }
.message-preview > div { display: flex; justify-content: space-between; align-items: center; }
.message-preview > div > strong { font-size: 12px; }
.message-preview textarea, .settings-sheet textarea { width: 100%; resize: vertical; border: 1px solid var(--border); border-radius: 13px; background: var(--background); color: var(--text); line-height: 1.65; }
.message-preview textarea { min-height: 150px; margin-top: 10px; padding: 12px; font-size: 12px; }
.message-preview > small { display: block; margin-top: 7px; color: var(--text-muted); font-size: 9px; }
.sheet-actions { display: grid; grid-template-columns: .8fr 1.2fr; gap: 10px; margin-top: 14px; }
.ledger-sheet form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.ledger-type { grid-template-columns: 1fr 1fr; margin-bottom: 2px; }
.input-wrap--large { height: 62px; }
.input-wrap--large input { font-size: 25px; font-weight: 720; }
.history-card { margin-top: 18px; padding: 16px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.history-card__top { display: flex; justify-content: space-between; gap: 12px; }
.history-card__top > div { min-width: 0; }
.history-card__top strong, .history-card__top span { display: block; }
.history-card__top > div strong { font-size: 14px; }
.history-card__top > div span { margin-top: 5px; color: var(--text-muted); font-size: 10px; }
.history-card__top > strong { font-size: 16px; font-variant-numeric: tabular-nums; }
#history-list + .empty-state { margin-top: 18px; }
.remove-ball { min-width: 44px; min-height: 44px; display: grid; place-items: center; margin: -10px -10px -10px 0; border: 0; border-radius: 12px; background: transparent; color: var(--text-muted); }
.remove-ball:hover { color: var(--danger); background: var(--danger-soft); }
.remove-ball svg { width: 17px; height: 17px; }
.activity-detail-summary { margin: 18px 0 12px; padding: 17px; border-radius: 19px; color: var(--on-primary); background: var(--primary); }
.activity-detail-summary > span { display: block; font-size: 11px; opacity: .72; }
.activity-detail-summary > strong { display: block; margin: 7px 0 13px; font-size: 19px; line-height: 1.4; }
.activity-detail-summary__meta { display: flex; flex-wrap: wrap; gap: 7px; }
.activity-detail-summary__meta span { padding: 6px 9px; border-radius: 999px; background: color-mix(in srgb, var(--on-primary), transparent 86%); font-size: 10px; }
.activity-detail-section { margin-top: 12px; overflow: hidden; border: 1px solid var(--border); border-radius: 17px; background: var(--surface); }
.activity-detail-section h3 { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 12px; }
.activity-detail-list { margin: 0; }
.activity-detail-list > div { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 14px; }
.activity-detail-list > div + div { border-top: 1px solid var(--border); }
.activity-detail-list dt { color: var(--text-muted); font-size: 11px; }
.activity-detail-list dd { margin: 0; font-size: 12px; font-weight: 680; text-align: right; font-variant-numeric: tabular-nums; }
.activity-detail-note { margin: 12px 0; padding: 12px 14px; border-radius: 14px; color: var(--text-muted); background: var(--surface-subtle); font-size: 10px; line-height: 1.55; }
.activity-detail-sheet > .primary-button { margin-top: 14px; }
#recalculate-detail[hidden] { display: none; }
.formula-example { margin: 18px 0 16px; padding: 17px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.formula-example p, .formula-example li { color: var(--text-muted); font-size: 12px; line-height: 1.65; }
.formula-example p strong, .formula-example li strong { color: var(--text); }
.formula-example ol { margin: 13px 0; padding-left: 20px; }
.formula-example li + li { margin-top: 6px; }
.formula-example code { color: var(--primary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; }
.formula-check { display: flex; gap: 8px; padding: 12px; border-radius: 13px; background: var(--accent-soft); }
.formula-check svg { flex: 0 0 auto; width: 18px; height: 18px; color: var(--primary); }
.formula-check span { color: var(--text); font-size: 10px; line-height: 1.55; }
.date-quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.date-choice { min-height: 78px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 5px; padding: 13px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); text-align: left; }
.date-choice:hover { border-color: var(--border-strong); background: var(--surface-subtle); }
.date-choice.is-active { border-color: var(--primary); background: var(--accent-soft); }
.date-choice strong { font-size: 14px; }
.date-choice span { color: var(--text-muted); font-size: 10px; }
.date-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 2px; color: var(--text-muted); font-size: 10px; }
.date-divider::before, .date-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.date-granularity { margin-top: 12px; }
.date-exact-panel { min-height: 72px; }
[data-date-field][hidden] { display: none; }
.settings-sheet form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.settings-sheet textarea { min-height: 94px; padding: 11px 12px; font-size: 12px; }
.account-identity { padding: 13px 14px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-subtle); }
.account-identity span, .account-identity strong, .account-identity small { display: block; }
.account-identity span, .account-identity small { color: var(--text-muted); font-size: 10px; }
.account-identity strong { margin: 4px 0; font-size: 15px; }
.admin-sheet { display: flex; flex-direction: column; gap: 16px; }
.admin-user-form { display: flex; flex-direction: column; gap: 12px; }
.form-intro { padding: 14px; border-radius: 16px; color: var(--on-primary); background: var(--primary); }
.form-intro strong { font-size: 14px; }
.form-intro p { margin: 5px 0 0; font-size: 10px; line-height: 1.55; opacity: .76; }
.admin-user-section { padding-top: 4px; border-top: 1px solid var(--border); }
#admin-user-list { overflow: hidden; border: 1px solid var(--border); border-radius: 17px; background: var(--surface); }
.admin-user-card { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; }
.admin-user-card + .admin-user-card { border-top: 1px solid var(--border); }
.admin-user-card > div:last-child { text-align: right; }
.admin-user-card strong, .admin-user-card span { display: block; }
.admin-user-card strong { font-size: 12px; }
.admin-user-card span { margin-top: 4px; color: var(--text-muted); font-size: 9px; }
.logout-button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px; border: 0; background: transparent; color: var(--danger); font-size: 12px; font-weight: 680; }
.logout-button svg { width: 18px; height: 18px; }
.logout-button:hover { background: var(--danger-soft); }

.toast { position: fixed; z-index: 80; left: 50%; bottom: max(100px, calc(28px + var(--safe-bottom))); display: flex; align-items: center; gap: 8px; min-height: 48px; max-width: calc(100vw - 40px); padding: 11px 16px; border-radius: 14px; background: #10241e; color: white; box-shadow: 0 12px 32px rgba(0,0,0,.24); opacity: 0; pointer-events: none; transform: translate(-50%, 14px); transition: opacity 180ms ease, transform 180ms ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: #6f2424; }
.toast.is-error svg { color: #ffd2cc; }
.toast svg { width: 17px; height: 17px; color: var(--accent); }
.toast span { font-size: 12px; font-weight: 650; white-space: nowrap; }

@media (max-width: 820px) {
  html, body { background: var(--background); }
  .auth-gate { padding: 0; background: var(--background); }
  .login-card { min-height: 100dvh; width: 100%; display: flex; flex-direction: column; justify-content: center; border-radius: 0; box-shadow: none; }
  .desktop-shell { display: block; min-height: 100vh; padding: 0; background: var(--background); }
  .desktop-intro { display: none; }
  .app-shell { width: 100%; height: 100dvh; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
  html[data-keyboard-open="true"] .app-shell { height: var(--visual-viewport-height); }
  html[data-keyboard-open="true"] .bottom-nav { opacity: 0; pointer-events: none; transform: translateY(100%); }
  html[data-keyboard-open="true"] .screen { padding-bottom: 28px; scroll-padding-bottom: 96px; }
  html[data-keyboard-open="true"] .auth-gate { min-height: var(--visual-viewport-height); }
  .sheet-backdrop { padding: 0; }
  .bottom-sheet { width: 100%; border-width: 1px 0 0; border-radius: 26px 26px 0 0; }
  input, textarea, select, .message-preview textarea, .settings-sheet textarea { font-size: 16px; }
}

@media (max-width: 374px) {
  .app-header, .content-stack { padding-left: 16px; padding-right: 16px; }
  .activity-card { gap: 10px; padding: 13px; }
  .activity-card__date { display: none; }
  .field-grid--ball { grid-template-columns: 1fr 1fr; }
  .field--brand { grid-column: 1 / -1; }
  .compact-steppers { grid-template-columns: 1fr; }
}

@media (min-width: 821px) and (max-height: 760px) {
  .app-shell { height: calc(100vh - 28px); min-height: 650px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
