/* ORDIS · 生产跟单工作台 — 延续工业实用风格：暖白纸张 + 墨黑 + 朱红单一强调色 */
[hidden] { display: none !important; }

:root {
  --color-bg: #f3efe6;
  --color-surface: #fbf8f1;
  --color-surface-2: #ece6d9;
  --color-text: #1b1a17;
  --color-muted: #6b665d;
  --color-faint: #a39c8f;
  --color-accent: #d94f2b;
  --color-accent-soft: rgba(217, 79, 43, .12);
  --color-border: #d5cdbd;
  --color-border-strong: #b9af9d;
  --color-ok: #3f7d5a;
  --color-error: #b32d22;
  --color-dark: #20201d;
  --color-dark-2: #191917;

  --font-display: "Archivo Black", "Noto Serif SC", serif;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --text-xs: 10px;
  --text-sm: 12px;
  --text-base: 14px;
  --text-lg: 18px;
  --text-xl: 24px;
  --text-hero: clamp(32px, 3.4vw, 50px);
  --space-1: 4px; --space-2: 8px; --space-3: 16px; --space-4: 24px; --space-5: 40px;
  --radius-sm: 3px; --radius-md: 8px; --radius-lg: 16px;
  --shadow-1: 0 2px 8px rgba(27,26,23,.08);
  --shadow-2: 0 12px 32px rgba(27,26,23,.14);
  --shadow-3: 0 28px 64px rgba(27,26,23,.18);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur-fast: 160ms; --dur-base: 320ms;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--color-bg); color: var(--color-text);
  font-family: var(--font-mono); font-size: var(--text-base); line-height: 1.7;
  letter-spacing: .01em; overflow-x: hidden;
}
.atmosphere {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(48rem 32rem at 8% -12%, rgba(217,79,43,.16), transparent 62%),
    radial-gradient(40rem 34rem at 105% 8%, rgba(90,105,112,.14), transparent 58%),
    linear-gradient(180deg, #f6f2e9 0%, #efe9dc 100%);
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
.app-shell, .login-overlay, #modalRoot { position: relative; z-index: 2; }
/* 提示条必须脱离文档流并置于最上层，避免被页面内容遮挡或掉到左下角。 */

/* ---------- login ---------- */
.login-overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(243,239,230,.94); backdrop-filter: blur(12px);
}
.login-card {
  width: min(420px, 92vw); padding: 36px;
  background: var(--color-surface); border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
  display: grid; gap: 14px;
}
.login-card .brand { border-bottom: 1px solid var(--color-border); padding-bottom: 18px; }
.brand-logo { display: block; width: 236px; max-width: 100%; height: auto; }
.login-card h1 { font-family: var(--font-display); font-size: 30px; line-height: 1; margin: 14px 0 0; letter-spacing: .01em; }
.login-card p { margin: 0 0 10px; color: var(--color-muted); font-family: var(--font-serif); font-size: 13px; }
.login-hint { color: var(--color-muted); font-size: 10px; line-height: 1.6; }
.login-error { padding: 10px 12px; border-left: 3px solid var(--color-error); background: rgba(179,45,34,.08); color: var(--color-error); font-size: 12px; }

/* ---------- shell ---------- */
.app-shell { display: grid; grid-template-columns: 232px minmax(0,1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 22px 16px 18px; border-right: 1px solid var(--color-border);
  background: rgba(251,248,241,.78); backdrop-filter: blur(10px);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; }
.brand-mark-img { width: 30px; height: 30px; display: block; }
.brand-name { font-family: var(--font-display); font-size: 18px; letter-spacing: .12em; color: var(--color-text); }
.sidebar-sub { margin-top: 4px; padding-bottom: 18px; border-bottom: 1px solid var(--color-border); font-size: 10px; color: var(--color-muted); letter-spacing: .12em; }
.nav { display: grid; gap: 2px; margin-top: 16px; overflow-y: auto; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: var(--radius-sm); color: var(--color-muted); text-decoration: none;
  font-size: 12px; transition: background var(--dur-fast), color var(--dur-fast);
}
.nav a i { font-style: normal; font-size: 10px; color: var(--color-faint); width: 20px; }
.nav a:hover { background: var(--color-accent-soft); color: var(--color-text); }
.nav a.active { background: var(--color-accent); color: #fff7f0; }
.nav a.active i { color: rgba(255,247,240,.7); }
.sidebar-foot { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--color-border); }
.status-chip {
  display: inline-flex; align-items: center; gap: 7px; width: fit-content;
  padding: 5px 10px; border: 1px solid var(--color-border-strong); border-radius: 999px;
  background: var(--color-surface); font-size: 10px; letter-spacing: .06em;
}
.status-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--color-faint); }
.status-chip.ready i { background: var(--color-ok); box-shadow: 0 0 0 3px rgba(63,125,90,.16); }
.status-chip.off i { background: var(--color-error); }
.version { font-size: 10px; color: var(--color-muted); letter-spacing: .1em; }

