/* ProfitLog — component styles. Tokens live in theme.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.modal-open { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
a { color: inherit; }
ul { margin: 0; padding-left: 20px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

.app { max-width: 640px; margin: 0 auto; min-height: 100dvh; position: relative; }
.boot { padding: 40vh 24px 0; text-align: center; color: var(--text-2); }
.main { padding: 0 16px calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 112px); }
.view { display: flex; flex-direction: column; gap: 14px; }

/* ---------- utilities ---------- */
.muted { color: var(--text-2); }
.small { font-size: 13.5px; }
.center { text-align: center; }
.danger-text { color: var(--neg); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.icon { flex: none; }

/* ---------- headers ---------- */
.screen-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: calc(env(safe-area-inset-top, 0px) + 20px) 2px 2px; }
.title { font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.title-sm { font-size: 24px; }
.subtitle { color: var(--text-2); margin-top: 4px; font-size: 15px; }
.detail-head { align-items: center; justify-content: flex-start; padding-top: calc(env(safe-area-inset-top, 0px) + 10px); }
.back { margin-left: -10px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.section-title h2 { font-size: 18px; font-weight: 750; letter-spacing: -0.01em; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-card); border: 1px solid var(--line); }
.card-title { font-size: 17px; font-weight: 750; margin-bottom: 4px; }
.list.card { padding: 2px 0; overflow: hidden; }
.list { display: flex; flex-direction: column; }

/* ---------- money ---------- */
.money { font-variant-numeric: tabular-nums; font-weight: 750; white-space: nowrap; letter-spacing: -0.01em; }
.money .dec { font-size: 0.74em; font-weight: 650; opacity: 0.62; }
.money .unit { font-size: 0.5em; font-weight: 700; opacity: 0.7; letter-spacing: 0.02em; }
.money.pos { color: var(--pos); }
.money.neg { color: var(--neg); }
.money.zero { color: var(--text-2); }
.money-sm { font-size: 17px; }
.money-md { font-size: 23px; }
.money-lg { font-size: 34px; letter-spacing: -0.02em; }
.money-xl { font-size: clamp(46px, 14vw, 64px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.02; }

/* ---------- buttons ---------- */
.btn {
  min-height: 48px; padding: 0 20px; border-radius: 14px; font-weight: 680; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  transition: transform 0.12s ease, background-color 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; }
.btn-block { width: 100%; }
.btn-sm { padding: 0 14px; font-size: 14.5px; }
.btn-xl { min-height: 56px; font-size: 17px; border-radius: 16px; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn-ghost { color: var(--brand); }
.btn-ghost:hover:not(:disabled) { background: var(--brand-soft); }
.btn-danger { background: var(--neg); color: #fff; }
.btn-danger-ghost { background: var(--neg-soft); color: var(--neg); }
.btn-hero { width: 100%; min-height: 64px; margin-top: 18px; border-radius: 20px; background: #fff; color: #08684f; font-size: 19px; font-weight: 800; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.45); }
.btn-hero:hover { background: #f3fbf8; }
.btn-stack { display: grid; gap: 10px; margin: 12px 0; }
.icon-btn { width: 48px; height: 48px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; color: var(--text-2); transition: background-color 0.15s; }
.icon-btn:hover { background: var(--surface-2); }

/* ---------- tab bar + FAB ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 640px); z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface); border-top: 1px solid var(--line);
}
@supports (backdrop-filter: blur(10px)) {
  .tabbar { background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); }
}
.tab { position: relative; min-height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; font-size: 11.5px; font-weight: 650; color: var(--text-3); transition: color 0.15s; }
.tab .icon { transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.4); }
.tab[aria-current="page"] { color: var(--brand); }
.tab[aria-current="page"] .icon { transform: translateY(-2px) scale(1.08); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--brand); }

.fab {
  position: fixed; z-index: 29; width: 62px; height: 62px; border-radius: 22px;
  right: max(16px, calc(50% - 304px));
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 16px);
  display: grid; place-items: center; color: var(--on-brand);
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  box-shadow: var(--shadow-pop); transition: transform 0.15s ease, opacity 0.2s;
}
.fab:active { transform: scale(0.92); }
.modal-open .fab { opacity: 0; pointer-events: none; }

.update-bar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top, 0px) + 8px) 16px 8px; background: var(--brand); color: var(--on-brand); font-weight: 650; }
.update-bar span { flex: 1; }
.update-bar .btn { background: var(--on-brand); color: var(--brand); }

/* ---------- hero (home) ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 22px 20px 20px; color: #fff;
  background: linear-gradient(150deg, var(--hero-from), var(--hero-to));
  box-shadow: var(--shadow-pop);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: var(--hero-glow); pointer-events: none; }
.hero::before { width: 220px; height: 220px; right: -70px; top: -90px; }
.hero::after { width: 140px; height: 140px; right: 40px; bottom: -80px; opacity: 0.6; }
.hero > * { position: relative; }
.hero-top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; opacity: 0.92; }
.hero-label { font-size: 15px; }
.hero-unit { font-size: 13px; letter-spacing: 0.08em; background: rgba(255, 255, 255, 0.18); padding: 2px 10px; border-radius: 999px; }
.hero .money { color: #fff; display: block; margin-top: 8px; }
.hero-sub { margin-top: 6px; opacity: 0.88; font-weight: 600; }

.mini { text-align: left; display: flex; flex-direction: column; gap: 4px; width: 100%; transition: transform 0.12s; }
.mini:active { transform: scale(0.98); }
.mini-label { font-size: 13.5px; font-weight: 650; color: var(--text-2); }
.mini-sub { font-size: 13px; color: var(--text-3); }

/* ---------- rows ---------- */
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 16px; text-align: left; border-top: 1px solid var(--line); transition: background-color 0.12s; }
.row:first-child { border-top: 0; }
.row:active { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 650; }
.row-sub { font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-amount { font-size: 18px; }
.badge {
  width: var(--s, 40px); height: var(--s, 40px); flex: none; border-radius: 34%; display: grid; place-items: center;
  background: var(--c); color: #fff; font-weight: 800; font-size: calc(var(--s, 40px) * 0.36); letter-spacing: -0.02em;
}

.day-group { display: flex; flex-direction: column; gap: 4px; }
.day-head { display: flex; align-items: center; gap: 8px; padding: 0 0 0 4px; min-height: 48px; }
.day-head-main { flex: 1; display: flex; flex-direction: column; }
.day-head h3 { font-size: 15px; font-weight: 750; }
.day-head .muted { font-size: 12.5px; }
.add-day { width: 48px; height: 48px; margin-right: -8px; }
.day-empty .day-head { min-height: 52px; background: var(--surface); border-radius: var(--r-md); padding: 0 8px 0 14px; border: 1px dashed var(--line-strong); }
.day-empty h3 { font-weight: 650; color: var(--text-2); }

.period-card { text-align: left; width: 100%; display: flex; flex-direction: column; gap: 6px; transition: transform 0.12s; }
.period-card:active { transform: scale(0.985); }
.period-top { display: flex; justify-content: space-between; align-items: center; color: var(--text-3); }
.period-top h3 { display: inline; font-size: 17px; font-weight: 750; color: var(--text); }
.tag-now { font-size: 11px; font-weight: 750; background: var(--brand-soft); color: var(--brand); padding: 3px 9px; border-radius: 999px; margin-left: 8px; vertical-align: 2px; }
.period-lines { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--text-2); font-size: 13.5px; }

.week-acc { background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--shadow-card); overflow: hidden; }
.week-acc summary { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 64px; cursor: pointer; list-style: none; }
.week-acc summary::-webkit-details-marker { display: none; }
.acc-main { flex: 1; display: flex; flex-direction: column; }
.acc-main h3 { font-size: 16px; font-weight: 750; }
.acc-main .muted { font-size: 13px; }
.chev { transition: transform 0.2s; color: var(--text-3); }
.week-acc[open] > summary .chev { transform: rotate(180deg); }
.acc-body { padding: 0 12px 14px; }

/* ---------- controls ---------- */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 18px; background: var(--surface-2); }
.seg-btn { flex: 1; min-height: 48px; border-radius: 14px; font-weight: 680; font-size: 15px; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background-color 0.18s, color 0.18s, box-shadow 0.18s; }
.seg-btn[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-sticky { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 6px); z-index: 5; box-shadow: 0 0 0 6px var(--bg); }

.chip { min-height: 48px; padding: 0 16px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-weight: 650; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid transparent; white-space: nowrap; transition: background-color 0.15s, border-color 0.15s, color 0.15s; flex: none; }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.chip-sm { min-height: 34px; padding: 0 14px; font-size: 14px; position: relative; }
.chip-sm::after { content: ""; position: absolute; inset: -8px -4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .chip { padding-left: 8px; }
.period-scroll { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
.period-scroll::-webkit-scrollbar { display: none; }
.period-scroll .chip { padding-left: 16px; scroll-snap-align: start; }

.field { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.field-label { font-size: 13px; font-weight: 700; color: var(--text-2); letter-spacing: 0.01em; }
.field-row { display: flex; justify-content: space-between; align-items: center; }
.field-hint { font-size: 13px; color: var(--text-3); }
.field-err { color: var(--neg); font-size: 14px; font-weight: 600; min-height: 20px; margin: 6px 4px 0; }
.input {
  width: 100%; min-height: 52px; padding: 0 14px; border-radius: 14px; font: inherit; font-size: 16px;
  color: var(--text); background: var(--surface); border: 1.5px solid var(--line-strong);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.select { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2386928c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 20px; }

/* ---------- sale sheet ---------- */
.modal-host { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.modal { position: fixed; inset: 0; pointer-events: auto; display: flex; justify-content: center; }
.modal-sheet { align-items: flex-end; }
.modal-dialog { align-items: center; padding: 20px; }
.backdrop { position: absolute; inset: 0; background: var(--backdrop); opacity: 0; transition: opacity 0.22s ease; }
.modal.in .backdrop { opacity: 1; }
.sheet {
  position: relative; width: min(100%, 640px); display: flex; flex-direction: column;
  max-height: min(94dvh, calc(var(--vvh, 100dvh) - 6px)); margin-bottom: var(--kb, 0px);
  background: var(--surface); border-radius: 28px 28px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
  transform: translateY(105%); transition: transform 0.3s cubic-bezier(0.2, 0.85, 0.25, 1);
}
.modal.in .sheet { transform: none; }
.sheet-inner { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.sheet-head { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 18px 8px 4px 22px; }
.sheet-grab { position: absolute; top: 8px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: var(--line-strong); }
.sheet-title { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.sheet-top { padding: 0 20px; }
.sheet-body { overflow-y: auto; padding: 4px 20px 12px; flex: 1; min-height: 0; overscroll-behavior: contain; }
.sheet-foot { display: grid; gap: 10px; padding: 12px 20px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
@media (max-height: 700px) {
  .sheet-foot { grid-template-columns: 1fr 1fr; gap: 8px; }
  .sheet-foot .btn-xl { font-size: 15px; padding: 0 10px; min-height: 52px; }
  .sheet-foot .btn-primary:only-child { grid-column: 1 / -1; }
}

.amount-box { display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 8px; border-radius: 22px; background: var(--surface-2); border: 2px solid transparent; transition: border-color 0.15s, background-color 0.15s; }
.amount-box:focus-within { border-color: var(--brand); background: var(--surface); }
.amount-box.is-loss:focus-within { border-color: var(--neg); }
.amount-box.has-error { border-color: var(--neg); }
.amount-box.shake { animation: shake 0.35s; }
.amount-input { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; outline: none; text-align: right; font: inherit; font-size: 44px; font-weight: 800; letter-spacing: -0.02em; color: var(--pos); font-variant-numeric: tabular-nums; padding: 0; }
.amount-input::placeholder { color: var(--text-3); opacity: 0.55; }
.is-loss .amount-input { color: var(--neg); }
.amount-unit { font-weight: 800; color: var(--text-3); font-size: 15px; letter-spacing: 0.06em; }
.sign-btn { width: 52px; height: 52px; flex: none; border-radius: 17px; background: var(--surface); color: var(--text-2); display: grid; place-items: center; box-shadow: var(--shadow-sm); transition: background-color 0.15s, color 0.15s; }
.sign-btn[aria-pressed="true"] { background: var(--neg); color: #fff; }
.dt-input { min-height: 52px; }
.disclosure { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; margin-top: 8px; padding: 0 4px; font-weight: 700; color: var(--text-2); }
.disclosure span { flex: 1; text-align: left; }
.disclosure[aria-expanded="true"] .chev { transform: rotate(180deg); }
.extras { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 8px; animation: rise 0.25s ease both; }

/* ---------- dialog ---------- */
.dialog { position: relative; width: min(100%, 420px); background: var(--surface); border-radius: 26px; padding: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4); transform: scale(0.94); opacity: 0; transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2), opacity 0.18s; }
.modal.in .dialog { transform: none; opacity: 1; }
.dialog-body { display: flex; flex-direction: column; gap: 12px; }
.dialog-title { font-size: 20px; font-weight: 800; }
.dialog-text { color: var(--text-2); }
.dialog-note { color: var(--pos); font-weight: 650; font-size: 14px; }
.dialog-actions { display: grid; gap: 8px; margin-top: 6px; }

/* ---------- toast ---------- */
.toast-host { position: fixed; z-index: 70; left: 0; right: 0; display: flex; justify-content: center; pointer-events: none; padding: 0 12px; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 90px); }
.modal-open .toast-host { bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 12px); }
.toast { position: relative; overflow: hidden; pointer-events: auto; display: flex; align-items: center; gap: 6px; max-width: 560px; width: fit-content; min-height: 52px; padding: 4px 6px 4px 18px; border-radius: 18px; background: var(--toast-bg); color: var(--toast-text); font-weight: 600; box-shadow: 0 14px 34px -8px rgba(0, 0, 0, 0.5); transform: translateY(14px) scale(0.97); opacity: 0; transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2), opacity 0.2s; }
.toast.in { transform: none; opacity: 1; }
.toast-error { background: var(--neg); color: #fff; }
.toast-msg { flex: 1; padding: 8px 0; }
.toast-action { min-height: 48px; padding: 0 16px; border-radius: 14px; font-weight: 800; color: var(--toast-action); }
.toast-error .toast-action { color: #fff; }
.toast-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; opacity: 0.3; transform-origin: left; animation: shrink linear forwards; }

/* ---------- banners, pills, empty ---------- */
.banner { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); align-items: flex-start; }
.banner > .icon { margin-top: 2px; }
.banner-body { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 14.5px; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.banner-info { background: var(--info-soft); color: var(--info); }
.banner-info .banner-body p, .banner-warn .banner-body p { color: var(--text-2); }
.banner-warn { background: var(--warn-soft); color: var(--warn); }
.banner-info .btn-ghost { color: var(--info); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 750; white-space: nowrap; }
.pill-up { background: var(--pos-soft); color: var(--pos); }
.pill-down { background: var(--neg-soft); color: var(--neg); }
.pill-flat { background: var(--surface-2); color: var(--text-2); }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 28px 20px; background: var(--surface); border-radius: var(--r-lg); border: 1px dashed var(--line-strong); }
.empty h3 { font-size: 18px; font-weight: 800; }
.empty p { color: var(--text-2); max-width: 30ch; }
.empty .btn { margin-top: 6px; }
.empty-art .a1 { fill: var(--brand-soft); }
.empty-art .a2 { fill: var(--brand); }
.empty-art .a3 { fill: #f2b84b; }
.empty-art .a4 { stroke: #7a5200; fill: none; stroke-width: 2.4; stroke-linecap: round; }

/* ---------- dashboard ---------- */
.summary-hero { display: flex; flex-direction: column; gap: 4px; }
.stat-label { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--text-2); letter-spacing: 0.01em; }
.stat-value { font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12.5px; color: var(--text-3); }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.best-worst { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.day-tile { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 12px; }
.summary .money-md { font-size: 19px; }
.summary .stat-value { font-size: 19px; }
.compare-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 8px; }
.compare-grid > div { display: flex; flex-direction: column; min-width: 0; }
.compare-grid .money-md { font-size: 17px; }
.charts { display: flex; flex-direction: column; gap: 12px; }
.chart-scroll { overflow-x: auto; margin: 0 -8px; padding: 0 8px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.chart { display: block; overflow: visible; }
.chart-zero { stroke: var(--line-strong); stroke-width: 1.5; }
.chart-grid { stroke: var(--line); stroke-dasharray: 3 5; }
.chart-label { fill: var(--text-2); font-size: 11.5px; font-weight: 700; }
.chart-sublabel { fill: var(--text-3); font-size: 9.5px; font-weight: 600; }
.bar-hit { fill: transparent; }
.bar-g { cursor: pointer; outline: none; }
.bar-g:focus-visible .bar { stroke: var(--focus); stroke-width: 2; }
.bar { transform-box: fill-box; transform-origin: center bottom; animation: grow 0.55s cubic-bezier(0.2, 0.85, 0.25, 1) both; transition: opacity 0.15s; }
.bar.pos { fill: var(--brand); }
.bar.neg { fill: var(--neg); transform-origin: center top; }
.bar.zero { fill: var(--line-strong); }
.chart.has-sel .bar-g:not(.sel) .bar { opacity: 0.4; }
.chart-detail { border-top: 1px solid var(--line); padding-top: 12px; min-height: 40px; }
.bar-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.chart-detail .list { margin: 4px -16px 0; }
.custom-range { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px 16px 16px; }
.donut-row { display: flex; justify-content: center; padding: 6px 0 14px; }
.donut-wrap { position: relative; }
.donut { transform: rotate(0deg); }
.donut-track { stroke: var(--surface-2); }
.donut-slice { animation: fade 0.7s ease both; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut-label { display: flex; flex-direction: column; align-items: center; }
.plat-list { display: flex; flex-direction: column; gap: 14px; }
.plat-row { display: flex; gap: 12px; align-items: flex-start; }
.plat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.plat-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.plat-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.plat-bar span { display: block; height: 100%; border-radius: 99px; background: var(--c); transform-origin: left; animation: growx 0.7s cubic-bezier(0.2, 0.85, 0.25, 1) both; }
.plat-bar span.neg { background: repeating-linear-gradient(45deg, var(--neg), var(--neg) 4px, transparent 4px, transparent 7px); }
.projection { display: flex; flex-direction: column; gap: 8px; }
.range { margin: 8px 0 2px; }
.range-track { position: relative; height: 10px; border-radius: 99px; background: linear-gradient(90deg, var(--warn-soft), var(--brand-soft)); }
.range-dot { position: absolute; top: 50%; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); border: 4px solid var(--surface); transform: translate(-50%, -50%); box-shadow: var(--shadow-sm); }
.range-labels { display: flex; justify-content: space-between; margin-top: 10px; }
.range-labels .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.range-labels > div { display: flex; flex-direction: column; }

/* ---------- settings ---------- */
.settings-card { display: flex; flex-direction: column; gap: 8px; }
.srow { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.srow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.explain { font-size: 14px; color: var(--text-2); background: var(--surface-2); border-radius: var(--r-md); padding: 12px 14px; line-height: 1.5; }
.explain strong { color: var(--text); }
.tag-list { display: flex; flex-direction: column; }
.tag-row { display: flex; align-items: center; gap: 12px; min-height: 56px; border-top: 1px solid var(--line); }
.tag-row:first-child { border-top: 0; }
.add-tag { display: flex; gap: 10px; margin-top: 8px; }
.add-tag .input { flex: 1; }
.import-summary .stat-grid { margin-top: 8px; padding-top: 0; border-top: 0; }
.problems { margin-top: 12px; padding: 12px 16px; }
.problems summary { display: flex; align-items: center; gap: 8px; min-height: 48px; font-weight: 700; color: var(--warn); cursor: pointer; }
.problems ul { font-size: 13.5px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; padding-bottom: 6px; }
.radio-group { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.radio-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r-md); border: 1.5px solid var(--line-strong); min-height: 64px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio-card input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.radio-card div { display: flex; flex-direction: column; }
.plan { margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); font-size: 14.5px; }
.import-summary p.small { display: flex; gap: 6px; align-items: center; margin-top: 8px; }

/* ---------- animation ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes growx { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.view-enter > * { animation: rise 0.4s cubic-bezier(0.2, 0.85, 0.25, 1) both; }
.view-enter > *:nth-child(2) { animation-delay: 0.04s; }
.view-enter > *:nth-child(3) { animation-delay: 0.08s; }
.view-enter > *:nth-child(4) { animation-delay: 0.12s; }
.view-enter > *:nth-child(5) { animation-delay: 0.16s; }
.view-enter > *:nth-child(n+6) { animation-delay: 0.2s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

@media (min-width: 700px) {
  .main { padding-left: 24px; padding-right: 24px; }
  .modal-sheet { align-items: center; }
  .sheet { border-radius: 28px; max-height: 88dvh; }
}
