/* iOS refinement: scalable type, consistent touch areas and shared safe-area geometry. */
:root {
  --card: #262628;
  --muted: #a0a0a9;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --page-gutter: 20px;
  --keyboard-inset: 0px;
  --visible-height: 100dvh;
}
:root[data-theme=light] { --muted: #70707a; }
body { font-size: 1rem; line-height: 1.4; -webkit-text-size-adjust: 100%; }
body.sheet-open { overflow: hidden; }
body[data-font] h1 { font-size: 2rem; font-weight: 750; line-height: 1.2; letter-spacing: -.04em; }
body[data-font] h2 { font-size: 1.125rem; font-weight: 650; letter-spacing: -.025em; }
body[data-font] h3 { font-size: 1rem; }
body[data-font] .sub { font-size: .8125rem; overflow-wrap: anywhere; }
body[data-font] .setting-row .label { font-size: .9375rem; min-width: 0; }
body[data-font] .list-item strong, body[data-font] .project-card strong { font-size: .9375rem; font-weight: 600; }
button { -webkit-user-select: none; user-select: none; transition: transform 160ms ease, opacity 160ms ease, background 180ms ease; }
button:active { transform: scale(.98); opacity: .72; }
input, select, textarea { font-size: max(16px, 1rem); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
main { padding-top: calc(var(--safe-top) + 22px); padding-bottom: calc(var(--safe-bottom) + 112px); padding-left: max(var(--page-gutter),var(--safe-left)); padding-right: max(var(--page-gutter),var(--safe-right)); }
.header { gap: 12px; margin-bottom: 22px; }
.eyebrow { font-size: .75rem; letter-spacing: .035em; font-weight: 400; margin-bottom: 6px; }
.card { border-radius: 19px; padding: 19px; }
.row { min-width: 0; }
.row > div { min-width: 0; }
.segment button { min-width: 0; min-height: 44px; padding: 7px 8px; font-size: .875rem; }
.segment .icon { width: 18px; height: 18px; margin-right: 4px; }
.month-nav { margin: 13px 0 14px; }
.month-nav strong { font-weight: 650; font-variant-numeric: tabular-nums; }
.month-nav button { width: 44px; border-radius: 12px; }
.month-nav button:active { background: var(--tint); }
.header .today { font-size: .8125rem; font-weight: 600; min-width: 52px; min-height: 44px; border-radius: 13px; color: var(--accent); }
.summary { padding: 20px; border-color: color-mix(in srgb,var(--accent) 18%,transparent); }
.summary .label { font-size: .8125rem; margin-bottom: 9px; }
.summary .value { font-size: clamp(1.4rem,6.2vw,1.875rem); line-height: 1.2; letter-spacing: -.04em; overflow-wrap: anywhere; }
.summary .value small { font-size: .8125rem; }
.summary .divider { flex-shrink: 0; }
.summary .row > div:first-child { flex: .85; }
.summary .row > div:last-child { flex: 1.25; }
.summary.row { display: grid; grid-template-columns: 1.45fr 1fr .65fr; gap: 12px; }
.summary.row h2 { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.calendar { margin: 23px 0 18px; }
.weekdays { font-size: .8125rem; margin-bottom: 10px; }
body[data-font] .day { height: auto; min-height: 56px; font-size: 1.125rem; gap: 4px; border: 1px solid transparent; font-variant-numeric: tabular-nums; }
.day small { font-size: 9px; line-height: 1.2; white-space: nowrap; }
body[data-font] .day.today { border-color: color-mix(in srgb,var(--accent) 70%,transparent); }
.day.selected small { color: var(--accent); }
.day:active { background: var(--tint); }
.dot { bottom: 4px; }
.actions { grid-template-columns: 1fr 1.15fr; gap: 11px; margin: 20px 0 23px; }
.action { gap: 10px; border-radius: 16px; padding: 14px; min-height: 70px; }
.action > span:last-child { min-width: 0; }
.action.primary > span:first-child { border-radius: 12px; background: #ffffff20; width: 38px; height: 38px; display: grid; place-items: center; flex-shrink: 0; }
.action .badge { width: 36px; height: 38px; border-radius: 12px; }
.action strong { font-size: .9375rem; font-weight: 600; }
.action small { font-size: .6875rem; opacity: .7; }
.section-title { gap: 10px; margin: 24px 0 12px; }
.section-title > span { font-size: .75rem; flex-shrink: 0; }
.date-weekday { font-size: .8125rem; font-weight: 400; color: var(--muted); margin-left: 4px; }
.empty { padding: 28px 10px; }
.empty .badge { width: 60px; height: 60px; border-radius: 20px; }
.empty .badge .icon { width: 27px; height: 27px; }
.empty h3 { margin-bottom: 8px; }
.empty p { font-size: .8125rem; line-height: 1.75; }
.stats-empty { min-height: 340px; display: flex; flex-direction: column; justify-content: center; margin-top: 26px; }
.stats-empty .empty { padding: 26px 10px; }
.stats-empty .primary-button { max-width: 240px; margin: 8px auto 10px; }
.list-item { gap: 12px; padding: 17px 0; }
.list-item .amount { font-size: 1rem; text-align: right; max-width: 43%; white-space: normal; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
body[data-font] .list-item .sub { display: block; font-size: .75rem; }
.list-item .chevron .icon { width: 15px; height: 18px; }
#tabs { -webkit-backdrop-filter: blur(24px); padding: 9px max(12px,var(--safe-right)) calc(var(--safe-bottom) + 9px) max(12px,var(--safe-left)); }
#tabs button { gap: 4px; font-size: .6875rem; font-weight: 500; min-height: 49px; }
#tabs .tab-icon { border-radius: 17px; height: 31px; }
.primary-button,.secondary-button,.danger-button { min-height: 50px; border-radius: 15px; font-size: .9375rem; }
dialog { padding: 10px max(20px,var(--safe-right)) calc(var(--safe-bottom) + 20px) max(20px,var(--safe-left)); inset: auto 0 var(--keyboard-inset); max-height: min(92dvh,calc(var(--visible-height) - var(--safe-top) - 12px)); scroll-padding: 80px 0 115px; animation: slide 240ms cubic-bezier(.2,.75,.25,1); }
dialog::backdrop { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet-handle { margin-bottom: 10px; opacity: .45; }
.sheet-heading { gap: 10px; margin: 0 -4px 16px; padding: 5px 4px 9px; position: sticky; top: -10px; z-index: 2; background: var(--card); }
.close { background: none; width: 44px; height: 44px; font-size: 1.5rem; flex-shrink: 0; }
.close:hover,.close:active { background: var(--raised); }
.fields { gap: 16px; }
.fields label { font-size: .8125rem; font-weight: 500; }
.two { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
form .form-actions { position: sticky; bottom: calc(-1 * var(--safe-bottom) - 20px); z-index: 1; background: var(--card); padding: 12px 0 calc(var(--safe-bottom) + 12px); margin-bottom: calc(-1 * var(--safe-bottom) - 12px); border-top: 1px solid var(--line); }
.helper { font-size: .75rem; }
.error { font-size: .8125rem; margin-top: 16px; position: relative; z-index: 2; }
.error:empty { display: none; }
.kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
.kpis strong { font-size: 1.5rem; letter-spacing: -.04em; overflow-wrap: anywhere; }
.kpis .main-kpi strong { font-size: 2.125rem; }
.chart { height: 165px; margin-top: 16px; }
.chart text { font-size: 10px; font-variant-numeric: tabular-nums; }
.legend { font-size: .75rem; margin-top: 11px; }
.donut-layout { gap: 20px; }
.donut:before { width: 85px; height: 85px; }
.legend-list { min-width: 0; }
.legend-list .legend { align-items: flex-start; }
.legend-list .legend > span { min-width: 0; overflow-wrap: anywhere; }
.legend-list strong { font-variant-numeric: tabular-nums; flex-shrink: 0; }
.bar-item { margin-top: 18px; }
.bar-item .row > span { min-width: 0; overflow-wrap: anywhere; }
.bar-item strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar { height: 7px; margin-top: 9px; }
.project-card { gap: 11px; padding: 16px; }
.project-card .project-info { min-height: 48px; padding: 0; }
.project-card .rate { font-size: .8125rem; max-width: 37%; white-space: normal; overflow-wrap: anywhere; text-align: right; font-variant-numeric: tabular-nums; }
.drag-handle { min-width: 28px; padding: 0; }
.setting-row { padding: 16px 0; min-height: 66px; }
.setting-row .value { font-size: .75rem; max-width: 42%; }
.setting-row .muted .icon { width: 16px; height: 20px; }
.setting-row select { min-height: 44px; font-size: .875rem; }
.profile h2 { font-size: 1.5rem !important; }
.footer { font-size: .6875rem; padding: 16px 0; }
.footer .icon { width: 15px; height: 15px; margin-right: 4px; }
#toast { bottom: calc(var(--safe-bottom) + 90px); font-size: .8125rem; }
@media(max-width:360px) {
  :root { --page-gutter: 14px; }
  .summary { padding: 16px; }
  .summary .row { gap: 9px; }
  body[data-font] .day { min-height: 51px; }
  .segment button { padding: 7px 4px; font-size: .8125rem; }
  .project-card { gap: 8px; padding: 13px; }
  .project-card .badge,.list-item .badge { width: 36px; height: 39px; }
  .project-card .rate { font-size: .75rem; }
  .action { padding: 12px; gap: 8px; }
  .action small { font-size: .625rem; }
  .list-item { gap: 9px; }
  .donut-layout { gap: 13px; }
  .donut { width: 98px; height: 98px; }
  .donut:before { width: 72px; height: 72px; }
}
@media(prefers-reduced-motion:reduce) { * { animation: none !important; transition: none !important; } }