.main-column { display: flex; flex-direction: column; min-width: 0; }
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(20px,3vw,44px); border-bottom: 1px solid var(--color-border);
  background: rgba(251,248,241,.72); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 10;
}
.crumb { font-family: var(--font-serif); font-size: 13px; font-weight: 700; }
.header-meta { display: flex; align-items: center; gap: 12px; }
.user-chip {
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm);
  background: var(--color-surface); padding: 5px 10px; font-family: var(--font-mono);
  font-size: 11px; cursor: pointer; color: var(--color-text);
}
.user-chip:hover { border-color: var(--color-accent); }
.lang-btn {
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm);
  background: var(--color-surface); padding: 5px 11px; font-family: var(--font-mono);
  font-size: 11px; font-weight: 600; cursor: pointer; color: var(--color-accent);
  letter-spacing: .04em; transition: .15s;
}
.lang-btn:hover { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.content { flex: 1; padding: clamp(20px,3vw,40px) clamp(20px,3vw,44px); }
.site-footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 0 clamp(20px,3vw,44px) 24px; font-size: 10px; color: var(--color-muted); letter-spacing: .06em;
}

/* 侧栏分组：减少并列层级，突出业务阶段 */
.nav-group { margin: 14px 0 4px; padding: 0 10px; font-family: var(--font-mono); font-size: 9px; letter-spacing: .12em; color: var(--color-faint); }
.nav-group:first-child { margin-top: 4px; }
@media (max-width: 900px) { .nav-group { grid-column: 1/-1; } }

