:root {
  color-scheme: light;
  --bg: #f2f4f3;
  --surface: #ffffff;
  --surface-2: #eef1ef;
  --surface-3: #e5e9e7;
  --text: #17201e;
  --muted: #6d7673;
  --muted-2: #909895;
  --line: #dce1de;
  --primary: #1c5a4d;
  --primary-2: #16473d;
  --accent: #d9ef6a;
  --accent-ink: #26300e;
  --danger: #b74343;
  --warning: #ba7b19;
  --positive: #24745f;
  --sidebar: #163f37;
  --sidebar-muted: #a9c2bb;
  --shadow: 0 12px 32px rgba(22, 42, 37, 0.09);
  --radius: 8px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111715;
  --surface: #18201e;
  --surface-2: #202a27;
  --surface-3: #293532;
  --text: #edf3f0;
  --muted: #a7b2ae;
  --muted-2: #74807c;
  --line: #303c39;
  --primary: #94cdbd;
  --primary-2: #b7dfd4;
  --accent: #d9ef6a;
  --accent-ink: #1d2605;
  --danger: #ef8e8e;
  --warning: #e4b55d;
  --positive: #78c7b0;
  --sidebar: #0d2822;
  --sidebar-muted: #91aaa3;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }
html { font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif; letter-spacing: 0; background: var(--bg); }
body { margin: 0; min-width: 320px; color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 24%, transparent); outline-offset: 1px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.app-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }

