:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: #172e29;
  background: #f3f6f4;
  --ink: #172e29;
  --muted: #4f665d;
  --line: #dbe5df;
  --accent: #13744d;
  --accent-dark: #09583a;
  --paper: #fff;
  --sidebar: #13332d;
  --sidebar-ink: #e7f5ee;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html[data-erp-mode="server"]:not([data-erp-auth="yes"]) .erp-layout { display: none; }
html { scroll-padding-top: 84px; }
body { margin: 0; font-size: 1rem; line-height: 1.55; }
a { color: inherit; }
.shell { width: min(1510px, calc(100% - 64px)); margin-inline: auto; }
.erp-layout { min-height: 100vh; display: grid; grid-template-columns: 226px minmax(0, 1fr); }
.erp-sidebar { position: sticky; top: 0; display: flex; flex-direction: column; min-width: 0; height: 100dvh; padding: 28px 16px 18px; background: var(--sidebar); color: var(--sidebar-ink); }
.brand { display: inline-flex; align-items: center; gap: 10px; padding-inline: 6px; font-size: 1.06rem; font-weight: 750; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 35px; height: 35px; flex: 0 0 35px; display: flex; align-items: end; justify-content: center; gap: 3px; padding: 8px; border-radius: 9px; background: #65ca9f; }
.brand-mark i { width: 4px; border-radius: 2px; height: 8px; background: #174639; }
.brand-mark i:nth-child(2) { height: 13px; }
.brand-mark i:nth-child(3) { height: 18px; }
.erp-nav { display: grid; gap: 5px; margin-top: 30px; }
.erp-nav a { display: block; padding: 10px 12px; border-radius: 8px; color: #d1e5db; text-decoration: none; font-size: .925rem; font-weight: 600; white-space: nowrap; }
.erp-nav a:hover { background: #224741; color: #fff; }
.erp-nav a[aria-current="page"] { background: #28544b; box-shadow: inset 3px 0 #72d9aa; color: #fff; }
.erp-sidebar :focus-visible { outline-color: #8ae0b8; }
.sidebar-status { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: auto; padding: 14px 6px 0; border-top: 1px solid #3b5a52; color: #c7dfd3; font-size: .82rem; }
.sidebar-status small { font-size: .78rem; }
.erp-body { min-width: 0; }
.workspace-bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; align-items: end; gap: 14px; min-height: 72px; padding: 10px max(32px, calc((100% - 1510px) / 2)); border-bottom: 1px solid var(--line); background: #fff; }
.workspace-bar label { width: min(360px, 100%); min-width: 0; margin-right: auto; }
.workspace-bar select { overflow: hidden; text-overflow: ellipsis; }
.login-layout { min-height: 100dvh; padding: 24px; display: grid; place-items: center; }
.login-card { width: min(100%, 410px); padding: clamp(22px, 7vw, 36px); border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: 0 14px 45px #162e2714; }
.login-card h1 { margin: 22px 0; font-size: 1.55rem; line-height: 1.3; }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 750; }
.login-card form { display: grid; gap: 16px; }
.login-card input { min-height: 44px; font-size: 1rem; }
.login-card .button { min-height: 44px; }
main { padding-block: 29px 56px; }
.page-heading { margin-bottom: 22px; }
.page-heading h1 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.25rem); line-height: 1.25; letter-spacing: -.025em; }
.page-heading p { margin: 8px 0 0; color: var(--muted); }
.page-heading-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.ads-nav { display: flex; flex-wrap: wrap; gap: 14px; }
.ads-nav a, .text-link { color: var(--accent-dark); font-size: .875rem; font-weight: 650; text-decoration: none; }
.ads-nav a:hover, .text-link:hover { text-decoration: underline; }
.workspace-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.record-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.workspace-kpi { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-width: 0; min-height: 126px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.workspace-kpi span { color: #426156; font-size: .875rem; font-weight: 700; }
.workspace-kpi strong { font-size: clamp(1.1rem, 2.1vw, 1.62rem); line-height: 1.28; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.workspace-kpi small { color: var(--muted); font-size: .79rem; overflow-wrap: anywhere; }
.feature-kpi { border-color: #346f60; background: #1d4a3e; color: #fff; }
.feature-kpi span, .feature-kpi small { color: #e2f4e9; }
.overview-grid, .data-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; gap: 14px; }
.data-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.overview-grid .panel, .data-grid .panel { min-width: 0; }
.sales-trend { min-height: 225px; }
.trend-list, .source-list { margin: 12px 0 0; padding: 0; list-style: none; }
.trend-list { display: grid; gap: 10px; }
.trend-row { display: grid; grid-template-columns: 53px minmax(0, 1fr) minmax(84px, auto); gap: 9px; align-items: center; font-size: .875rem; font-variant-numeric: tabular-nums; }
.trend-row time { color: var(--muted); }
.trend-row strong { justify-self: end; }
.trend-track { display: block; height: 9px; border-radius: 999px; background: #e5efe9; overflow: hidden; }
.trend-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: #308563; }
.trend-fill.negative { background: #a15042; }
.source-list li { display: grid; gap: 3px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.source-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.source-list small { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.source-title { font-size: .9rem; font-weight: 700; text-decoration: none; color: var(--accent-dark); }
.source-title:hover { text-decoration: underline; }
.report-context { margin-bottom: 14px; }
.panel { margin-top: 18px; padding: 22px 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.panel-header, .overview-header { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; }
h2 { margin: 2px 0 0; font-size: 21px; line-height: 1.3; }
.muted { color: var(--muted); margin: 7px 0 12px; }
.panel-header .muted { margin-bottom: 3px; }
.import-fields, .filter-bar, .file-row, .backup-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.import-fields > label { flex: 1 1 145px; }
.file-row { margin-top: 14px; }
.file-row > label { flex: 1 1 260px; }
.backup-row { margin-top: 16px; align-items: center; }
label { display: grid; gap: 4px; font-size: .875rem; font-weight: 650; }
input, select, textarea { min-width: 0; max-width: 100%; font: inherit; font-weight: 400; color: var(--ink); padding: 7px 9px; border: 1px solid #c6d5cd; border-radius: 6px; background: #fff; }
select { appearance: none; padding-right: 27px; background-image: linear-gradient(45deg, transparent 50%, #356057 50%), linear-gradient(135deg, #356057 50%, transparent 50%); background-position: calc(100% - 14px) 51%, calc(100% - 9px) 51%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type="file"] { display: block; width: 100%; }
input::file-selector-button { margin-right: 10px; border: 0; border-radius: 4px; padding: 5px 9px; background: #eaf4ee; color: var(--accent-dark); font: inherit; cursor: pointer; }
textarea { resize: vertical; }
.field-note, .backup-row small { color: var(--muted); font-size: 12px; font-weight: 400; }
.backup-picker { position: relative; overflow: hidden; }
.backup-picker input { opacity: 0; position: absolute; inset: 0; cursor: pointer; }
.backup-picker:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; white-space: nowrap; font: inherit; font-size: .875rem; font-weight: 650; text-decoration: none; padding: 7px 13px; border: 1px solid transparent; border-radius: 7px; cursor: pointer; }
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }
.secondary { border-color: #c6d5cd; color: var(--accent-dark); background: #fff; }
.secondary:hover { background: #edf6ef; }
.button:disabled, .backup-picker:has(:disabled) { cursor: default; opacity: .55; }
.small { min-height: 31px; padding: 4px 9px; font-size: 12px; }
:focus-visible { outline: 2px solid #0b8154; outline-offset: 2px; }
.overview { margin-top: 20px; }
.report-picker { width: min(100%, 440px); }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.kpi { min-width: 0; display: flex; flex-direction: column; gap: 3px; min-height: 100px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.kpi span { color: var(--muted); font-size: .875rem; }
.kpi strong { font-size: clamp(18px, 2.2vw, 25px); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi small { color: var(--muted); font-size: .78rem; }
.filter-bar { margin: 14px 0 12px; }
.search-field { flex: 1 1 260px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { text-align: left; padding: 10px 9px; border-bottom: 1px solid #e3ebe7; vertical-align: middle; }
th { white-space: nowrap; color: #3b564b; background: #f3f7f4; font-weight: 700; }
td { overflow-wrap: anywhere; }
tr:hover td { background: #f8fbf9; }
td:first-child { min-width: 120px; }
td:nth-child(2) { min-width: 125px; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.subline, .signal { display: block; margin-top: 2px; color: var(--muted); font-size: .78rem; }
.signal { color: #7c4207; }
.note-cell { max-width: 320px; white-space: pre-wrap; }
.empty-state { text-align: center; padding: 20px 8px; color: var(--muted); }
.pagination { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--muted); }
.pagination button + button { margin-left: 5px; }
.message { margin: 10px 0; padding: 8px 12px; border-radius: 6px; background: #eaf6ee; color: #15583b; }
.message.error { background: #fff0ed; color: #8c2f23; }
dialog { width: min(480px, calc(100% - 28px)); max-height: calc(100% - 30px); padding: 23px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); box-shadow: 0 16px 55px #152d2855; }
dialog::backdrop { background: #10272077; }
dialog label { margin: 12px 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
@media (max-width: 1160px) {
  .erp-layout { grid-template-columns: 185px minmax(0, 1fr); }
  .shell { width: calc(100% - 44px); }
  .workspace-bar { padding-inline: 22px; }
  .workspace-kpis, .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .record-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 890px) {
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .record-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .erp-layout { grid-template-columns: minmax(0, 1fr); }
  .erp-sidebar { position: static; height: auto; padding: 13px 13px 10px; }
  .erp-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 10px; }
  .erp-nav a { padding-block: 7px; }
  .sidebar-status { display: none; }
  .workspace-bar { min-height: 61px; padding-inline: 13px; gap: 9px; }
  .shell { width: calc(100% - 26px); }
  main { padding-block: 20px 38px; }
  .data-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .panel { padding: 15px; }
  .workspace-kpis, .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .workspace-kpi { min-height: 105px; padding: 11px 12px; }
  .kpi { min-height: 84px; }
  .workspace-import { flex: 0 0 auto; }
}
@media (max-width: 365px) {
  .workspace-bar { flex-wrap: wrap; }
}