/* ---------- generic ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-size: var(--text-hero); line-height: .96; letter-spacing: -.045em; margin: 0 0 8px; }
.page-head p { margin: 0; color: var(--color-muted); font-family: var(--font-serif); font-size: 13px; max-width: 66ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 主数据子标签：把供应商/客户/物料/产品收拢到同一页 */
.master-tabs { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-bottom: 18px; }
.master-tabs button { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 11px 13px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text); cursor: pointer; text-align: left; transition: background var(--dur-fast), border-color var(--dur-fast); }
.master-tabs button:hover { border-color: var(--color-accent); background: var(--color-accent-soft); }
.master-tabs button span { font-family: var(--font-serif); font-size: 14px; font-weight: 600; }
.master-tabs button small { font-family: var(--font-mono); font-size: 9px; letter-spacing: .08em; color: var(--color-faint); }
.master-tabs button em { position: absolute; top: 10px; right: 12px; font-style: normal; font-family: var(--font-mono); font-size: 10px; color: var(--color-muted); }
.master-tabs button.active { background: var(--color-accent); border-color: var(--color-accent); color: #fff7f0; }
.master-tabs button.active small, .master-tabs button.active em { color: rgba(255,247,240,.72); }
.master-subhead { margin: 0 0 14px; }
.master-subhead p { font-size: 12px; }
@media (max-width: 900px) { .master-tabs { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.panel {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-1);
}
.panel + .panel { margin-top: 18px; }
/* 网格内的面板由 grid gap 控制间距；叠加 margin 会让第二张卡片整体下移、高度变矮。 */
.grid-2 > .panel + .panel, .grid-3 > .panel + .panel, .grid-intake > .panel + .panel { margin-top: 0; }
.grid-2.top-align { align-items: start; }
.settings-grid > .panel:nth-child(3) { grid-column: 1 / -1; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-family: var(--font-serif); font-size: 16px; }
.panel-head small { color: var(--color-muted); font-size: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; align-items: stretch; }
#aContent .grid-2 > .panel { display: flex; flex-direction: column; }
#aContent .grid-2 > .panel > :last-child { flex: 1; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
.grid-intake { display: grid; grid-template-columns: minmax(340px, 430px) minmax(0,1fr); gap: 24px; align-items: stretch; }
.grid-intake > .output-shell { display: flex; flex-direction: column; height: 100%; }
.grid-intake .output-body { flex: 1; min-height: 0; }
.grid-intake .output-empty { min-height: 300px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px; border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text);
  font-family: var(--font-mono); font-size: 11px; cursor: pointer;
  transition: border-color var(--dur-fast), transform var(--dur-fast) var(--ease-out), background var(--dur-fast);
}
.btn:hover:not(:disabled) { border-color: var(--color-accent); transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--color-accent); border-color: var(--color-accent); color: #fff7f0; font-family: var(--font-display); font-size: 12px; }
.btn-primary:hover:not(:disabled) { background: #c44422; }
.btn-danger { color: var(--color-error); border-color: rgba(179,45,34,.5); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--color-muted); }
.btn-sm { min-height: 28px; padding: 0 9px; font-size: 10px; }
.btn-block { width: 100%; }

.field { display: grid; gap: 4px; font-size: 11px; color: var(--color-muted); }
.field > span { letter-spacing: .06em; }
.field input, .field select, .field textarea, .inline-input, .inline-select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm); background: #fdfbf6; color: var(--color-text);
  font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.field textarea { min-height: 88px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters .field { min-width: 140px; }
.filters .field input, .filters .field select { min-height: 36px; }

.table-wrap { overflow: auto; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
table.data { width: 100%; border-collapse: collapse; font-size: 11px; min-width: 620px; }
table.data th {
  position: sticky; top: 0; text-align: left; padding: 10px 12px;
  background: var(--color-surface-2); border-bottom: 2px solid var(--color-accent);
  font-size: 10px; letter-spacing: .08em; color: var(--color-muted); white-space: nowrap;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
table.data tbody tr:hover { background: rgba(217,79,43,.05); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.number, table.data th.number { text-align: right; }
table.data td.actions { white-space: nowrap; }
.link { color: var(--color-accent); cursor: pointer; text-decoration: none; border-bottom: 1px dotted var(--color-accent); }
.muted { color: var(--color-muted); }
.faint { color: var(--color-faint); }
.nowrap { white-space: nowrap; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; font-size: 10px; border: 1px solid var(--color-border-strong); background: var(--color-surface); }
.badge.accent { color: var(--color-accent); border-color: rgba(217,79,43,.45); background: var(--color-accent-soft); }
.badge.ok { color: var(--color-ok); border-color: rgba(63,125,90,.4); background: rgba(63,125,90,.08); }
.badge.warn { color: #a86a12; border-color: rgba(168,106,18,.4); background: rgba(168,106,18,.08); }
.badge.error { color: var(--color-error); border-color: rgba(179,45,34,.4); background: rgba(179,45,34,.08); }
.badge.dark { color: #efe9dc; background: var(--color-dark); border-color: var(--color-dark); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 16px; position: relative; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--color-accent); opacity: .8; }
.kpi span { display: block; font-size: 10px; color: var(--color-muted); letter-spacing: .08em; }
.kpi strong { display: block; font-family: var(--font-display); font-size: 26px; line-height: 1.2; margin-top: 6px; letter-spacing: -.03em; }
.kpi small { font-size: 10px; color: var(--color-faint); display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 分析页：固定 5 列，卡片等高且数值不溢出（格式塔接近性 + Miller 组块） */
.kpi-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-grid-5 .kpi { min-height: 108px; display: flex; flex-direction: column; }
.kpi-grid-5 .kpi strong { font-size: clamp(20px, 2vw, 27px); overflow-wrap: anywhere; }
.kpi-grid-5 .kpi small { margin-top: auto; }
@media (max-width: 1180px) { .kpi-grid-5 { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 720px) { .kpi-grid-5 { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* 数据-图形匹配：构成→环形、时序→柱状、比例→仪表 */
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; min-height: 180px; }
.donut { width: 150px; height: 150px; border-radius: 50%; flex: none; display: grid; place-items: center; position: relative; }
.donut-hole { width: 94px; height: 94px; border-radius: 50%; background: var(--color-surface); display: grid; place-content: center; text-align: center; }
.donut-hole strong { font-family: var(--font-display); font-size: 24px; letter-spacing: -.03em; }
.donut-hole small { font-size: 9px; color: var(--color-muted); letter-spacing: .08em; }
.donut-legend { flex: 1; min-width: 180px; display: grid; gap: 6px; }
.donut-legend > div { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 8px; align-items: center; font-size: 11px; }
.donut-legend i { width: 9px; height: 9px; border-radius: 2px; }
.donut-legend b { font-weight: 600; }
.donut-legend em { font-style: normal; font-size: 10px; color: var(--color-faint); width: 32px; text-align: right; }

.columns { display: flex; gap: 8px; align-items: flex-end; min-height: 180px; padding-top: 12px; overflow-x: auto; }
.col { flex: 1; min-width: 26px; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.col-value { font-size: 9px; color: var(--color-muted); font-family: var(--font-mono); white-space: nowrap; }
.col-bar { flex: 1; width: 100%; max-width: 34px; display: flex; align-items: flex-end; background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: 2px; }
.col-fill { width: 100%; background: var(--color-accent); border-radius: 2px 2px 0 0; min-height: 3px; }
.col-label { font-size: 9px; color: var(--color-faint); font-family: var(--font-mono); white-space: nowrap; }

.gauges { display: grid; gap: 18px; min-height: 180px; align-content: center; }
.gauge-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; margin-bottom: 6px; }
.gauge-top b { font-family: var(--font-display); font-size: 20px; }
.gauge-top b.green { color: var(--color-ok); }
.gauge-track { height: 9px; border-radius: 999px; background: var(--color-surface-2); border: 1px solid var(--color-border); overflow: hidden; }
.gauge-fill { height: 100%; background: var(--color-accent); }
.gauge-fill.green { background: var(--color-ok); }
.gauge small { display: block; margin-top: 5px; font-size: 10px; color: var(--color-faint); }

.story-strip {
  display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 0;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
  overflow: hidden; margin-bottom: 20px; background: var(--color-surface);
}
.story-step { padding: 14px 16px; border-right: 1px solid var(--color-border); cursor: pointer; transition: background var(--dur-fast); }
.story-step:last-child { border-right: 0; }
.story-step:hover { background: var(--color-accent-soft); }
.story-step b { display: block; font-family: var(--font-display); font-size: 12px; color: var(--color-accent); }
.story-step span { display: block; font-size: 11px; margin-top: 3px; }
.story-step small { color: var(--color-muted); font-size: 10px; }

.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 62px; gap: 10px; align-items: center; font-size: 11px; }
.bar-track { height: 10px; background: var(--color-surface-2); border-radius: 2px; overflow: hidden; border: 1px solid var(--color-border); }
.bar-fill { height: 100%; background: var(--color-accent); transition: width var(--dur-base) var(--ease-out); }
.bar-fill.green { background: var(--color-ok); }
.bar-fill.grey { background: var(--color-faint); }

/* ---------- intake ---------- */
.dropzone {
  display: grid; place-items: center; gap: 5px; min-height: 132px; padding: 18px;
  border: 1px dashed var(--color-border-strong); border-radius: var(--radius-md);
  background: var(--color-surface-2); cursor: pointer; text-align: center;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--color-accent); background: var(--color-accent-soft); }
.drop-icon { font-size: 28px; line-height: 1; color: var(--color-accent); }
.dropzone strong { font-family: var(--font-serif); font-size: 15px; }
.dropzone small { color: var(--color-muted); font-size: 10px; }
.step-label { display: flex; align-items: center; gap: 9px; margin: 18px 0 8px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--color-muted); }
.step-label b { color: var(--color-accent); font-size: 12px; }
.file-pills { display: grid; gap: 6px; margin-top: 8px; }
.file-pill { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); font-size: 11px; }
.file-pill span:nth-child(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pill button { border: 0; background: none; color: var(--color-muted); cursor: pointer; font-size: 16px; }
.output-shell { border: 1px solid var(--color-border-strong); border-radius: var(--radius-lg); background: var(--color-dark); color: #efe9dc; box-shadow: var(--shadow-2); overflow: hidden; }
.output-topbar { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid rgba(239,233,220,.12); background: var(--color-dark-2); }
.window-dots { display: flex; gap: 5px; } .window-dots i { width: 8px; height: 8px; border-radius: 50%; background: #4c4a45; } .window-dots i:first-child { background: var(--color-accent); }
.output-title { flex: 1; font-size: 11px; letter-spacing: .08em; }
.output-state { font-size: 9px; letter-spacing: .16em; color: #8b857a; }
.output-state.busy { color: #ffb08f; } .output-state.done { color: #8fd4a9; }
.result-tabs { display: flex; gap: 3px; padding: 0 12px; border-bottom: 1px solid rgba(239,233,220,.12); overflow-x: auto; }
.result-tab { appearance: none; border: 0; border-bottom: 2px solid transparent; background: none; color: #8b857a; padding: 8px 10px; font-family: var(--font-mono); font-size: 10px; cursor: pointer; white-space: nowrap; }
.result-tab.active { color: #ffb08f; border-bottom-color: var(--color-accent); }
.output-body { min-height: 460px; max-height: 68vh; overflow: auto; padding: 16px; }
.draft-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-bottom: 16px; }
.draft-grid .field span { color: #8b857a; }
.draft-grid .field input, .draft-grid .field select, .draft-grid .field textarea { background: #2c2b27; border-color: #4c4a45; color: #efe9dc; }
.draft-grid .field textarea { width: 100%; padding: 8px 10px; font-family: inherit; font-size: 11px; resize: vertical; }
.party-status { display: block; margin-top: 4px; font-size: 10px; color: #8b857a; }
.party-status.known { color: #7fb08a; }
.party-status.new { color: #ffb08f; }
.draft-grid .field.low-confidence input { border-color: #ffb08f; box-shadow: 0 0 0 2px rgba(217,79,43,.2); }
.dark-label { font-size: 10px; letter-spacing: .1em; color: #8b857a; margin: 12px 0 6px; }

/* ---------- rich text editor（其他备注） ---------- */
.rt-editor { border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); background: #fdfbf6; overflow: hidden; }
.rt-toolbar { display: flex; align-items: center; gap: 3px; padding: 5px 7px; border-bottom: 1px solid var(--color-border); background: var(--color-surface-2); }
.rt-toolbar button { appearance: none; border: 1px solid transparent; background: none; color: var(--color-muted); min-width: 26px; height: 24px; border-radius: 3px; font-family: var(--font-mono); font-size: 11px; cursor: pointer; }
.rt-toolbar button:hover { border-color: var(--color-border-strong); background: var(--color-surface); color: var(--color-accent); }
.rt-hint { margin-left: auto; font-size: 9px; color: var(--color-faint); letter-spacing: .04em; }
.rt-body { min-height: 120px; max-height: 320px; overflow: auto; padding: 10px 12px; font-size: 11px; line-height: 1.7; color: var(--color-text); outline: none; }
.rt-body:focus { box-shadow: inset 0 0 0 2px rgba(217,79,43,.14); }
.rt-body p { margin: 0 0 4px; }
.rt-body h3 { margin: 10px 0 5px; font-size: 12px; color: var(--color-accent); font-family: var(--font-serif); }
.rt-body ul, .rt-body ol { margin: 4px 0; padding-left: 20px; }
.rt-body table { width: 100%; border-collapse: collapse; margin: 8px 0; font-family: var(--font-mono); font-size: 10px; }
.rt-body th, .rt-body td { border: 1px solid var(--color-border-strong); padding: 4px 7px; text-align: left; }
.rt-body th { background: var(--color-surface-2); font-weight: 600; }
.rt-editor.rt-dark { background: #2c2b27; border-color: #4c4a45; }
.rt-dark .rt-toolbar { background: #262521; border-bottom-color: #4c4a45; }
.rt-dark .rt-toolbar button { color: #8b857a; }
.rt-dark .rt-toolbar button:hover { border-color: #4c4a45; background: #33322e; color: #ffb08f; }
.rt-dark .rt-hint { color: #6e6a62; }
.rt-dark .rt-body { color: #efe9dc; }
.rt-dark .rt-body:focus { box-shadow: inset 0 0 0 2px rgba(217,79,43,.35); }
.rt-dark .rt-body h3 { color: #ffb08f; }
.rt-dark .rt-body th, .rt-dark .rt-body td { border-color: #4c4a45; }
.rt-dark .rt-body th { background: #33322e; }
.rt-view { border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: #fdfbf6; padding: 12px; max-height: 420px; overflow: auto; font-size: 11px; line-height: 1.7; }
.rt-view p { margin: 0 0 4px; }
.rt-view h3 { margin: 10px 0 5px; font-size: 12px; color: var(--color-accent); font-family: var(--font-serif); }
.rt-view table { width: 100%; border-collapse: collapse; margin: 8px 0; font-family: var(--font-mono); font-size: 10px; }
.rt-view th, .rt-view td { border: 1px solid var(--color-border-strong); padding: 4px 7px; text-align: left; }
.rt-view th { background: var(--color-surface-2); }

/* 原订单文件卡片：解析后保留的原始文件，支持预览 / 下载 / 补录 */
.source-file-card { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; padding: 9px 11px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); background: var(--color-surface-2); }
.source-file-card.empty { border-style: dashed; background: #fdfbf6; }
.source-file-card .doc-mark { flex: none; font-family: var(--font-mono); font-size: 9px; letter-spacing: .06em; color: var(--color-accent); border: 1px solid var(--color-accent); border-radius: 3px; padding: 5px 6px; }
.source-file-card .source-file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.source-file-card .source-file-info b { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-file-card .source-file-info small { font-size: 10px; color: var(--color-muted); }
.source-file-card .btn { flex: none; }
.source-file-card.dark-file { background: #2c2b27; border-color: #4c4a45; }
.dark-file .doc-mark { color: #ffb08f; border-color: #ffb08f; }
.dark-file .source-file-info small { color: #8b857a; }

table.items-dark { width: 100%; border-collapse: collapse; font-size: 10px; }
table.items-dark th { color: #8b857a; text-align: left; padding: 6px 4px; border-bottom: 1px solid #4c4a45; }
table.items-dark td { padding: 4px; border-bottom: 1px solid #33322e; }
table.items-dark input { width: 100%; min-width: 52px; background: #2c2b27; border: 1px solid #4c4a45; border-radius: 2px; color: #efe9dc; padding: 5px; font-family: var(--font-mono); font-size: 10px; }
table.items-dark select.inline-select { background: #2c2b27; border: 1px solid #4c4a45; border-radius: 2px; color: #efe9dc; padding: 4px; font-family: var(--font-mono); font-size: 10px; }
table.items-dark th:first-child, table.items-dark th:nth-child(2) { white-space: nowrap; }
table.items-dark .badge { font-size: 9px; white-space: nowrap; }
.dark-warn { padding: 10px 12px; margin: 10px 0; border-left: 3px solid #ffb08f; background: rgba(217,79,43,.12); color: #ffc9bf; font-size: 11px; }
.dark-warn div { margin: 2px 0; }
.output-empty { display: grid; place-content: center; justify-items: center; min-height: 420px; color: #6e6a62; text-align: center; }
.output-empty .empty-rule { width: 64px; height: 1px; background: var(--color-accent); margin-bottom: 16px; }
.output-empty p { margin: 0; font-family: var(--font-serif); font-size: 18px; color: #b8b1a4; }
.output-empty span { font-size: 11px; margin-top: 6px; }
.output-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid rgba(239,233,220,.12); background: var(--color-dark-2); }
.output-footer .foot-note { font-size: 10px; color: #8b857a; }
pre.raw-view { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: var(--font-mono); font-size: 11px; line-height: 1.7; color: #efe9dc; }

/* ---------- modal / toast ---------- */
/* 右侧抽屉：任务内配置保留主区上下文（风险列表），符合 Nielsen #3 用户控制 */
#drawerRoot { pointer-events: none; }
#drawerRoot.open { pointer-events: auto; }
.drawer-mask { position: fixed; inset: 0; z-index: 45; background: rgba(27,26,23,.38); backdrop-filter: blur(2px); opacity: 0; transition: opacity var(--dur-base); }
#drawerRoot.open .drawer-mask { opacity: 1; }
.drawer-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 46; width: min(520px, 94vw); display: flex; flex-direction: column; background: var(--color-surface); border-left: 1px solid var(--color-border-strong); box-shadow: var(--shadow-3); transform: translateX(100%); transition: transform var(--dur-base) var(--ease-out); }
#drawerRoot.open .drawer-panel { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--color-border); }
.drawer-head small { font-family: var(--font-mono); font-size: 9px; letter-spacing: .12em; color: var(--color-accent); }
.drawer-head h3 { font-family: var(--font-display); font-size: 20px; margin: 6px 0 0; letter-spacing: -.02em; }
.drawer-head button { border: 0; background: none; font-size: 24px; line-height: 1; color: var(--color-muted); cursor: pointer; }
.drawer-head button:hover { color: var(--color-accent); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.drawer-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--color-border); }
.risk-rules { display: grid; gap: 12px; }
.risk-rule { padding: 13px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: #fdfbf6; }
.risk-rule-top { display: flex; gap: 10px; align-items: center; }
.risk-rule-top .inline-input { flex: 1; font-weight: 600; }
.risk-switch { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: var(--color-muted); white-space: nowrap; }
.risk-rule-desc { margin: 7px 0 9px; font-size: 10px; color: var(--color-muted); line-height: 1.6; }
.risk-rule-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.drawer-actions { display: flex; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--color-border); }
@media (max-width: 560px) { .risk-rule-grid { grid-template-columns: 1fr; } }

.modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(27,26,23,.45); backdrop-filter: blur(3px); }
.modal { width: min(880px, 96vw); max-height: 90vh; display: flex; flex-direction: column; background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); }
.modal.narrow { width: min(520px, 96vw); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--color-border); }
.modal-head h3 { margin: 0; font-family: var(--font-serif); font-size: 17px; }
.modal-head button { border: 0; background: none; font-size: 22px; color: var(--color-muted); cursor: pointer; line-height: 1; }
.modal-body { padding: 18px; overflow: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--color-border); }
.toast-root { position: fixed; top: 72px; right: 20px; bottom: auto; z-index: 80; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast { padding: 10px 14px; border-left: 3px solid var(--color-ok); background: var(--color-surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-2); font-size: 12px; max-width: 360px; pointer-events: auto; }
.toast.error { border-left-color: var(--color-error); }
.empty-state { display: grid; place-content: center; justify-items: center; min-height: 260px; color: var(--color-muted); text-align: center; }
.empty-rule { width: 56px; height: 1px; background: var(--color-accent); margin-bottom: 14px; }
.empty-state p { margin: 0; font-family: var(--font-serif); font-size: 17px; }

/* ---------- tracking ---------- */
.board { display: grid; grid-template-columns: repeat(7, minmax(190px,1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.board-col { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-2); padding: 8px; min-height: 260px; }
.board-col h3 { margin: 0 0 8px; font-size: 11px; display: flex; justify-content: space-between; }
.board-card { padding: 9px; margin-bottom: 7px; border: 1px solid var(--color-border); border-left: 3px solid var(--color-accent); border-radius: var(--radius-sm); background: var(--color-surface); font-size: 10px; cursor: pointer; }
.board-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.board-card b { display: block; font-size: 11px; }
.board-card .meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 3px; color: var(--color-muted); }
.board-risk { display: flex; align-items: center; gap: 9px; margin-top: 8px; padding: 7px 9px; border: 1px solid var(--color-border); border-left: 3px solid var(--color-faint); border-radius: var(--radius-sm); background: var(--color-surface-2); }
.board-risk.ok { border-left-color: var(--color-ok); }
.board-risk.accent { border-left-color: var(--color-accent); }
.board-risk.warn { border-left-color: #a86a12; }
.board-risk.error { border-left-color: var(--color-error); }
.risk-score { flex: 0 0 auto; line-height: 1; }
.risk-score b { font-family: var(--font-display); font-size: 20px; letter-spacing: -.04em; }
.board-risk.error .risk-score b { color: var(--color-error); }
.board-risk.warn .risk-score b { color: #a86a12; }
.board-risk.accent .risk-score b { color: var(--color-accent); }
.board-risk.ok .risk-score b { color: var(--color-ok); }
.risk-score small { font-size: 9px; color: var(--color-faint); margin-left: 2px; }
.risk-detail { min-width: 0; display: grid; gap: 2px; }
.risk-detail small { font-size: 9px; color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline { position: relative; margin: 0; padding: 0 0 0 20px; list-style: none; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 1px; background: var(--color-border-strong); }
.timeline li { position: relative; padding: 0 0 14px; font-size: 11px; }
.timeline li::before { content: ""; position: absolute; left: -19px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--color-surface); border: 2px solid var(--color-accent); }
.timeline li.milestone::before { background: var(--color-ok); border-color: var(--color-ok); }
.timeline li.exception::before { border-color: var(--color-error); }
.timeline li time { color: var(--color-faint); font-size: 10px; margin-right: 8px; }
.milestone-row { display: grid; grid-template-columns: 70px 1fr 120px 110px 90px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--color-border); font-size: 11px; }
.milestone-row input, .milestone-row select { font-size: 10px; padding: 4px 6px; }

/* ---------- risk ---------- */
.disclaimer { padding: 10px 12px; border: 1px dashed var(--color-border-strong); border-radius: var(--radius-sm); background: rgba(217,79,43,.05); font-size: 11px; color: var(--color-muted); margin-bottom: 16px; }
.risk-card { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); padding: 12px 14px; margin-bottom: 10px; }
.risk-head { display: flex; align-items: center; gap: 12px; }
.risk-score { font-family: var(--font-display); font-size: 22px; min-width: 56px; text-align: center; border-right: 1px solid var(--color-border); padding-right: 10px; }
.risk-factors { display: grid; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--color-border); }
.risk-factor { display: grid; grid-template-columns: 110px 1fr 44px; gap: 8px; font-size: 10px; }
.risk-factor b { color: var(--color-accent); text-align: right; }
.risk-card { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.risk-card.selected { border-color: var(--color-accent); box-shadow: 0 0 0 2px var(--color-accent-soft); }

/* ---------- risk radar ---------- */
.radar-layout { display: grid; grid-template-columns: minmax(280px, 340px) 1fr; gap: 20px; align-items: center; }
.radar-chart { display: flex; align-items: center; justify-content: center; min-height: 300px; }
.radar-svg { width: 100%; max-width: 320px; height: auto; overflow: visible; }
.radar-ring { fill: none; stroke: var(--color-border); stroke-width: 1; }
.radar-spoke { stroke: var(--color-border); stroke-width: 1; }
.radar-shape { fill: var(--color-accent-soft); stroke: var(--color-accent); stroke-width: 2; stroke-linejoin: round; }
.radar-dot { fill: var(--color-accent); }
.radar-label { font-family: var(--font-serif); font-size: 10px; fill: var(--color-muted); }
.radar-side { display: grid; gap: 12px; align-content: center; }
.radar-summary { display: flex; align-items: baseline; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--color-border); font-size: 11px; color: var(--color-muted); }
.radar-summary b { font-family: var(--font-display); font-size: 28px; color: var(--color-text); letter-spacing: -.03em; margin-left: auto; }
.radar-bars { display: grid; gap: 7px; }
.radar-bar { display: grid; grid-template-columns: 88px 1fr 34px; gap: 8px; align-items: center; font-size: 10px; }
.radar-bar span { color: var(--color-muted); }
.radar-bar b { text-align: right; font-family: var(--font-mono); color: var(--color-accent); }
.radar-bar-track { height: 7px; border-radius: 999px; background: var(--color-surface-2); border: 1px solid var(--color-border); overflow: hidden; }
.radar-bar-track i { display: block; height: 100%; background: var(--color-accent); border-radius: 999px; }
@media (max-width: 900px) { .radar-layout { grid-template-columns: 1fr; } }

/* ---------- charts ---------- */
.legend { display: flex; gap: 12px; font-size: 10px; color: var(--color-muted); flex-wrap: wrap; }

/* ---------- record pagination ---------- */
.pager-slot { margin-top: 10px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; padding-top: 10px; border-top: 1px dashed var(--color-border); }
.pager-info { font-size: 11px; color: var(--color-muted); font-family: var(--font-mono); }
.pager-info b { color: var(--color-text); font-weight: 600; }
.pager-size { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--color-muted); }
.pager-size select { width: auto; min-width: 58px; padding: 4px 6px; font-size: 11px; }
.pager-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager-actions .btn { min-width: 34px; padding: 4px 8px; }
.pager-actions .btn:disabled { opacity: .4; cursor: not-allowed; }
.pager-ellipsis { padding: 0 2px; color: var(--color-muted); font-size: 11px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .grid-intake { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .story-strip { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .story-step:nth-child(3n) { border-right: 0; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { grid-template-columns: repeat(3,1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .story-strip { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .story-step:nth-child(3n) { border-right: 1px solid var(--color-border); }
  .story-step:nth-child(2n) { border-right: 0; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .nav { grid-template-columns: repeat(2,1fr); }
  .site-header { padding: 10px 14px; }
  .content { padding: 16px 14px; }
  .draft-grid { grid-template-columns: 1fr; }
  .story-strip { grid-template-columns: 1fr; }
  .story-step { border-right: 0; border-bottom: 1px solid var(--color-border); }
  .story-step:last-child { border-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ==========================================================================
   视觉精修层 — 卡片行距对齐 + 去 AI 化（工业实用风 Industrial/utilitarian）
   设计意图：数据表格数字化、徽章硬边化、卡片去统一悬浮阴影、行距节奏统一。
   刻意规避 AI 常见的"统一圆角卡片 + 统一阴影 + 胶囊徽章 + 逐字换行"模板感。
   本层覆盖式追加，集中管理，便于整体回滚。
   ========================================================================== */

/* -- 1. 短字段禁止逐字换行：这是表格"行距锯齿"的头号来源。
       white-space:nowrap 会让浏览器在 auto 表格布局下自动加宽该列，
       宁可横向滚动，也不要把「已确认」拆成一列竖排。 -- */
.badge, .link, .status-chip, .btn { white-space: nowrap; }
td.number, th.number { white-space: nowrap; }

/* -- 2. 表格：统一行高与数字等宽，消除参差行高，数值右对齐可读 -- */
table.data { min-width: 720px; }
table.data th, table.data td { line-height: 1.45; vertical-align: middle; }
table.data td.number, table.data th.number,
.kpi strong, .risk-score b, .radar-summary b, .gauge-top b, .donut-hole strong,
.pager-info, .pager-size, .col-value { font-variant-numeric: tabular-nums lining-nums; }
/* 数据表格：所有单元格单行，杜绝中文逐字竖排；超长文本由列内省略号收口。
   .table-wrap 已有 overflow:auto，列变宽时横向滚动而非破坏行高。 */
table.data td { white-space: nowrap; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
table.data td.number, table.data td.nowrap { max-width: none; }
/* 明确需要换行的长文本列（详情/备注）用 .cell-wrap 放行 */
table.data td.cell-wrap { white-space: normal; min-width: 140px; word-break: break-word; }
/* 链接/徽章本身不参与单元格省略，保证「详情」「已确认」完整可见 */
table.data td > .link, table.data td > .badge, table.data td.actions .btn { max-width: none; }
/* 末列（操作）吸附右侧：列多需横滚时，操作始终可达，不必滚到尽头。
   表头同列吸附并抬高 z-index；hover 行同步背景，避免 sticky 列露出断层。 */
table.data th:last-child, table.data td:last-child {
  position: sticky; right: 0; z-index: 2;
  background: var(--color-surface); box-shadow: -1px 0 0 var(--color-border);
}
table.data th:last-child { background: var(--color-surface-2); z-index: 3; }
table.data tbody tr:hover td:last-child { background: rgba(217,79,43,.05); }

/* -- 3. 看板卡片等高：公司名/订单号单行省略，卡片高度不再参差 -- */
.board-card b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-card .meta, .board-risk .risk-detail small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-risk { gap: 10px; }
.risk-score b { line-height: 1; }

/* -- 4. 去 AI 化：徽章由胶囊改为工业方角，弱化"软"感与居中圆点 -- */
.badge { border-radius: 2px; padding: 2px 8px; letter-spacing: .02em; }
.status-chip { border-radius: 3px; }
.dot, .badge .dot { border-radius: 1px; }

/* -- 5. 去 AI 化：常规内容卡片去统一悬浮阴影，改用发丝边框建立层级；
       hover 才给极轻反馈。暗色输出终端 / 抽屉 / 弹层保留阴影（层级隐喻）。 -- */
.panel, .kpi, .risk-card, .board-card, .login-card { box-shadow: none; }
.panel, .login-card { border-radius: 6px; }
.kpi, .risk-card, .board-card { border-radius: 4px; }
.panel:hover { box-shadow: 0 1px 3px rgba(27,26,23,.07); }

/* -- 6. 卡片内部行距节奏统一：4px 基准，标题/数值/脚注基线成体系 -- */
.panel-head { margin-bottom: 16px; }
.panel-head h2 { line-height: 1.3; }
.panel-head small { line-height: 1.4; }
.kpi { padding: 15px 16px 14px; }
.kpi span { line-height: 1.4; }
.kpi strong { line-height: 1.1; margin-top: 8px; }
.kpi small { line-height: 1.4; margin-top: 6px; }
.kpi-grid-5 .kpi { min-height: 112px; }
.story-step { padding: 12px 14px; }
.story-step b, .story-step span, .story-step small { display: block; line-height: 1.5; }
.master-tabs button { padding: 10px 12px; }

/* -- 7. 表单字段行距：标签与控件的垂直节奏统一 -- */
.field { gap: 5px; line-height: 1.4; }
.field input, .field select, .field textarea { line-height: 1.45; }
.form-grid { gap: 14px; }
