:root {
  --bg: #f7f9fa;
  --paper: #ffffff;
  --ink: #202b31;
  --muted: #687982;
  --line: #e4eaed;
  --green: #168467;
  --green-dark: #106c54;
  --green-soft: #eaf6f0;
  --teal: #337caa;
  --teal-soft: #edf5fc;
  --amber: #b77a18;
  --amber-soft: #fff5df;
  --coral: #c65b59;
  --coral-soft: #fdf0ef;
  --violet: #7c69a7;
  --violet-soft: #f2eff9;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { transition: background .16s, border-color .16s, box-shadow .16s; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .bar-wrap:focus-visible { outline: 3px solid #a5d9c8; outline-offset: 3px; }
button:disabled { opacity: .5; cursor: not-allowed; }
svg { width: 18px; height: 18px; stroke-width: 1.8; flex-shrink: 0; vertical-align: middle; }
button svg { pointer-events: none; }
h1, h2, h3, p { margin: 0; letter-spacing: 0; }
h1 { font-size: 25px; line-height: 1.4; font-weight: 650; }
h2 { font-size: 16px; line-height: 1.5; font-weight: 650; }
h3 { font-size: 14px; }
strong { font-weight: 600; }

.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--paper); border-right: 1px solid var(--line); padding: 30px 16px 18px; display: flex; flex-direction: column; gap: 36px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 9px; min-height: 42px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: var(--green); color: #fff; flex-shrink: 0; }
.brand-mark svg { width: 23px; height: 23px; }
.brand strong { display: block; font-size: 17px; white-space: nowrap; }
.brand-divider { color: #c4cdce; font-weight: 400; }
.brand > div > span { display: block; margin-top: 5px; font-size: 9px; color: var(--muted); }
.nav-label { color: #98a2a8; padding: 0 14px; margin-bottom: 12px; font-size: 11px; }
.nav { display: grid; gap: 6px; }
.nav button { border: 0; color: #65717a; background: transparent; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 14px; border-radius: 6px; text-align: left; white-space: nowrap; }
.nav button:hover { background: #f5f8f8; color: var(--ink); }
.nav button.active { background: var(--green-soft); color: var(--green-dark); font-weight: 600; }
.nav button.active::after { content: ""; width: 5px; height: 5px; background: var(--green); border-radius: 50%; margin-left: auto; flex-shrink: 0; }
.nav svg { width: 18px; height: 18px; }
.side-note { margin-top: auto; padding: 18px 10px 0; border-top: 1px solid var(--line); }
.company-label { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.company-label svg { width: 14px; height: 14px; }
.side-note strong { display: block; font-size: 12px; line-height: 1.9; margin: 10px 0 12px; }
.company-links { display: grid; gap: 8px; color: var(--muted); font-size: 11px; }
.company-links span { display: flex; align-items: center; gap: 7px; }
.company-links span::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: #b3c5d1; }
.company-links span:last-child::before { background: #b8accf; }
.sidebar-footer { display: flex; align-items: center; gap: 7px; padding: 0 10px; color: var(--muted); font-size: 11px; margin-top: -14px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.version-label { margin-left: auto; color: #a0aab0; }

.main { padding: 28px 32px 36px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-bottom: 24px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.page-heading { min-width: 0; }
.eyebrow { color: var(--muted); font-size: 11px; line-height: 1.6; margin: 0 0 7px; }
.breadcrumb-separator { padding: 0 10px; color: #c3ccd0; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.search { width: 286px; display: flex; align-items: center; gap: 9px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 0 12px; height: 38px; color: #929da4; transition: border-color .16s, box-shadow .16s; }
.search:focus-within { border-color: #8ac6b3; box-shadow: 0 0 0 3px var(--green-soft); }
.search input { width: 100%; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 12px; }
.search input::placeholder { color: #99a3aa; }
.search input:focus-visible { outline: none; }
.search svg { width: 16px; height: 16px; }
.icon-button { width: 38px; height: 38px; flex-shrink: 0; border: 1px solid var(--line); background: var(--paper); border-radius: 6px; display: inline-grid; place-items: center; color: #718088; }
.icon-button:hover { background: #eff4f4; border-color: #c9d8d4; color: var(--green-dark); }
.icon-button.subtle { background: transparent; border-color: transparent; }
.tooltip { position: relative; }
.tooltip::after { content: attr(data-tooltip); position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; padding: 6px 9px; background: #29363b; color: white; border-radius: 4px; font-size: 11px; font-weight: 400; white-space: nowrap; pointer-events: none; opacity: 0; transform: translateY(-3px); transition: .15s; }
.tooltip:hover::after, .tooltip:focus-visible::after { opacity: 1; transform: translateY(0); }
.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.period-label { display: inline-flex; align-items: center; gap: 8px; color: #65747d; font-size: 12px; white-space: nowrap; }
.period-label svg { width: 16px; height: 16px; }
.inline-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.primary, .ghost, .text-button { border-radius: 6px; min-height: 36px; padding: 0 13px; display: inline-flex; justify-content: center; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.primary { border: 1px solid var(--green); background: var(--green); color: white; box-shadow: 0 1px 2px #163e2310; }
.primary:hover { border-color: var(--green-dark); background: var(--green-dark); box-shadow: 0 3px 8px #126b5420; }
.primary:active, .ghost:active, .icon-button:active { transform: translateY(1px); }
.ghost { border: 1px solid var(--line); background: var(--paper); color: #52636d; }
.ghost:hover { background: #f1f6f4; border-color: #b9d2c9; color: var(--green-dark); }
.primary svg, .ghost svg, .text-button svg { width: 16px; height: 16px; }
.text-button { border: 0; background: transparent; color: var(--green); padding: 0 7px; min-height: 30px; }
.text-button:hover { background: var(--green-soft); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar > .primary { margin-left: auto; }
.filter-control { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--paper); border-radius: 6px; padding: 0 10px; min-height: 38px; color: #85929a; min-width: 0; }
.filter-control:focus-within { border-color: #8ac6b3; box-shadow: 0 0 0 3px var(--green-soft); }
.filter-control svg { width: 15px; height: 15px; }
.filter-control select { min-width: 100px; max-width: 260px; height: 36px; border: 0; background: transparent; font-size: 12px; padding-right: 7px; color: #52636d; }
.filter-control select:focus-visible { outline: none; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 26px; }
.kpi { --accent: var(--green); --tint: var(--green-soft); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 19px 18px 17px; min-width: 0; box-shadow: 0 2px 4px #29374003; }
.kpi.warn { --accent: var(--amber); --tint: var(--amber-soft); }
.kpi.bad { --accent: var(--coral); --tint: var(--coral-soft); }
.kpi.info { --accent: var(--teal); --tint: var(--teal-soft); }
.kpi.violet { --accent: var(--violet); --tint: var(--violet-soft); }
.kpi-head { display: flex; gap: 8px; justify-content: space-between; align-items: center; min-height: 30px; }
.kpi-label { color: #65717a; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.kpi-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; background: var(--tint); color: var(--accent); flex-shrink: 0; }
.kpi-icon svg { width: 16px; height: 16px; }
.kpi strong { display: block; margin: 13px 0 10px; font-size: 25px; font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi small { color: #75838c; font-size: 12px; line-height: 1.6; display: block; }
.kpi.warn strong { color: #a36f1c; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(310px, .85fr); gap: 30px; align-items: start; }
.panel { min-width: 0; padding-top: 22px; border-top: 1px solid var(--line); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.panel-head h2 { display: flex; align-items: center; gap: 9px; }
.panel-head h2 svg { width: 17px; height: 17px; color: #798a92; }
.panel-head p { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; white-space: nowrap; color: var(--muted); }
.legend::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--green); }

.chart-frame { display: grid; grid-template-columns: 45px minmax(0, 1fr); gap: 12px; padding: 17px 0 0; }
.chart-axis { height: 234px; display: flex; flex-direction: column; justify-content: space-between; color: #96a0a7; font-size: 10px; text-align: right; }
.chart { height: 260px; display: flex; align-items: stretch; gap: 12px; position: relative; isolation: isolate; }
.chart-lines { position: absolute; inset: 0 0 26px; z-index: -1; display: flex; flex-direction: column; justify-content: space-between; }
.chart-lines span { border-top: 1px dashed #dde6e8; width: 100%; }
.chart-lines span:last-child { border-top-style: solid; }
.bar-wrap { flex: 1; min-width: 0; display: grid; grid-template-rows: minmax(0, 1fr) 26px; height: 100%; position: relative; border-radius: 3px; }
.bar { align-self: end; justify-self: center; width: min(100%, 33px); border-radius: 3px 3px 0 0; background: #50aa8e; transition: background .16s; }
.bar-wrap:nth-last-child(1) .bar { background: var(--green); }
.bar-wrap:hover .bar, .bar-wrap:focus-visible .bar { background: var(--green-dark); }
.bar-label { font-size: 10px; color: #89969e; text-align: center; padding-top: 10px; white-space: nowrap; }
.chart-tooltip { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); z-index: 5; background: #29363b; color: #fff; padding: 7px 10px; border-radius: 4px; font-size: 11px; white-space: nowrap; opacity: 0; pointer-events: none; }
.bar-wrap:nth-child(-n+4) .chart-tooltip { left: 0; transform: none; }
.bar-wrap:nth-last-child(-n+3) .chart-tooltip { left: auto; right: 0; transform: none; }
.bar-wrap:hover .chart-tooltip, .bar-wrap:focus-visible .chart-tooltip { opacity: 1; }
.chart-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 20px; padding-top: 15px; color: var(--muted); font-size: 11px; }
.chart-foot strong { color: var(--ink); font-variant-numeric: tabular-nums; font-size: 13px; }
.worklist { display: grid; }
.workitem { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.workitem:last-child { border-bottom: 0; }
.workitem:first-child { padding-top: 0; }
.workitem strong { display: block; font-size: 13px; line-height: 1.7; }
.workitem div > span { color: var(--muted); font-size: 12px; line-height: 1.8; display: block; margin-top: 3px; overflow-wrap: anywhere; }
.person-summary { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #edf2f5; color: #708792; flex-shrink: 0; }
.workitem .person-summary > .person-avatar { display: inline-grid; margin-top: 0; }
.person-avatar svg { width: 15px; height: 15px; }
.workitem:nth-child(3n+2) .person-avatar { background: #f2eff7; color: #9a88b3; }
.workitem:nth-child(3n) .person-avatar { background: #eef4ed; color: #7f9d74; }

.table-wrap { overflow: auto; max-height: 640px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); scrollbar-width: thin; scrollbar-color: #cad5d9 transparent; }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 820px; }
table.compact { min-width: 560px; }
table.wide-table { min-width: 1580px; }
.wide-table td:nth-child(-n+3) { min-width: 118px; white-space: nowrap; }
.wide-table td:nth-child(6) { min-width: 230px; }
th, td { padding: 14px 16px; border-bottom: 1px solid #edf1f3; text-align: left; font-size: 13px; vertical-align: middle; line-height: 1.7; }
th { position: sticky; top: 0; z-index: 1; background: #f5f8f9; color: #687982; font-size: 12px; font-weight: 500; white-space: nowrap; }
td { color: #51616b; min-width: 80px; max-width: 280px; overflow-wrap: anywhere; }
td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; color: #7c8991; }
td.amount, th.amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount-value { font-weight: 500; color: #344750; }
.amount-value.coral { color: var(--coral); }
tbody tr:hover td { background: #f5faf8; }
tr:last-child td { border-bottom: 0; }
.table-footer { display: flex; justify-content: space-between; padding: 12px 2px; font-size: 11px; color: #909ca4; }
.muted { color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 5px; min-height: 23px; padding: 3px 8px; border-radius: 4px; background: #f0f3f5; color: #697983; font-size: 11px; font-weight: 500; line-height: 1.4; white-space: nowrap; }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.coral { background: var(--coral-soft); color: var(--coral); }
.tag.violet { background: var(--violet-soft); color: var(--violet); }
.tag.status::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.profit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 26px; }
.rule-list { display: grid; }
.rule { display: grid; grid-template-columns: minmax(0, 1fr) 86px; gap: 8px 12px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); }
.rule:first-child { padding-top: 0; }
.rule:last-child { border-bottom: 0; }
.rule strong { font-size: 12px; }
.rule-owner { grid-column: 1; grid-row: 2; font-size: 11px; color: #75838c; line-height: 1.7; }
.percent-input { display: flex; align-items: center; gap: 3px; border: 1px solid var(--line); background: #fff; border-radius: 5px; padding: 0 8px; grid-column: 2; grid-row: 1 / 3; }
.percent-input:focus-within { border-color: #8ac6b3; box-shadow: 0 0 0 3px var(--green-soft); }
.percent-input input { height: 34px; border: 0; background: transparent; width: 100%; min-width: 0; font-size: 12px; font-variant-numeric: tabular-nums; }
.percent-input input:focus-visible { outline: none; }
.percent-input span { color: #96a0a6; font-size: 11px; }

dialog { border: 1px solid var(--line); border-radius: 8px; padding: 0; background: var(--paper); max-width: calc(100vw - 28px); max-height: calc(100dvh - 40px); overflow: auto; box-shadow: 0 24px 80px #1a3d3426; }
dialog::backdrop { background: #23372f55; backdrop-filter: blur(3px); }
.dialog-card { width: min(660px, calc(100vw - 30px)); padding: 24px; }
.dialog-card header, .dialog-card footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-card header { border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.dialog-heading { display: flex; align-items: center; gap: 12px; }
.dialog-heading-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 8px; color: var(--green); background: var(--green-soft); }
.dialog-heading-icon svg { width: 20px; height: 20px; }
.dialog-heading .eyebrow { margin-bottom: 3px; }
.dialog-card footer { justify-content: flex-end; margin-top: 22px; border-top: 1px solid var(--line); padding-top: 20px; }
.dialog-card footer button { min-width: 80px; height: 38px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; margin-top: 22px; }
.field { display: grid; gap: 8px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { color: #5e6e76; font-size: 12px; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; border: 1px solid #dde5e8; border-radius: 5px; background: white; min-height: 39px; padding: 9px 11px; font-size: 12px; }
.field input::placeholder, .field textarea::placeholder { color: #a4afb5; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: #bbcbc5; }
.field textarea { min-height: 80px; resize: vertical; }
.empty { padding: 60px 20px; color: var(--muted); text-align: center; font-size: 12px; border: 1px dashed var(--line); border-radius: 6px; }
.empty svg { display: block; width: 28px; height: 28px; color: #a4b4bd; margin: 0 auto 12px; }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 10px); padding: 12px 18px; background: #263d34; color: #fff; border-radius: 6px; box-shadow: 0 6px 24px #233d3426; font-size: 12px; z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

.notice { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 18px; border: 1px solid #eedbb2; background: #fffaef; color: #946b20; border-radius: 6px; font-size: 12px; line-height: 1.8; }
.notice > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.notice > svg { width: 17px; height: 17px; }
.notice .text-button { color: inherit; flex-shrink: 0; }
.notice.info { background: var(--teal-soft); color: #3a6f91; border-color: #d6e7f2; }
.segmented { display: flex; align-items: center; gap: 4px; margin-bottom: 20px; padding: 4px; background: #eaf0f2; border-radius: 6px; width: fit-content; max-width: 100%; }
.segmented button { min-height: 32px; background: transparent; color: #71818a; padding: 6px 15px; font-size: 12px; border: 0; border-radius: 4px; white-space: nowrap; }
.segmented button:hover { color: var(--green); }
.segmented button.active { background: white; color: var(--green-dark); box-shadow: 0 1px 3px #223f3610; font-weight: 600; }
.secondary-toolbar { margin-top: -8px; }
.date-filter { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); min-width: 0; }
.date-filter input { height: 36px; background: #fff; border: 1px solid var(--line); border-radius: 5px; padding: 0 8px; font-size: 12px; min-width: 0; }
.compact-button { width: 30px; height: 30px; border: 0; background: transparent; }
.compact-button svg { width: 15px; height: 15px; }
.row-actions { display: flex; align-items: center; gap: 4px; }
.row-actions .tooltip::after { top: auto; bottom: calc(100% + 7px); right: 0; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; color: var(--muted); font-size: 11px; }
.pagination > div { display: flex; gap: 8px; align-items: center; }
.cell-note, .source-cell small { display: block; color: var(--muted); margin-top: 3px; font-size: 10px; overflow-wrap: anywhere; }
.source-cell { display: block; min-width: 150px; max-width: 240px; font-size: 11px; }
.spaced-panel { margin-top: 26px; }
.inline-select { border: 1px solid var(--line); border-radius: 5px; padding: 7px 8px; background: white; width: 100%; max-width: 260px; min-width: 160px; font-size: 12px; }
.required-mark { color: #bf665a; }
.field-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 39px; font-size: 11px; color: var(--muted); }
.form-error { color: #b25049; background: #fff3f1; border: 1px solid #f1d4cd; border-radius: 5px; padding: 10px 12px; margin-top: 16px; font-size: 12px; line-height: 1.8; }
.wide-dialog { max-width: calc(100vw - 28px); }
.import-card { width: min(960px, calc(100vw - 30px)); padding: 24px; }
.modal-header, .modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.modal-footer { justify-content: flex-end; border-bottom: 0; border-top: 1px solid var(--line); padding: 20px 0 0; margin-top: 20px; }
.import-file-row { display: flex; align-items: center; gap: 12px; margin-top: 22px; }
.import-file-row > span { font-size: 12px; overflow-wrap: anywhere; min-width: 0; }
.import-file-row > button { flex-shrink: 0; }
.import-summary { display: flex; gap: 8px; flex-wrap: wrap; margin: 22px 0 16px; }
.check-field { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.check-field input { width: 15px; height: 15px; accent-color: var(--green); }
#importPreview .table-wrap { max-height: 320px; }
#dialogFields .notice { margin-bottom: 0; }
#dialogFields .table-wrap { max-height: 200px; }
#dialogFields table { min-width: 400px; }

@media (min-width: 1600px) {
  .main { padding: 32px 46px 42px; }
  .kpi strong { font-size: 28px; }
  .kpi { padding: 22px; }
  .grid-2 { gap: 40px; }
}
@media (max-width: 1240px) {
  .shell { grid-template-columns: 208px minmax(0, 1fr); }
  .main { padding: 24px; }
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .brand { padding: 0 5px; gap: 9px; }
  .brand strong { font-size: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .search { width: 245px; }
  .profit-grid .kpi strong { font-size: 22px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 18px 24px 14px; gap: 20px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .brand { padding: 0; }
  .brand > div > span { font-size: 9px; }
  .nav-label, .side-note, .sidebar-footer { display: none; }
  .nav { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .nav button { justify-content: center; padding: 10px 5px; min-height: 38px; gap: 7px; font-size: 11px; }
  .nav button.active::after { display: none; }
  .nav svg { width: 15px; height: 15px; }
  .main { padding: 24px; }
  .topbar { gap: 14px; }
}
@media (max-width: 600px) {
  .sidebar { padding: 16px; gap: 16px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand strong { font-size: 16px; }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .nav button { justify-content: flex-start; padding: 9px 10px; font-size: 12px; }
  .main { padding: 20px 16px 28px; }
  .topbar { align-items: stretch; flex-direction: column; padding-bottom: 18px; margin-bottom: 18px; gap: 16px; }
  h1 { font-size: 23px; }
  .eyebrow { font-size: 10px; }
  .top-actions { width: 100%; }
  .search { width: 100%; }
  .section-toolbar { flex-wrap: wrap; margin-bottom: 16px; }
  .section-toolbar .inline-actions { gap: 6px; }
  .section-toolbar .primary, .section-toolbar .ghost { padding: 0 9px; font-size: 11px; min-height: 34px; }
  .period-label { font-size: 11px; gap: 6px; }
  .kpi-grid, .profit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 24px; }
  .kpi { padding: 14px 12px; }
  .kpi-head { gap: 4px; }
  .kpi-label { font-size: 11px; }
  .kpi-icon { width: 25px; height: 25px; border-radius: 5px; }
  .kpi-icon svg { width: 14px; height: 14px; }
  .kpi strong, .profit-grid .kpi strong { font-size: 20px; margin: 12px 0 8px; }
  .kpi small { font-size: 10px; }
  .profit-grid .kpi:last-child { grid-column: 1 / -1; }
  .panel { padding-top: 18px; }
  .panel-head { gap: 8px; margin-bottom: 16px; }
  .panel-head h2 { font-size: 15px; gap: 7px; }
  .panel-head p { font-size: 10px; }
  .text-button { font-size: 11px; padding: 0 3px; }
  .chart-frame { grid-template-columns: 36px minmax(0, 1fr); gap: 7px; }
  .chart { gap: 7px; }
  .bar { width: min(100%, 25px); }
  .bar-label, .chart-axis { font-size: 9px; }
  .toolbar { gap: 8px; }
  .toolbar .filter-control { flex: 1 1 calc(50% - 8px); }
  .filter-control select { min-width: 0; width: 100%; font-size: 11px; max-width: 100%; }
  .toolbar > .primary { margin-left: 0; }
  .workitem { gap: 8px; }
  .workitem .tag { max-width: 52%; white-space: normal; text-align: right; }
  .dialog-card { padding: 20px 16px; }
  .dialog-heading-icon { width: 34px; height: 34px; }
  .dialog-card h2 { font-size: 15px; }
  .form-grid { grid-template-columns: 1fr; gap: 16px; }
  .table-wrap { max-height: 540px; }
  th, td { padding: 12px; }
  .notice { font-size: 11px; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
  .notice > svg { margin-top: 3px; }
  .notice .text-button { margin-left: auto; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; font-size: 11px; padding: 7px 9px; }
  .date-filter { flex: 1 1 calc(50% - 8px); }
  .date-filter input { width: 100%; font-size: 11px; }
  .toolbar .primary { min-height: 38px; }
  .panel-head { flex-wrap: wrap; }
  .import-card { padding: 20px 16px; }
  .import-file-row { flex-wrap: wrap; }
  .pagination { flex-wrap: wrap; }
  .section-toolbar > .period-label { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 370px) {
  .kpi strong, .profit-grid .kpi strong { font-size: 18px; }
  .kpi { padding: 12px 10px; }
  .nav button { gap: 5px; padding: 9px 6px; font-size: 11px; }
}
@media (max-width: 340px) {
  .kpi-grid, .profit-grid { grid-template-columns: 1fr; }
  .kpi strong, .profit-grid .kpi strong { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

.login-panel { min-height:100dvh; display:grid; place-items:center; padding:24px; background:#f2f6f7; }
.login-form { width:min(380px,100%); padding:30px; background:white; border:1px solid var(--line); border-radius:8px; display:grid; gap:14px; }
.login-form h1 { font-size:24px; margin:8px 0 12px; }
.login-form label { font-size:13px; color:var(--muted); }
.login-form input { min-width:0; width:100%; padding:11px; border:1px solid var(--line); border-radius:5px; }
.login-form p { color:var(--coral); font-size:12px; line-height:1.8; overflow-wrap:anywhere; }
.check-list { display:grid; gap:14px; margin:20px 0; }
.closing-actions { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin:20px 0; font-size:12px; line-height:1.8; }
.closing-actions .muted { flex:1; min-width:160px; }
.backup-actions { display:flex; flex-wrap:wrap; gap:12px; margin:20px 0; }
.allocation-row { border:0; border-top:1px solid var(--line); padding:16px 0; min-width:0; }
.allocation-row legend { padding-right:10px; color:var(--muted); font-size:12px; }
.allocation-row .form-grid { margin:10px 0; }
.segmented { overflow-x:auto; flex-shrink:0; }
.segmented button { flex-shrink:0; }
.sidebar-footer #storageStatus { min-width:0; overflow-wrap:anywhere; }
.icon-button { text-decoration:none; }
@media(max-width:600px) {
  .top-actions { flex-wrap:wrap; }
  .top-actions .search { flex:1 1 100%; }
  .segmented button { flex:0 0 auto; }
  .backup-actions > button { flex:1 1 100%; }
}