.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 16px 18px; color: #f8fbfa; background: var(--sidebar); z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; width: 100%; padding: 0 10px 26px; color: inherit; text-align: left; background: transparent; border: 0; cursor: pointer; }
.brand strong { display: block; font-size: 20px; line-height: 1.1; }
.brand small { display: block; margin-top: 4px; color: var(--sidebar-muted); font-size: 9px; font-weight: 700; letter-spacing: 2px; }
.brand-mark { display: flex; align-items: end; gap: 3px; width: 32px; height: 32px; padding: 6px; background: var(--accent); border-radius: 7px; }
.brand-mark span { flex: 1; background: var(--accent-ink); border-radius: 1px; }
.brand-mark span:nth-child(1) { height: 45%; }.brand-mark span:nth-child(2) { height: 85%; }.brand-mark span:nth-child(3) { height: 65%; }
.main-nav { display: grid; gap: 4px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; color: var(--sidebar-muted); background: transparent; border: 0; border-radius: 6px; cursor: pointer; text-align: left; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.10); }
.nav-item.active::before { content: ""; position: absolute; left: -16px; width: 3px; height: 24px; background: var(--accent); }
.nav-item svg { width: 19px; height: 19px; }
.sidebar-foot { display: grid; gap: 12px; margin-top: auto; }
.sync-status { display: grid; grid-template-columns: 8px 1fr 16px; align-items: center; gap: 10px; width: 100%; padding: 12px; color: #fff; text-align: left; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09); border-radius: 7px; cursor: pointer; }
.sync-status:hover { background: rgba(255,255,255,.1); }
.sync-status strong, .profile-chip strong { display: block; font-size: 12px; font-weight: 600; }
.sync-status small, .profile-chip small { display: block; margin-top: 3px; color: var(--sidebar-muted); font-size: 10px; }
.sync-status svg { width: 15px; height: 15px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #7f918c; box-shadow: 0 0 0 3px rgba(127,145,140,.15); }
.status-dot.synced { background: var(--accent); box-shadow: 0 0 0 3px rgba(217,239,106,.16); }
.profile-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; color: var(--accent-ink); font-size: 12px; font-weight: 800; background: var(--accent); border-radius: 50%; }

.main-content { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; height: 72px; padding: 0 32px; background: color-mix(in srgb, var(--bg) 90%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.month-switcher, .top-actions { display: flex; align-items: center; gap: 8px; }
.month-label { min-width: 118px; padding: 8px 10px; font-size: 14px; font-weight: 700; background: transparent; border: 0; cursor: pointer; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.icon-button:hover { color: var(--text); background: var(--surface-2); }
.icon-button svg { width: 17px; height: 17px; }
.lang-button { height: 38px; padding: 0 11px; color: var(--muted); font-size: 12px; font-weight: 700; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.primary-button, .secondary-button, .danger-button, .text-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px; font-size: 13px; font-weight: 700; border-radius: 6px; cursor: pointer; }
.primary-button { color: #fff; background: var(--primary); border: 1px solid var(--primary); }
html[data-theme="dark"] .primary-button { color: #10201c; }
.primary-button:hover { background: var(--primary-2); }
.primary-button svg, .secondary-button svg, .danger-button svg { width: 16px; height: 16px; }
.secondary-button { color: var(--text); background: var(--surface); border: 1px solid var(--line); }
.secondary-button:hover { background: var(--surface-2); }
.danger-button { color: var(--danger); background: transparent; border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line)); }
.text-button { min-height: 32px; padding: 0 8px; color: var(--primary); background: transparent; border: 0; }

.view-container { max-width: 1480px; margin: 0 auto; padding: 30px 32px 64px; }
.view { display: none; animation: viewIn .18s ease; }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 7px; color: var(--primary); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; }
.page-heading h1, .modal-header h2 { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: 0; }
.page-heading p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.heading-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.demo-banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; padding: 13px 16px; background: color-mix(in srgb, var(--accent) 18%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line)); border-radius: var(--radius); }
.demo-banner strong, .demo-banner span { display: block; }
.demo-banner strong { font-size: 12px; }
.demo-banner span { margin-top: 3px; color: var(--muted); font-size: 10px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1px; overflow: hidden; margin-bottom: 20px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); }
.metric { min-width: 0; padding: 20px; background: var(--surface); }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric .badge { flex-shrink: 0; }
.metric-value { display: block; margin-top: 12px; font-size: clamp(22px, 2.4vw, 32px); line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric-foot { margin-top: 10px; color: var(--muted-2); font-size: 11px; }
.metric.negative .metric-value, .negative-number { color: var(--danger); }

.badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; font-size: 10px; font-weight: 700; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.green { color: var(--positive); background: color-mix(in srgb, var(--positive) 12%, transparent); }
.badge.amber { color: var(--warning); background: color-mix(in srgb, var(--warning) 12%, transparent); }
.badge.red { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

.flow-panel { margin-bottom: 20px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-head h2 { margin: 0; font-size: 15px; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.settlement-flow { display: grid; grid-template-columns: 1fr 24px 1fr 24px 1fr 24px 1fr 24px 1fr; align-items: center; }
.flow-step { min-width: 0; padding: 15px; background: var(--surface-2); border-radius: 6px; }
.flow-step small { display: block; color: var(--muted); font-size: 10px; }
.flow-step strong { display: block; overflow: hidden; margin-top: 7px; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.flow-arrow { color: var(--muted-2); text-align: center; }
.flow-arrow svg { width: 14px; }

.content-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(300px,.65fr); gap: 20px; }
.panel { min-width: 0; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.chart { display: flex; align-items: end; gap: 10px; height: 190px; padding: 16px 4px 0; border-bottom: 1px solid var(--line); }
.chart-column { display: flex; flex: 1; flex-direction: column; justify-content: end; align-items: center; gap: 8px; height: 100%; min-width: 0; }
.chart-bar-group { display: flex; align-items: end; justify-content: center; gap: 3px; width: 100%; height: calc(100% - 24px); }
.chart-bar { width: min(15px, 35%); min-height: 3px; background: var(--primary); border-radius: 2px 2px 0 0; transition: height .3s ease; }
.chart-bar.overtime { background: var(--accent); }
.chart-column label { color: var(--muted); font-size: 9px; white-space: nowrap; }
.chart-legend { display: flex; gap: 16px; margin-top: 12px; color: var(--muted); font-size: 10px; }
.legend-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 2px; background: var(--primary); }
.legend-dot.overtime { background: var(--accent); }

.activity-list { display: grid; gap: 0; }
.activity { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 11px; min-height: 58px; border-bottom: 1px solid var(--line); }
.activity:last-child { border-bottom: 0; }
.activity-icon { display: grid; place-items: center; width: 32px; height: 32px; color: var(--primary); background: var(--surface-2); border-radius: 6px; }
.activity-icon svg { width: 15px; height: 15px; }
.activity strong, .activity small { display: block; }
.activity strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.activity small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.activity-value { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.table-panel { overflow: hidden; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.table-tools strong { font-size: 13px; }
.view-switcher, .table-actions { display: flex; align-items: center; gap: 12px; }
.segmented.compact { grid-auto-columns: auto; }
.segmented.compact button { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 0 9px; }
.segmented.compact svg { width: 14px; height: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { height: 42px; padding: 0 14px; color: var(--muted); font-size: 10px; font-weight: 700; text-align: left; background: var(--surface-2); white-space: nowrap; }
td { height: 52px; padding: 0 14px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.numeric, th.numeric { text-align: right; }
td.actions { width: 90px; text-align: right; }
.row-actions { display: inline-flex; gap: 4px; }
.row-actions button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 4px; cursor: pointer; }
.row-actions button:hover { color: var(--text); background: var(--surface-2); }
.row-actions svg { width: 15px; height: 15px; }
.empty-state { display: grid; place-items: center; min-height: 220px; padding: 30px; color: var(--muted); text-align: center; }
.empty-state svg { width: 30px; height: 30px; margin-bottom: 12px; }
.empty-state strong { display: block; color: var(--text); font-size: 14px; }
.empty-state p { max-width: 360px; margin: 7px 0 15px; font-size: 11px; line-height: 1.7; }

.calendar { padding: 18px; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays { margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 700; text-align: center; }
.calendar-grid { gap: 6px; touch-action: none; user-select: none; -webkit-user-select: none; }
.calendar-cell { position: relative; display: flex; min-height: 92px; flex-direction: column; align-items: flex-start; padding: 10px; color: var(--text); text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
button.calendar-cell:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--bg)); }
.calendar-cell.muted { background: transparent; border-color: transparent; cursor: default; }
.calendar-cell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.calendar-cell.has-entry { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.calendar-cell.selected { border-color: var(--primary); background: color-mix(in srgb, var(--accent) 28%, var(--surface)); box-shadow: inset 0 0 0 2px var(--primary); }
.calendar-day { font-size: 12px; font-weight: 700; }
.calendar-hours { margin-top: auto; color: var(--primary); font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.calendar-detail { margin-top: 4px; color: var(--muted); font-size: 9px; }
.calendar-hours.special-rest { color: var(--muted); }.calendar-hours.special-leave { color: var(--warning); }
.calendar-empty { margin-top: auto; color: var(--muted-2); font-size: 16px; font-weight: 300; }
.weekday-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.weekday-picker label { cursor: pointer; }
.weekday-picker input { position: absolute; opacity: 0; pointer-events: none; }
.weekday-picker span { display: grid; place-items: center; width: 35px; height: 35px; color: var(--muted); font-size: 11px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); border-radius: 50%; }
.weekday-picker input:checked + span { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.batch-mode-switch { max-width: 320px; }
.cycle-fields { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 14px; background: var(--surface-2); border-radius: 6px; }
.batch-mode-section[hidden] { display: none; }
.rate-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; grid-column: 1 / -1; min-height: 34px; padding: 6px 10px; color: var(--muted); font-size: 10px; background: var(--surface-2); border-radius: 5px; }
.rate-status.loading { color: var(--primary); }
.rate-status .text-button { min-height: 26px; padding: 0 5px; }
.rate-error { color: var(--danger); }

.split-grid { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 20px; }
.summary-stack { display: grid; align-content: start; gap: 12px; }
.summary-card { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.summary-card h3 { margin: 0 0 16px; font-size: 13px; }
.summary-line { display: flex; justify-content: space-between; gap: 12px; margin: 11px 0; color: var(--muted); font-size: 11px; }
.summary-line strong { color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; }
.summary-line.total { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
.summary-line.total strong { font-size: 17px; }
.progress { overflow: hidden; height: 7px; margin: 14px 0 4px; background: var(--surface-3); border-radius: 4px; }
.progress span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }

.report-hero { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 20px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); }
.report-stat { padding: 24px; background: var(--surface); }
.report-stat small, .report-stat strong { display: block; }
.report-stat small { color: var(--muted); font-size: 11px; }
.report-stat strong { margin-top: 10px; font-size: 26px; font-variant-numeric: tabular-nums; }
.breakdown-list { display: grid; gap: 12px; }
.breakdown-row { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 12px; font-size: 11px; }
.breakdown-track { height: 8px; overflow: hidden; background: var(--surface-2); border-radius: 4px; }
.breakdown-track span { display: block; height: 100%; background: var(--primary); border-radius: 4px; }

.settings-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 24px; }
.settings-nav { display: grid; align-content: start; gap: 4px; }
.settings-nav button { min-height: 40px; padding: 0 12px; color: var(--muted); text-align: left; background: transparent; border: 0; border-radius: 5px; cursor: pointer; }
.settings-nav button.active { color: var(--text); font-weight: 700; background: var(--surface); }
.settings-section { display: none; max-width: 780px; }
.settings-section.active { display: block; }
.settings-section h2 { margin: 0 0 6px; font-size: 20px; }
.settings-section > p { margin: 0 0 22px; color: var(--muted); font-size: 12px; }
.settings-group { margin-bottom: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.settings-group h3 { margin: 0 0 6px; font-size: 13px; }
.settings-group > p { margin: 0 0 18px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.setting-row { display: grid; grid-template-columns: 1fr minmax(180px, 280px); align-items: center; gap: 24px; min-height: 60px; border-top: 1px solid var(--line); }
.setting-row:first-of-type { border-top: 0; }
.setting-row label > strong { display: block; font-size: 12px; }
.setting-row label > small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; background: var(--surface-2); border-radius: 6px; }
.segmented button { min-height: 32px; padding: 0 10px; color: var(--muted); font-size: 11px; background: transparent; border: 0; border-radius: 4px; cursor: pointer; }
.segmented button.active { color: var(--text); font-weight: 700; background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(6, 17, 14, .55); backdrop-filter: blur(4px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(620px, 100%); max-height: min(760px, calc(100vh - 40px)); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.modal-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: start; justify-content: space-between; gap: 20px; padding: 22px 24px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.modal-header h2 { font-size: 20px; }
.modal-body { padding: 22px 24px 26px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 11px; font-weight: 600; }
.field input, .field select, .field textarea, .setting-row input, .setting-row select { width: 100%; min-height: 42px; padding: 0 11px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 5px; }
.field textarea { min-height: 76px; padding-top: 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .setting-row input:focus, .setting-row select:focus { border-color: var(--primary); outline: 2px solid color-mix(in srgb, var(--primary) 12%, transparent); }
.input-affix { position: relative; }
.input-affix input { padding-right: 52px; }
.input-affix span { position: absolute; top: 50%; right: 11px; color: var(--muted); font-size: 10px; transform: translateY(-50%); pointer-events: none; }
.form-hint { grid-column: 1 / -1; padding: 13px; color: var(--muted); font-size: 10px; line-height: 1.6; background: var(--surface-2); border-radius: 5px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; grid-column: 1 / -1; margin-top: 6px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-actions .form-actions-spacer { flex: 1; }
.calculation-preview { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 6px; }
.calculation-preview div { padding: 12px; background: var(--surface-2); }
.calculation-preview small, .calculation-preview strong { display: block; }
.calculation-preview small { color: var(--muted); font-size: 9px; }
.calculation-preview strong { margin-top: 5px; font-size: 13px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 150; max-width: min(360px, calc(100vw - 32px)); padding: 12px 16px; color: #fff; font-size: 12px; background: #24312e; border-radius: 6px; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: none; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .settlement-flow { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .flow-arrow { display: none; }
  .content-grid, .split-grid { grid-template-columns: 1fr; }
  .summary-stack { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .app-shell { display: block; padding-bottom: 70px; }
  .sidebar { position: fixed; inset: auto 0 0; width: auto; height: 66px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--sidebar) 96%, transparent); backdrop-filter: blur(18px); }
  .brand, .sidebar-foot { display: none; }
  .main-nav { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; }
  .nav-item { flex-direction: column; justify-content: center; gap: 3px; min-height: 52px; padding: 0 2px; font-size: 9px; border-radius: 4px; }
  .nav-item.active::before { inset: auto 50% -6px; width: 22px; height: 3px; transform: translateX(-50%); }
  .nav-item svg { width: 18px; height: 18px; }
  .topbar { height: 62px; padding: 0 14px; }
  .top-actions { gap: 5px; }
  .top-actions .icon-button { display: none; }
  .lang-button { width: 34px; padding: 0; }
  .primary-button { padding: 0 11px; }
  .month-switcher { gap: 2px; }
  .month-switcher .icon-button { width: 30px; height: 34px; background: transparent; border: 0; }
  .month-label { min-width: 90px; padding: 8px 4px; font-size: 12px; }
  .view-container { padding: 22px 14px 34px; }
  .page-heading { align-items: start; margin-bottom: 20px; }
  .page-heading h1 { font-size: 23px; }
  .page-heading p:not(.eyebrow) { font-size: 11px; }
  .page-heading > .heading-actions { display: none; }
  .demo-banner { align-items: start; }
  .demo-banner span { line-height: 1.5; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .metric { padding: 15px; }
  .metric-value { font-size: clamp(18px, 6vw, 26px); }
  .metric-foot { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .flow-panel { padding: 16px; }
  .settlement-flow { grid-template-columns: 1fr 1fr; }
  .flow-step:last-child { grid-column: 1 / -1; }
  .content-grid { gap: 14px; }
  .panel { padding: 16px; }
  .chart { height: 160px; gap: 5px; }
  .chart-column:nth-child(even) { display: none; }
  .split-grid { gap: 14px; }
  .summary-stack { grid-template-columns: 1fr; }
  .report-hero { grid-template-columns: 1fr; }
  .report-stat { padding: 18px; }
  .settings-layout { grid-template-columns: 1fr; gap: 16px; }
  .settings-nav { display: flex; overflow-x: auto; padding-bottom: 3px; }
  .settings-nav button { flex: 0 0 auto; }
  .setting-row { grid-template-columns: 1fr; gap: 10px; padding: 14px 0; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { width: 100%; max-height: calc(92vh - env(safe-area-inset-bottom)); border-radius: 8px 8px 0 0; }
  .modal-header { padding: 18px 18px 14px; }
  .modal-body { padding: 18px 18px calc(22px + env(safe-area-inset-bottom)); }
  .form-grid { grid-template-columns: 1fr; }
  .field.full, .form-hint, .form-actions, .calculation-preview { grid-column: 1; }
  .cycle-fields { grid-template-columns: 1fr; }
  .calculation-preview { grid-template-columns: 1fr; }
  .toast { right: 16px; bottom: 82px; }
  .table-tools { align-items: flex-start; flex-direction: column; }
  .view-switcher, .table-actions { width: 100%; justify-content: space-between; }
  .table-actions { justify-content: flex-end; }
  .calendar { padding: 10px; }
  .calendar-grid { gap: 3px; }
  .calendar-cell { min-height: 64px; padding: 7px; }
  .calendar-hours { font-size: 12px; }
  .calendar-detail { overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 390px) {
  .primary-button span { display: none; }
  .primary-button { width: 38px; padding: 0; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; }
  .metric-top { grid-column: 1; }
  .metric-value { grid-column: 1; margin-top: 5px; }
  .metric-foot { grid-column: 2; grid-row: 1 / 3; margin: 0; max-width: 90px; text-align: right; }
}
