:root {
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-size: 14px; line-height: 1.55; color: #1a302f; background: #f4f7f6;
  --ink: #19312f; --secondary: #4b6461; --muted: #687c78; --border: #d6e1dd;
  --teal: #07665d; --teal-dark: #07574f; --mint: #e1f3ed; --canvas: #f4f7f6;
}
* { box-sizing: border-box; }
body { margin: 0; }
button,input,select { font: inherit; }
button,a,input,select { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible { outline: 3px solid #2888bf; outline-offset: 3px; }
a { color: var(--teal); }
h1,h2,h3,p { margin: 0; }
[hidden] { display: none !important; }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { display: inline-block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
.skip { position: fixed; top: -80px; left: 8px; z-index: 10; background: white; padding: 10px; }
.skip:focus { top: 8px; }
.layout { display: grid; grid-template-columns: 196px minmax(0,1fr); min-height: 100vh; min-height: 100dvh; }
.rail { position: sticky; top: 0; align-self: start; height: 100vh; height: 100dvh; background: #102c2b; color: #eaf5f0; display: flex; flex-direction: column; padding: 22px 14px 18px; }
.brand { padding: 4px 10px 28px; display: flex; align-items: center; gap: 11px; }
.brand-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: #a8e0c4; color: #15372f; }
.brand-icon .icon { width: 22px; height: 22px; }
.brand strong,.brand span:not(.brand-icon) { display: block; }
.brand strong,.login-brand { font-family: "Segoe UI",Arial,sans-serif; letter-spacing: .065em; }
.brand strong { font-size: 17px; line-height: 1.12; font-weight: 750; }
.brand span:not(.brand-icon) { font-size: 11px; margin-top: 3px; color: #c1d6cd; letter-spacing: .06em; }
.rail nav { display: grid; gap: 5px; }
.rail nav a { display: flex; align-items: center; gap: 12px; color: #c8d9d4; min-height: 44px; padding: 9px 13px; text-decoration: none; border-radius: 7px; font-weight: 550; }
.rail nav a:hover { background: #1d3e39; color: white; }
.rail nav a[aria-current] { color: #e9fff0; background: #245248; box-shadow: inset 3px 0 0 #a3e0be; }
.rail nav a[aria-current] .icon { color: #b5ecca; }
.rail-bottom { display: flex; align-items: center; gap: 8px; margin: auto 6px 0; padding: 17px 3px 0; color: #c5d9d0; font-size: 12px; border-top: 1px solid #34514a; }
.rail-bottom .icon { width: 16px; }
.workspace { min-width: 0; }
.topbar { min-height: 58px; padding: 0 clamp(20px,3.5vw,58px); display: flex; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid var(--border); color: var(--secondary); font-size: 13px; }
.slash { margin: 0 11px; color: #849792; }
.crumb { color: var(--ink); font-weight: 600; }
.top-actions { margin: 0; }
.quiet,.text-action { background: transparent; border: none; border-radius: 4px; display: inline-flex; gap: 7px; justify-content: center; align-items: center; padding: 5px 3px; color: var(--teal); font-size: 13px; }
.quiet { color: var(--secondary); }
.quiet:hover,.text-action:hover { text-decoration: underline; }
.quiet .icon { height: 16px; width: 16px; }
main#main { padding: 31px clamp(20px,3.5vw,58px) 40px; max-width: 1780px; margin: 0 auto; }
.page-head,.head-actions,.panel-heading,.panel-heading>div,.filters,.table-footer,.pagination,.dialog-head,.filter-group,.button-row { display: flex; align-items: center; }
.page-head,.panel-heading,.table-footer,.dialog-head { justify-content: space-between; }
.page-head { gap: 15px; margin-bottom: 24px; }
h1 { font-size: clamp(24px,2.2vw,34px); letter-spacing: -.035em; line-height: 1.3; font-weight: 700; }
.page-head p { color: var(--secondary); font-size: 13px; margin-top: 5px; }
.head-actions,.button-row { gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; min-height: 37px; align-items: center; justify-content: center; gap: 7px; border: 1px solid #c8d7d0; border-radius: 6px; background: white; color: var(--ink); padding: 7px 12px; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover:not(:disabled) { background: #eef4f0; border-color: #99b4a8; }
.btn.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn.primary:hover:not(:disabled) { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn:disabled,.btn.primary:disabled { background: #eef2f0; border-color: #d9e2de; color: #71847d; }
.btn .icon { width: 15px; height: 15px; }
#notice,.login-error { padding: 12px 15px; border: 1px solid #accbb8; background: #e9f6ed; color: #205d39; border-radius: 7px; margin-bottom: 17px; overflow-wrap: anywhere; }
#notice[data-tone="error"],.login-error { background: #fbefed; border-color: #dfc0b6; color: #853d31; }
#notice[data-tone="busy"] { background: #edf4f5; border-color: #b9d2d2; color: #2c595e; }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); margin-bottom: 22px; background: #fff; border-radius: 9px; border: 1px solid var(--border); padding: 18px 0; }
.metrics:empty { display: none; }
.review-guide { margin: -8px 0 16px; color: #655023; border-left: 3px solid #bb9048; padding: 4px 9px; font-size: 13px; }
.metric { padding: 0 clamp(14px,2.2vw,30px); border-right: 1px solid var(--border); }
.metric:last-child { border: 0; }
.metric span,.metric strong { display: block; }
.metric span { color: var(--secondary); font-size: 13px; }
.metric strong { margin-top: 4px; color: var(--ink); font: 650 27px/1.2 "Segoe UI",Arial,sans-serif; font-variant-numeric: tabular-nums; }
.metric.different strong { color: #99561d; }
.metric.ready strong { color: var(--teal); }
.panel { overflow: hidden; border-radius: 9px; background: #fff; border: 1px solid var(--border); }
.panel-heading { padding: 16px 20px; min-height: 64px; gap: 12px; flex-wrap: wrap; }
.panel-heading>div { gap: 10px; flex-wrap: wrap; }
h2 { font-size: 17px; font-weight: 670; letter-spacing: -.015em; line-height: 1.4; }
#panel-count { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--secondary); }
.filters { flex-wrap: wrap; gap: 10px; padding: 0 20px 15px; }
.search-box { display: flex; align-items: center; gap: 7px; width: min(350px,100%); min-height: 37px; border: 1px solid #bfcec8; border-radius: 6px; padding: 0 9px; background: #fff; color: var(--muted); }
.search-box:focus-within { outline: 2px solid #2888bf; outline-offset: 2px; }
.search-box .icon { width: 16px; height: 16px; }
.search-box input { background: transparent; width: 100%; border: none; outline: none; padding: 7px 0; color: var(--ink); font-size: 13px; }
.search-box input:focus-visible { outline: none; }
.filters select { border: 1px solid #bfcec8; border-radius: 6px; min-height: 37px; background: #fff; color: var(--ink); font-size: 13px; padding: 5px 9px; max-width: 100%; }
.scroll-table { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 13px; font-variant-numeric: tabular-nums; }
th { font-size: 12px; background: #f0f5f2; font-weight: 600; color: #486059; }
th,td { padding: 11px 13px; border-bottom: 1px solid #e1e9e4; vertical-align: middle; }
td { overflow-wrap: anywhere; }
thead th { white-space: nowrap; border-top: 1px solid #dae5de; }
tbody tr:hover { background: #f7faf8; }
tbody tr:last-child td { border-bottom: 0; }
th:first-child,td:first-child { padding-left: 20px; }
th:last-child,td:last-child { padding-right: 20px; }
.check-col { width: 32px; padding-right: 2px; }
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--teal); vertical-align: middle; }
.cell-main { display: block; font-weight: 600; color: var(--ink); }
.cell-sub,.secondary { color: var(--secondary); }
.cell-sub { display: block; font-size: 12px; line-height: 1.5; margin-top: 2px; }
.filename { min-width: 128px; max-width: 340px; }
.nowrap { white-space: nowrap; }
.number { text-align: right; }
.tag { display: inline-flex; padding: 2px 7px; border-radius: 4px; color: #425650; background: #edf1ef; white-space: nowrap; font-size: 12px; }
.tag.positive { color: #276345; background: #e3f1e9; }
.tag.warn { color: #854d16; background: #fbedd8; }
.tag.issue { color: #8d4236; background: #f9e8e3; }
.tag.info { color: #2d5f70; background: #e5f1f5; }
.loading,.empty-state { padding: 40px 20px; text-align: center; color: var(--secondary); }
.empty-state { border-top: 1px solid #e3ebe6; }
.empty-state strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 5px; }
.table-footer { min-height: 48px; padding: 8px 20px; font-size: 12px; color: var(--secondary); border-top: 1px solid #dfe7e1; flex-wrap: wrap; gap: 10px; }
.table-footer:empty { display: none; }
.pagination { gap: 8px; }
.pagination button { padding: 4px 7px; min-height: 29px; font-weight: normal; }
.time-note { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--secondary); font-size: 12px; margin-top: 13px; }
.time-note span { overflow-wrap: anywhere; }
.time-note .sync-error { color: #983c31; font-weight: 600; }
.sheet-note { padding: 10px 20px; background: #f4f8f5; color: var(--secondary); border-top: 1px solid var(--border); font-size: 12px; }
dialog { border: 1px solid var(--border); border-radius: 10px; width: min(920px,calc(100% - 28px)); padding: 0; max-height: min(840px,88dvh); background: white; color: var(--ink); box-shadow: 0 25px 80px #0e342b30; }
dialog::backdrop { background: #102c2b74; }
.dialog-head { gap: 10px; min-height: 56px; padding: 12px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: white; z-index: 1; }
.dialog-head h2 { overflow-wrap: anywhere; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; background: white; color: var(--secondary); border-radius: 5px; border: 1px solid var(--border); flex: none; }
.dialog-body { padding: 17px 18px; }
.dialog-body .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 13px; font-size: 13px; color: var(--secondary); overflow-wrap: anywhere; }
.dialog-body h3,.dialog-body summary { font-weight: 650; font-size: 14px; margin: 17px 0 7px; }
.dialog-body summary { cursor: pointer; }
.dialog-body th,.dialog-body td { padding: 8px; }
.dialog-body table[aria-label="差异物料明细"] { min-width: 600px; }
.dialog-body .reason { background: #f8f3e9; color: #735423; padding: 9px 11px; border-radius: 5px; margin: 10px 0; }
.dialog-body .button-row { margin: 12px 0; }
.preview-summary { display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; padding: 10px 12px; background: #e7f3f0; border-radius: 6px; border-left: 3px solid var(--teal); margin-bottom: 12px; }
.preview-summary strong { width: 100%; font-size: 16px; color: var(--teal-dark); }
.code-summary { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--secondary); font-size: 12px; margin: 0 0 8px; }
.login-body { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; background: var(--canvas); padding: 18px; }
.login-card { padding: 36px; width: min(400px,100%); background: white; border-radius: 12px; border: 1px solid var(--border); border-top: 4px solid var(--teal); }
.login-brand { display: flex; align-items: center; gap: 8px; color: var(--teal); font-weight: 700; }
.login-card h1 { font-size: 29px; margin: 18px 0 5px; }
.login-card p { color: var(--secondary); margin-bottom: 25px; }
.login-card label { display: block; font-weight: 600; margin-bottom: 7px; }
.login-card input[type="password"] { width: 100%; border: 1px solid #aebfb7; border-radius: 6px; padding: 9px; margin-bottom: 18px; }
.login-card .btn { width: 100%; min-height: 42px; }
@media(max-width:1050px) {
  .layout { grid-template-columns: 157px minmax(0,1fr); }
  .rail { padding-left: 9px; padding-right: 9px; }
  .brand { padding-left: 5px; gap: 7px; }
  .brand strong { font-size: 15px; }
  main#main { padding: 24px 20px; }
  .topbar { padding: 0 20px; }
  th,td { padding: 10px; }
}
@media(max-width:720px) {
  .layout { display: block; }
  .rail { position: static; height: auto; padding: 10px 10px 0; }
  .brand { padding: 0 4px 9px; }
  .brand-icon { width: 26px; height: 26px; border-radius: 6px; }
  .brand-icon .icon { width: 18px; }
  .brand>div { display: flex; gap: 7px; align-items: baseline; }
  .brand span:not(.brand-icon) { font-size: 11px; margin-top: 0; }
  .rail nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 2px; }
  .rail nav a { justify-content: center; border-radius: 5px 5px 0 0; gap: 5px; padding: 8px 0; font-size: 12px; min-height: 41px; }
  .rail nav a[aria-current] { box-shadow: inset 0 -3px 0 #a3e0be; }
  .rail nav .icon { width: 14px; height: 14px; }
  .rail-bottom,.topbar p { display: none; }
  .topbar { position: absolute; top: 8px; right: 12px; min-height: auto; background: transparent; border: 0; padding: 0; }
  .quiet { color: #e5f3ea; font-size: 12px; }
  main#main { padding: 20px 12px; }
  .page-head { margin-bottom: 16px; align-items: flex-start; gap: 9px; }
  .page-head h1 { font-size: 24px; }
  .page-head p { font-size: 12px; }
  .page-head>.head-actions { flex-shrink: 0; }
  .head-actions .btn { font-size: 12px; padding: 6px 9px; min-height: 36px; }
  .metrics { margin-bottom: 14px; padding: 12px 0; }
  .metric { padding: 0 9px; }
  .metric strong { font-size: 21px; }
  .metric span { font-size: 11px; }
  .panel-heading { padding: 13px 12px; min-height: 52px; }
  .filters { padding: 0 12px 12px; gap: 7px; }
  .search-box { flex: 1 1 165px; }
  .filters select { flex: 0 1 auto; max-width: 100%; }
  .panel-heading .btn { min-height: 33px; font-size: 12px; padding: 5px 8px; }
  th:first-child,td:first-child { padding-left: 12px; }
  th:last-child,td:last-child { padding-right: 12px; }
  .table-footer,.sheet-note { padding: 9px 12px; }
  .dialog-body { padding: 12px; }
  .dialog-head { padding: 9px 12px; }
  .login-card { padding: 26px; }
}
@media(max-width:375px) {
  .rail nav .icon { display: none; }
  .metric { padding: 0 6px; }
  .metric span { font-size: 10px; }
}
@media(max-width:720px) {
  #records table,#records tbody,#records thead { display: block; }
  #records thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #records tbody tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px 14px; padding: 12px; border-top: 1px solid #dfe8e2; }
  #records tbody td { border: none; padding: 0; display: block; min-width: 0; max-width: none; text-align: left; white-space: normal; }
  #records tbody td[data-label]::before { display: block; content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 400; }
  #records [data-view-table="compare"] thead { position: static; width: auto; height: auto; clip-path: none; }
  #records [data-view-table="compare"] thead tr { display: block; background: #f0f5f2; }
  #records [data-view-table="compare"] thead th { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #records [data-view-table="compare"] thead th:first-child { position: static; display: flex; width: auto; height: auto; clip-path: none; border: 0; align-items: center; gap: 8px; padding: 8px 12px; }
  #records [data-view-table="compare"] thead th:first-child::after { content: "选择本页可生成草稿的产品"; font-size: 11px; }
  #records [data-view-table="compare"] tbody tr { grid-template-columns: 16px minmax(0,1fr) auto; gap: 4px 8px; align-items: start; }
  #records [data-view-table="compare"] tbody td:nth-child(1) { grid-area: 1 / 1; }
  #records [data-view-table="compare"] tbody td:nth-child(2) { grid-area: 1 / 2; }
  #records [data-view-table="compare"] tbody td:nth-child(3) { grid-area: 1 / 3; }
  #records [data-view-table="compare"] tbody td:nth-child(4) { grid-area: 2 / 2; color: var(--secondary); font-size: 12px; }
  #records [data-view-table="compare"] tbody td:nth-child(5) { grid-area: 3 / 2; }
  #records [data-view-table="compare"] tbody td:nth-child(5) .cell-main { color: var(--secondary); font-size: 12px; font-weight: 400; }
  #records [data-view-table="compare"] tbody td:nth-child(6) { grid-area: 2 / 3 / 4 / 4; justify-self: end; }
  #records [data-view-table="compare"] tbody td[data-label]::before { display: none; }
  #records [data-view-table="compare"] tbody td:nth-child(4)::before { content: "差异行"; display: inline; margin-right: 6px; }
  #records .compare-counts .cell-sub { display: inline; margin-left: 8px; }
  #records [data-view-table="sources"] tbody td:first-child,#records [data-view-table="sources"] tbody td:nth-child(5),
  #records [data-view-table="changes"] tbody td:nth-child(4),#records [data-view-table="changes"] tbody td:last-child { grid-column: 1 / -1; }
}
