:root {
  color-scheme: light;
  --canvas: #f4f6f2;
  --paper: #fff;
  --text: #192823;
  --muted: #506258;
  --border: #dbe3da;
  --subtle: #edf2eb;
  --accent: #245343;
  --accent-dark: #173c31;
  --accent-soft: #e4eee6;
  --forest: #102820;
  --leaf: #3b6952;
  --lime: #bdd380;
  --sidebar-ink: #f0f5f0;
  --sidebar-muted: #afc2b5;
  --sidebar-hover: #1b372d;
  --sidebar-active: #224236;
  --blue-bg: #e8eef9;
  --blue-text: #314d83;
  --amber-bg: #f8f0db;
  --amber-text: #775107;
  --red-bg: #fff0ed;
  --red-text: #8e2d25;
  --radius: 14px;
  --transition: 160ms ease;
  font-family: "Instrument Sans", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  background: var(--canvas);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; }
h1, h2, p, dl, dd { margin: 0; }
button, select, input, textarea { font: inherit; color: inherit; }
a, button, select { touch-action: manipulation; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .54; }
a { color: inherit; text-decoration: none; }
button, a { transition: background-color var(--transition), color var(--transition), border-color var(--transition); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
main:focus { outline: none; }
label { min-width: 0; }
.icon { width: 19px; height: 19px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.skip-link { position: fixed; inset: 8px auto auto 12px; clip-path: inset(50%); z-index: 10; background: var(--paper); padding: 10px 16px; border-radius: 8px; }
.skip-link:focus { clip-path: none; }
.starting { padding: 32px; text-align: center; color: var(--muted); }

.shell { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--forest); color: var(--sidebar-ink); position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 22px 15px 16px; overflow: auto; }
.brand { display: grid; justify-items: start; gap: 12px; align-self: flex-start; border-radius: 11px; }
.sidebar .brand { width: 100%; padding: 11px 12px 12px; }
.brand-logo { position: relative; display: block; width: 100%; aspect-ratio: 439 / 140; overflow: hidden; background: var(--paper); }
.brand-logo img { position: absolute; width: 121.19%; height: auto; left: -4.55%; top: -30%; }
.sidebar .brand-logo { background: var(--paper); border-radius: 6px; }
.sidebar .brand-product { font-size: 22px; line-height: 1.16; font-weight: 750; letter-spacing: .1em; }
.side-nav { display: grid; gap: 5px; margin-top: 23px; }
.nav-label { display: block; padding: 0 11px 4px; font-size: .85rem; color: var(--sidebar-muted); font-weight: 620; }
.second-label { margin-top: 18px; }
.side-link { position: relative; display: flex; align-items: center; min-height: 45px; gap: 11px; padding: 8px 11px; border-radius: 8px; color: var(--sidebar-ink); font-weight: 550; }
.side-link:hover, .sidebar .icon-button:hover { background: var(--sidebar-hover); color: var(--lime); }
.side-link[aria-current] { background: var(--sidebar-active); color: var(--sidebar-ink); font-weight: 700; }
.side-link[aria-current]::before { content: ""; position: absolute; inset: 9px auto 9px 0; width: 3px; border-radius: 0 4px 4px 0; background: var(--lime); }
.sidebar :focus-visible { outline-color: var(--lime); }
.sidebar .icon-button, .sidebar-bottom small { color: var(--sidebar-muted); }
.sidebar-bottom { display: grid; grid-template-columns: 37px minmax(0, 1fr) 36px; gap: 9px; align-items: center; border-top: 1px solid #3c554a; margin-top: auto; padding: 15px 1px 0; }
.sidebar-bottom strong, .sidebar-bottom small { display: block; overflow-wrap: anywhere; }
.sidebar-bottom small { margin-top: 1px; font-size: .82rem; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-weight: 700; background: var(--lime); color: var(--forest); }
.workspace { min-width: 0; }
.topbar { min-height: 69px; border-bottom: 1px solid var(--border); background: var(--paper); display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 30px; }
.breadcrumbs, .date-label { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); }
.breadcrumbs .icon { width: 14px; height: 14px; }
.breadcrumbs strong { color: var(--text); }
.environment { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 100px; background: var(--subtle); font-size: .9rem; color: var(--muted); white-space: nowrap; }
.environment i { background: var(--leaf); width: 7px; height: 7px; border-radius: 50%; }
.content { max-width: 1620px; margin: 0 auto; padding: 24px 30px 42px; min-width: 0; }

.page-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 24px; margin: 0 0 18px; }
.page-heading h1 { font-size: clamp(1.72rem, 3vw, 2.15rem); line-height: 1.25; letter-spacing: -.04em; font-weight: 760; overflow-wrap: anywhere; }
.page-heading p { margin-top: 6px; color: var(--muted); }
.page-back { margin-bottom: 8px; }
.actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 43px; padding: 8px 13px; border-radius: 9px; border: 1px solid var(--border); font-weight: 650; background: var(--paper); line-height: 1.3; text-align: center; }
.button:hover { background: var(--subtle); border-color: #bdcec6; }
.button:active { background: var(--accent-soft); }
.button .icon, .link .icon { width: 16px; height: 16px; }
.button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.button.primary:hover, .button.primary:active { background: var(--accent-dark); border-color: var(--accent-dark); }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: none; background: transparent; color: var(--muted); border-radius: 8px; }
.icon-button:hover { color: var(--accent-dark); background: var(--accent-soft); }
.link { display: inline-flex; align-items: center; gap: 6px; min-height: 29px; color: var(--accent-dark); font-weight: 650; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

.welcome { position: relative; display: flex; align-items: center; justify-content: space-between; isolation: isolate; gap: 17px 28px; flex-wrap: wrap; overflow: hidden; padding: 27px 29px; min-height: 144px; background: var(--accent-dark); color: #fff; border-radius: 15px; margin-bottom: 16px; }
.brand-ribbons { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.brand-ribbons i { position: absolute; right: -4%; bottom: -24%; width: 64%; height: 132%; background: var(--leaf); opacity: .36; clip-path: polygon(0 83%, 72% 0, 100% 29%, 19% 100%); }
.brand-ribbons i:nth-child(2) { right: -12%; bottom: -48%; opacity: .27; }
.brand-ribbons i:nth-child(3) { right: -25%; bottom: -45%; background: var(--lime); opacity: .10; }
.welcome h2 { font-size: clamp(1.5rem, 3vw, 1.9rem); line-height: 1.3; font-weight: 720; overflow-wrap: anywhere; }
.welcome p { margin-top: 6px; color: #e2f0db; }
.welcome .inverse { color: #fff; background: #29483b; border-color: #758d7e; }
.welcome .inverse:hover { background: #345749; }
.welcome-primary { color: var(--forest); background: var(--lime); border-color: var(--lime); }
.welcome-primary:hover { background: #ccdf9c; border-color: #ccdf9c; }
.welcome a:focus-visible { outline-color: var(--lime); }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr)); gap: 14px; margin-bottom: 17px; }
.metric { display: grid; position: relative; align-content: start; grid-template-columns: 35px minmax(0, 1fr); gap: 2px 10px; min-height: 99px; padding: 15px 16px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--border); }
a.metric:hover { border-color: #9fb496; background: #fcfdfb; }
.metric-symbol, .todo-symbol { display: grid; place-items: center; height: 35px; width: 35px; background: var(--accent-soft); border-radius: 9px; color: var(--accent-dark); }
.metric-symbol { grid-row: 1 / span 2; }
.metric-label { align-self: end; color: var(--muted); font-size: .94rem; padding-right: 13px; }
.metric strong { font-size: 1.64rem; line-height: 1.3; font-variant-numeric: tabular-nums; font-weight: 750; overflow-wrap: anywhere; }
.metric-arrow { color: #596d55; position: absolute; right: 11px; top: 14px; }
.metric-arrow .icon { width: 15px; height: 15px; }
.dashboard-grid, .overview-grid { display: grid; gap: 16px; }
.dashboard-grid { grid-template-columns: minmax(0, 2.18fr) minmax(0, 1fr); }
.overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.todos { display: grid; list-style: none; padding: 0 16px 7px; margin: 0; }
.todos li + li { border-top: 1px solid var(--subtle); }
.todos a { display: grid; grid-template-columns: 31px minmax(0, 1fr) auto 15px; align-items: center; gap: 8px; min-height: 51px; padding: 6px 0; color: var(--text); }
.todos a:hover { color: var(--accent); }
.todo-symbol { width: 29px; height: 29px; }
.todo-symbol .icon, .todos a > .icon { width: 15px; height: 15px; }
.todos a > .icon { color: var(--muted); }

.panel { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; min-width: 0; }
.panel-heading { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 8px 15px; flex-wrap: wrap; padding: 13px 16px; }
.panel-heading h2 { font-size: 1.17rem; line-height: 1.3; font-weight: 730; }
.panel-heading p { margin-top: 4px; font-size: .89rem; color: var(--muted); }
.panel-heading .link { font-size: .9rem; }
.table-scroll { overflow: auto; max-width: 100%; border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px); }
.table-scroll:focus-visible { outline-offset: -3px; }
table { border-collapse: collapse; width: 100%; text-align: left; }
thead { background: #f1f5ec; }
td, th { padding: 10px 14px; border-bottom: 1px solid var(--subtle); vertical-align: middle; }
th { color: var(--muted); font-size: .87rem; font-weight: 650; white-space: nowrap; }
td:last-child, th:last-child { padding-right: 16px; }
td:first-child, th:first-child { padding-left: 16px; }
td { overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8faf5; }
.record-name { display: grid; line-height: 1.36; min-width: 125px; padding: 1px 0; }
.record-name .link { min-height: 0; }
.record-name > span { font-size: .83rem; color: var(--muted); margin-top: 4px; }
.number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.secondary { color: var(--muted); }
.tag { display: inline-flex; font-size: .87rem; border-radius: 50px; padding: 3px 9px; min-height: 25px; align-items: center; font-weight: 650; color: var(--muted); background: var(--subtle); white-space: nowrap; }
.tag.green { color: var(--accent-dark); background: var(--accent-soft); }
.tag.blue { color: var(--blue-text); background: var(--blue-bg); }
.tag.amber { color: var(--amber-text); background: var(--amber-bg); }
.tag.red { color: var(--red-text); background: var(--red-bg); }
.danger-link { color: var(--red-text); }
.void-note { display: block; color: var(--muted); margin-top: 3px; max-width: 180px; }
.correction-note { color: var(--muted); font-weight: 500; }
.audit-raw summary { color: var(--accent-dark); cursor: pointer; white-space: nowrap; }
.audit-raw dl { width: min(330px, 65vw); max-height: 300px; overflow: auto; margin-top: 7px; padding: 10px; background: var(--subtle); border-radius: 8px; }
.audit-raw dt { font-weight: 650; color: var(--muted); }
.audit-raw dd { margin: 4px 0 9px; }
.audit-lines { padding-left: 19px; margin: 3px 0 8px; }
.audit-lines span { display: block; color: var(--muted); }
.empty { padding: 27px 16px; text-align: center; color: var(--muted); border-top: 1px solid var(--subtle); }
.tabs { display: flex; flex-wrap: wrap; gap: 3px 13px; margin-bottom: 15px; border-bottom: 1px solid var(--border); }
.tabs a { display: inline-flex; align-items: center; min-height: 43px; padding: 8px 10px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
.tabs a:hover, .tabs a[aria-current] { color: var(--accent-dark); }
.tabs a[aria-current] { border-bottom-color: var(--accent); font-weight: 730; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 16px 23px; padding: 5px 16px 18px; }
.detail-grid dt { color: var(--muted); font-size: .9rem; }
.detail-grid dd { margin-top: 3px; font-weight: 620; overflow-wrap: anywhere; white-space: pre-line; }
.source-row { min-width: 105px; }
.source-row summary { cursor: pointer; color: var(--accent-dark); }
.source-row ul { margin: 8px 0; padding-left: 15px; }
.thumbnail { display: inline-grid; place-items: center; vertical-align: middle; width: 46px; height: 46px; margin: 2px; border-radius: 6px; background: var(--subtle); border: 1px solid var(--border); }
.thumbnail img { width: 44px; height: 44px; object-fit: contain; border-radius: 6px; }
.image-list { padding: 0 16px 10px; display: flex; flex-wrap: wrap; }

.form-grid { padding: 4px 16px 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 17px; max-width: 920px; }
.field { display: grid; gap: 5px; color: var(--text); font-weight: 630; align-content: start; }
.field.wide { grid-column: 1 / -1; }
.field .required { color: var(--red-text); }
input, textarea, select { width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 8px; border: 1px solid #c8d8d0; background: var(--paper); font-weight: 450; }
input[type=file] { cursor: pointer; min-height: 43px; }
input[type=file]::file-selector-button { margin-inline-end: 8px; background: var(--subtle); border: none; border-radius: 4px; padding: 3px 7px; color: var(--accent-dark); cursor: pointer; }
input:disabled, select:disabled { background: var(--subtle); }
textarea { resize: vertical; min-height: 76px; }
.upload-action { display: flex; align-items: end; }
.form-footer { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--subtle); }
.form-error { align-self: stretch; margin: 0 0 5px; padding: 8px 12px; border-radius: 8px; color: var(--red-text); background: var(--red-bg); }
.panel > .form-error { margin: 0 16px 12px; }
.line-toolbar { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; padding: 0 16px 12px; gap: 8px; }
.line-toolbar .actions { align-items: end; }
.line-toolbar select { min-width: 155px; }
.line-editor { min-width: 835px; }
.line-editor td { padding: 7px 5px; vertical-align: top; }
.line-editor th { padding: 8px 5px; }
.line-editor td:first-child, .line-editor th:first-child { padding-left: 16px; }
.line-editor td:last-child, .line-editor th:last-child { padding-right: 16px; }
.line-editor th:first-child { width: 22%; }
.line-editor th:nth-child(2) { width: 15%; }
.line-editor th:nth-child(3), .line-editor th:nth-child(4) { width: 7%; }
.line-editor input { min-height: 36px; padding: 5px 7px; }
.line-source { display: block; color: var(--muted); margin-top: 3px; font-size: .84rem; }
.warnings { margin: 0 16px 10px; color: var(--amber-text); background: var(--amber-bg); padding: 8px 10px; border-radius: 8px; }
ul.warnings { padding-left: 27px; }
.sheet-preview > p { margin: 0 16px 12px; color: var(--muted); }
.sheet-preview .table-scroll { margin-bottom: 10px; }
.sheet-selection { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 15px; margin: 0 16px 11px; }
.sheet-selection label { display: inline-flex; align-items: center; gap: 7px; min-height: 35px; font-weight: 650; cursor: pointer; }
.sheet-selection input { width: 17px; height: 17px; min-height: 0; accent-color: var(--accent); }
.mapping-controls { border: 1px solid var(--border); border-radius: 9px; margin: 0 16px 16px; padding: 10px 12px; }
.mapping-controls summary { color: var(--accent-dark); cursor: pointer; font-weight: 650; }
.mapping-controls p, .mapping-source { margin: 8px 0; color: var(--muted); }
.mapping-source .table-scroll { max-height: 270px; }
.mapping-source td { min-width: 76px; max-width: 210px; }
.mapping-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr)); gap: 12px; padding: 7px 0; }
.mapping-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 5px; }
.notification { position: fixed; bottom: 21px; right: 21px; z-index: 9; border-radius: 9px; background: var(--forest); color: #fff; padding: 11px 16px; max-width: min(335px, calc(100vw - 42px)); box-shadow: 0 5px 20px #102f2b24; }

.login { display: grid; min-height: 100vh; min-height: 100dvh; grid-template-columns: 1fr 1fr; background: var(--paper); }
.login-banner { isolation: isolate; display: grid; position: relative; align-content: center; gap: 38px; padding: 7vw; min-height: 350px; background: var(--forest); color: #fff; overflow: hidden; }
.login-brand { width: min(100%, 335px); padding: 15px 18px; background: var(--paper); box-shadow: 0 16px 32px #10281840; }
.login-banner h1 { font-size: clamp(1.8rem, 4vw, 3.3rem); line-height: 1.2; letter-spacing: -.045em; }
.login-banner p { margin-top: 12px; color: #e2f0db; font-size: 1.1rem; }
.login-banner .brand-ribbons { inset: 32% 0 0; }
.login-banner .brand-ribbons i { width: 150%; }
.login-content { display: grid; place-items: center; min-width: 0; background: var(--canvas); padding: 30px 25px; }
.login-content form { display: grid; gap: 18px; width: min(100%, 420px); padding: 34px; border: 1px solid var(--border); border-radius: 16px; background: var(--paper); }
.login-content h2 { font-size: 1.9rem; margin-bottom: 7px; }
.login-content .button { min-height: 46px; margin-top: 5px; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 182px minmax(0, 1fr); }
  .content, .topbar { padding-inline: 20px; }
  .sidebar { padding-inline: 10px; }
  .metric strong { font-size: 1.38rem; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); }
}
@media (max-width: 920px) {
  .dashboard-grid, .overview-grid { grid-template-columns: 1fr; gap: 0; }
  .metrics { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
  .welcome { padding: 21px; }
}
@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { display: grid; grid-template-columns: 1fr auto; gap: 8px; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px 11px 9px; overflow: visible; }
  .sidebar .brand { display: flex; align-items: center; gap: 8px; width: auto; padding: 2px 3px; }
  .sidebar .brand-logo { width: clamp(94px, 25vw, 130px); }
  .sidebar .brand-product { font-size: 18px; }
  .sidebar-bottom { border: 0; margin: 0; padding: 0; grid-template-columns: auto 36px; }
  .sidebar-bottom .avatar, .nav-label { display: none; }
  .sidebar-bottom small { display: none; }
  .side-nav { grid-column: 1 / -1; grid-row: 2; margin: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
  .side-link { min-height: 42px; justify-content: center; gap: 5px; padding: 6px 3px; font-size: .93rem; }
  .side-link .icon { width: 17px; height: 17px; }
  .topbar { min-height: 45px; padding-block: 6px; font-size: .88rem; }
  .topbar, .content { padding-inline: 12px; }
  .content { padding-block-start: 14px; }
  .actions { gap: 7px; }
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-banner { min-height: 0; gap: 14px; padding: 22px 24px; }
  .login-brand { width: min(100%, 225px); padding: 8px 10px; }
  .login-content form { padding: 22px; }
  .login-banner p { margin-top: 6px; font-size: 1rem; }
}
@media (max-width: 460px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .welcome { padding: 15px; }
  .welcome .button { padding-inline: 8px; }
  .metrics { gap: 7px; }
  .metric { padding-inline: 8px; gap: 2px 6px; grid-template-columns: 30px minmax(0, 1fr); }
  .metric-symbol { width: 29px; height: 29px; }
  .metric-symbol .icon { width: 16px; height: 16px; }
  .metric-arrow { right: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
