/* =========================================================
   序衡 · 生产智能排程平台 — 应用壳 / 五视图
   工程绘图纸 · 钢蓝 · 安全橙
   ========================================================= */
:root { --sched-side: 220px; }
body { overflow-x: hidden; }
.app-shell-sched { min-height: 100vh; position: relative; z-index: 2; }

.sched-sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sched-side); z-index: 120;
  display: flex; flex-direction: column; color: #eef1f6;
  background:
    radial-gradient(circle at 0 0, rgba(232,93,42,.12), transparent 34%),
    linear-gradient(180deg, #1b2c48, #101b2d 78%);
  border-right: 1px solid rgba(232,93,42,.22);
}
.sched-sidebar::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .32; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px); background-size: 22px 22px; }
.sched-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 21px 17px 15px; }
.sched-mark { width: 36px; height: 36px; display: grid; place-items: center; background: var(--orange); color: #fff; font-family: var(--sans); font-size: 19px; font-weight: 800; box-shadow: 4px 4px 0 rgba(232,93,42,.2); }
.sched-brand strong { display: block; font-family: var(--sans); font-size: 20px; letter-spacing: 4px; line-height: 1.1; }
.sched-brand small { display: block; font-family: var(--mono); font-size: 6.5px; color: rgba(238,241,246,.36); letter-spacing: .8px; margin-top: 3px; }
.sched-entity { position: relative; z-index: 1; margin: 0 15px 16px; padding: 9px 10px; border: 1px solid rgba(232,93,42,.16); background: rgba(232,93,42,.035); }
.sched-entity span { display: block; font-size: 9px; color: rgba(238,241,246,.72); }
.sched-entity b { display: block; font-family: var(--mono); font-size: 6.5px; font-weight: 400; color: rgba(238,241,246,.35); margin-top: 2px; }
.sched-nav { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 9px; }
.sched-nav button { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 9px; text-align: left; padding: 10px; color: rgba(238,241,246,.55); border-left: 2px solid transparent; transition: .2s; }
.sched-nav button span { font-family: var(--mono); font-size: 7px; color: rgba(238,241,246,.28); }
.sched-nav button b { font-size: 12px; font-weight: 400; letter-spacing: .4px; }
.sched-nav button i { font-family: var(--mono); font-style: normal; font-size: 5.4px; color: rgba(238,241,246,.17); letter-spacing: .4px; }
.sched-nav button:hover { color: #fff; background: rgba(232,93,42,.06); }
.sched-nav button.active { color: #ffb08a; border-left-color: var(--orange); background: linear-gradient(90deg, rgba(232,93,42,.16), transparent); }
.sched-nav button.active span { color: #ffb08a; }
.sched-nav button.active i { color: rgba(255,176,138,.5); }
.sched-side-bottom { position: relative; z-index: 1; margin-top: auto; padding: 14px 13px 16px; }
.sched-ai-btn { width: 100%; display: grid; grid-template-columns: 23px 1fr auto; align-items: center; gap: 8px; text-align: left; padding: 9px; border: 1px solid rgba(232,93,42,.25); background: rgba(232,93,42,.05); color: #ffb08a; }
.sched-ai-btn > span:first-child { font-size: 13px; }
.sched-ai-btn b { display: block; font-size: 8.5px; font-weight: 400; color: #eef1f6; }
.sched-ai-btn small { display: block; font-size: 5.8px; color: rgba(238,241,246,.34); margin-top: 1px; }
.sched-ai-btn em { font-style: normal; font-size: 11px; }
.sched-user { display: grid; grid-template-columns: 27px 1fr 8px; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(232,93,42,.12); }
.sched-avatar { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid rgba(232,93,42,.4); color: #ffb08a; font-family: var(--sans); font-size: 12px; }
.sched-user b { display: block; font-size: 8.5px; font-weight: 400; color: #eef1f6; }
.sched-user small { display: block; font-size: 5.8px; color: rgba(238,241,246,.3); margin-top: 1px; }
.sched-user i { width: 5px; height: 5px; border-radius: 50%; background: #5bc99a; }

.sched-main { margin-left: var(--sched-side); min-width: 0; }
.sched-topbar { position: sticky; top: 0; z-index: 90; height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 25px; background: rgba(242,239,230,.93); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line-strong); }
.sched-crumb { display: flex; align-items: center; gap: 8px; font-size: 10px; color: var(--muted); }
.sched-crumb span { font-family: var(--mono); font-size: 7.5px; }
.sched-crumb i { font-style: normal; color: var(--line-strong); }
.sched-crumb b { font-family: var(--sans); font-size: 14px; color: var(--ink); letter-spacing: .5px; }
.sched-actions { display: flex; align-items: center; gap: 12px; }
.sched-asof { font-family: var(--mono); font-size: 6.8px; color: var(--muted-2); }
.sched-role { display: flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 6.2px; color: var(--muted-2); }
.sched-role select { border: 1px solid var(--line); background: transparent; padding: 4px 6px; color: var(--ink); font-family: var(--body); font-size: 8.5px; outline: none; }
.sched-ai-top { display: flex; align-items: center; gap: 5px; border: 1px solid rgba(36,84,214,.3); padding: 5px 8px; color: var(--blue); font-size: 8.5px; background: rgba(36,84,214,.04); }
.sched-top-avatar { width: 26px; height: 26px; display: grid; place-items: center; background: var(--navy); color: #fff; font-family: var(--sans); font-size: 12px; }
.sched-content { max-width: 1600px; margin: 0 auto; padding: 23px 26px 56px; }
.view { display: none; animation: sIn .32s ease; }
.view.active { display: block; }
@keyframes sIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.sched-view { max-width: none; margin: 0; padding: 0; }
.sched-view .board-head { margin-bottom: 16px; }
.sched-view .section-head { margin-bottom: 24px; }
.sched-head { display: grid; grid-template-columns: 1.05fr .95fr; gap: 36px; align-items: end; margin-bottom: 18px; }
.sched-head h1 { font-size: clamp(38px, 4vw, 56px); line-height: 1.03; }
.sched-head h1 span { color: var(--orange); position: relative; white-space: nowrap; background: linear-gradient(transparent 72%, rgba(232,93,42,.18) 72%); padding: 0 2px; }
.sched-side { display: flex; align-items: flex-end; gap: 20px; padding-bottom: 3px; }
.sched-side p { max-width: 460px; font-size: 10px; line-height: 1.85; color: var(--muted); }
.sched-stamp { flex: 0 0 auto; border-left: 1px solid var(--line-strong); padding-left: 15px; }
.sched-stamp span { display: block; font-family: var(--mono); font-size: 6.5px; color: var(--muted-2); }
.sched-stamp strong { font-family: var(--sans); font-size: 31px; line-height: 1.08; color: var(--orange); letter-spacing: -1px; }
.sched-stamp em { display: block; font-style: normal; font-size: 7px; color: var(--muted-2); }
.sched-view .kpi-row { margin-bottom: 8px; }

/* overview */
.sched-ov-grid { display: grid; grid-template-columns: 1.35fr .8fr .8fr; gap: 8px; margin-top: 8px; }
.sched-ai-panel { grid-column: 1 / -1; }
.sched-load-panel, .sched-critical-panel, .sched-approvals-panel, .sched-audit-panel { min-height: 210px; }
.sched-load-body { padding: 9px 14px 8px; }
.sched-load-row { display: grid; grid-template-columns: 70px 1fr 42px; gap: 8px; align-items: center; margin-bottom: 8px; }
.sched-load-row span { font-size: 7.5px; color: var(--muted); }
.sched-load-track { height: 8px; background: rgba(22,34,56,.07); }
.sched-load-track i { display: block; height: 100%; background: var(--blue); }
.sched-load-track i.hot { background: var(--orange); }
.sched-load-row b { font-family: var(--mono); font-size: 7px; font-weight: 400; text-align: right; }
.sched-critical-body { padding: 2px 12px 7px; }
.sched-critical-row { display: grid; grid-template-columns: 1fr auto; gap: 7px; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(22,34,56,.07); cursor: pointer; }
.sched-critical-row:last-child { border-bottom: 0; }
.sched-critical-row b { display: block; font-size: 8.5px; font-weight: 500; }
.sched-critical-row span { display: block; font-family: var(--mono); font-size: 6.3px; color: var(--muted-2); margin-top: 1px; }
.sched-critical-row em { font-family: var(--mono); font-style: normal; font-size: 6.5px; color: var(--orange); white-space: nowrap; }
.sched-approval-list { padding: 3px 12px 7px; }
.sched-approval-list.compact { max-height: 115px; overflow: auto; }
.sched-approval-row { display: grid; grid-template-columns: 1fr auto; gap: 7px; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(22,34,56,.07); }
.sched-approval-row:last-child { border-bottom: 0; }
.sched-approval-main b { display: block; font-size: 8.5px; font-weight: 500; }
.sched-approval-main span { display: block; font-family: var(--mono); font-size: 6.2px; color: var(--muted-2); margin-top: 1px; }
.sched-approval-row button { font-size: 7px; padding: 3px 6px; border: 1px solid var(--line); color: var(--muted); }
.sched-approval-row button.ok { color: var(--green); border-color: rgba(47,125,90,.35); }
.sched-approval-row button:disabled { opacity: .4; cursor: not-allowed; }
.sched-empty { padding: 15px 0; text-align: center; font-size: 7px; color: var(--muted-2); }
.sched-audit-list { padding: 2px 12px 6px; }
.sched-audit-row { display: grid; grid-template-columns: 48px 1fr auto; gap: 6px; align-items: start; padding: 5px 0; border-bottom: 1px solid rgba(22,34,56,.07); }
.sched-audit-row:last-child { border-bottom: 0; }
.sched-audit-time { font-family: var(--mono); font-size: 6px; color: var(--muted-2); padding-top: 2px; }
.sched-audit-main b { display: block; font-size: 7.5px; font-weight: 500; }
.sched-audit-main span { display: block; font-size: 6.2px; color: var(--muted-2); margin-top: 1px; }
.sched-audit-status { font-family: var(--mono); font-size: 5.8px; padding: 2px 4px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.sched-audit-status.good { color: var(--green); border-color: rgba(47,125,90,.3); }
.sched-audit-status.warn { color: #a9782f; border-color: rgba(201,151,46,.35); }
.sched-ai-body { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; padding: 9px 13px 10px; }
.sched-ai-item { display: grid; grid-template-columns: 14px 1fr; gap: 5px; font-size: 7.5px; line-height: 1.6; color: var(--muted); }
.sched-ai-item i { font-family: var(--mono); font-style: normal; font-size: 6px; color: var(--orange); padding-top: 2px; }
.sched-ai-item b { color: var(--ink); font-weight: 500; }

/* order pool */
.pool-panel { min-height: 420px; }
.filter-chips { display: flex; gap: 4px; }
.filter-chips button { font-size: 7px; padding: 4px 7px; border: 1px solid var(--line); color: var(--muted); }
.filter-chips button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.pool-head, .pool-row { display: grid; grid-template-columns: 1.1fr 2fr .5fr .6fr .6fr .9fr .7fr .7fr .6fr; gap: 6px; align-items: center; padding: 6px 13px; }
.pool-head { border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 6px; color: var(--muted-2); }
.pool-row { border-bottom: 1px solid rgba(22,34,56,.06); font-family: var(--mono); font-size: 7px; color: var(--muted); cursor: pointer; }
.pool-row:hover { background: rgba(36,84,214,.035); }
.pool-row b { color: var(--ink); font-weight: 400; }
.pool-row .name { font-family: var(--body); font-size: 7.5px; }
.pool-row .bad { color: var(--orange); }
.pool-row .warn { color: #a9782f; }
.pool-row .good { color: var(--green); }
.pool-risk { font-family: var(--mono); font-size: 6px; padding: 2px 4px; border: 1px solid var(--line); white-space: nowrap; }
.pool-risk.high { color: var(--orange); border-color: rgba(232,93,42,.35); }
.pool-risk.mid { color: #a9782f; border-color: rgba(201,151,46,.35); }
.pool-risk.low { color: var(--green); border-color: rgba(47,125,90,.3); }
.pool-foot { padding: 7px 13px 10px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 6.5px; color: var(--muted-2); display: flex; justify-content: space-between; }
.pool-foot b { color: var(--ink); font-weight: 400; }

/* execution */
.exec-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) 350px; gap: 8px; align-items: start; }
.exec-table-panel { min-height: 470px; }
.exec-head, .exec-row { display: grid; grid-template-columns: 1fr 1.5fr .6fr .6fr .6fr .7fr .7fr; gap: 6px; align-items: center; padding: 6px 13px; }
.exec-head { border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 6px; color: var(--muted-2); }
.exec-row { border-bottom: 1px solid rgba(22,34,56,.06); font-family: var(--mono); font-size: 7px; color: var(--muted); }
.exec-row b { color: var(--ink); font-weight: 400; }
.exec-row .bad { color: var(--orange); }
.exec-row .good { color: var(--green); }
.exec-row button { font-size: 6.5px; padding: 3px 5px; border: 1px solid var(--line); color: var(--muted); }
.exec-row button:disabled { opacity: .4; }
.exec-chart-head { border-top: 1px solid var(--line); margin-top: 4px; padding: 7px 13px 0; font-family: var(--mono); font-size: 6.3px; color: var(--muted-2); }
.exec-chart { height: 140px; padding: 5px 13px 4px; }
.exec-chart svg { width: 100%; height: 100%; }
.exec-side { min-height: 470px; }
.exec-alerts { padding: 3px 12px 6px; }
.exec-alert { display: grid; grid-template-columns: 6px 1fr auto; gap: 6px; align-items: start; padding: 6px 0; border-bottom: 1px solid rgba(22,34,56,.07); }
.exec-alert i { width: 5px; height: 5px; border-radius: 50%; margin-top: 4px; background: var(--orange); }
.exec-alert b { display: block; font-size: 8px; font-weight: 500; }
.exec-alert span { display: block; font-family: var(--mono); font-size: 6.1px; color: var(--muted-2); margin-top: 1px; }
.exec-alert em { font-family: var(--mono); font-style: normal; font-size: 6px; color: var(--orange); }
.exec-compare { margin-top: 8px; }
.exec-compare-body { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 14px; padding: 9px 13px 11px; }
.exec-compare-body div { border-left: 1px solid var(--line); padding-left: 9px; }
.exec-compare-body span { display: block; font-family: var(--mono); font-size: 6px; color: var(--muted-2); }
.exec-compare-body b { display: block; font-family: var(--sans); font-size: 17px; margin-top: 1px; }
.exec-compare-body em { display: block; font-style: normal; font-size: 6.5px; color: var(--muted); margin-top: 1px; }

/* capacity lower */
.capacity-lower { display: grid; grid-template-columns: 1.2fr 1fr; gap: 8px; margin-top: 8px; }
.changeover-impact-panel, .capacity-action-panel { min-height: 190px; }
.changeover-impact { padding: 4px 13px 8px; }
.co-impact-row { display: grid; grid-template-columns: 1fr .7fr .7fr 1.2fr; gap: 7px; align-items: center; padding: 5px 0; border-bottom: 1px solid rgba(22,34,56,.06); font-family: var(--mono); font-size: 7px; color: var(--muted); }
.co-impact-row b { color: var(--ink); font-weight: 400; }
.co-impact-row .bad { color: var(--orange); }
.co-impact-row .good { color: var(--green); }
.capacity-actions { padding: 4px 13px 8px; }
.capacity-action { display: grid; grid-template-columns: 18px 1fr auto; gap: 7px; align-items: start; padding: 6px 0; border-bottom: 1px solid rgba(22,34,56,.06); }
.capacity-action i { font-family: var(--mono); font-style: normal; font-size: 6.5px; color: var(--orange); padding-top: 2px; }
.capacity-action b { display: block; font-size: 8.5px; font-weight: 500; }
.capacity-action span { display: block; font-size: 6.8px; color: var(--muted-2); margin-top: 1px; }
.capacity-action em { font-family: var(--mono); font-style: normal; font-size: 6.2px; color: var(--green); white-space: nowrap; }

/* copilot */
.copilot-backdrop { position: fixed; inset: 0; z-index: 220; background: rgba(16,27,45,.45); opacity: 0; pointer-events: none; transition: .25s; }
.copilot-backdrop.open { opacity: 1; pointer-events: auto; }
.copilot { position: fixed; right: 0; top: 0; bottom: 0; width: min(390px, 92vw); z-index: 230; background: var(--card); border-left: 1px solid var(--line-strong); transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; box-shadow: -20px 0 60px rgba(22,34,56,.22); }
.copilot.open { transform: none; }
.copilot-head { display: flex; align-items: center; gap: 9px; padding: 14px; border-bottom: 1px solid var(--line); background: var(--navy); color: #fff; }
.copilot-avatar { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(232,93,42,.45); color: #ffb08a; }
.copilot-head h3 { font-family: var(--sans); font-size: 14px; }
.copilot-head span { display: block; font-size: 6.5px; color: rgba(255,255,255,.5); margin-top: 1px; }
.copilot-head button { margin-left: auto; color: rgba(255,255,255,.7); font-size: 24px; line-height: 1; }
.chat-log { flex: 1; overflow: auto; padding: 13px; display: flex; flex-direction: column; gap: 9px; }
.chat-msg { max-width: 92%; padding: 8px 10px; font-size: 8px; line-height: 1.7; }
.chat-msg.ai { align-self: flex-start; background: rgba(36,84,214,.05); border-left: 2px solid var(--blue); color: var(--muted); }
.chat-msg.user { align-self: flex-end; background: var(--navy); color: #fff; }
.chat-msg b { color: var(--ink); }
.chat-msg.user b { color: #fff; }
.chat-cite { display: block; margin-top: 5px; font-family: var(--mono); font-size: 6px; color: var(--blue); border-top: 1px dashed var(--line); padding-top: 4px; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 13px 9px; }
.chat-suggestions button { font-size: 7px; padding: 4px 6px; border: 1px solid var(--line); color: var(--muted); }
.chat-suggestions button:hover { border-color: var(--blue); color: var(--blue); }
.chat-form { display: flex; border-top: 1px solid var(--line); padding: 9px 11px; gap: 6px; }
.chat-form input { flex: 1; border: 1px solid var(--line); background: transparent; padding: 8px 9px; font-size: 8px; outline: none; }
.chat-form input:focus { border-color: var(--blue); }
.chat-form button { background: var(--navy); color: #fff; font-size: 8px; padding: 0 11px; }
.chat-note { padding: 0 13px 11px; font-size: 6px; line-height: 1.55; color: var(--muted-2); }

/* readability */
.sched-side p { font-size: 10.5px; }
.sched-nav button b { font-size: 12.5px; }
.sched-critical-row b, .sched-approval-main b, .exec-alert b { font-size: 9px; }
.sched-critical-row span, .sched-approval-main span, .exec-alert span { font-size: 6.8px; }
.sched-ai-item { font-size: 8px; }
.pool-row { font-size: 7.5px; }
.chat-msg { font-size: 9px; }

@media (max-width: 1240px) {
  :root { --sched-side: 200px; }
  .sched-content { padding: 21px 19px 48px; }
  .sched-ov-grid { grid-template-columns: 1.2fr 1fr; }
  .sched-audit-panel { grid-column: 1 / -1; }
  .exec-grid { grid-template-columns: minmax(0, 1.35fr) 320px; }
  .capacity-lower { grid-template-columns: 1fr; }
}
@media (max-width: 1020px) {
  :root { --sched-side: 0px; }
  .sched-sidebar { transform: translateX(-100%); }
  .sched-main { margin-left: 0; }
  .sched-head { grid-template-columns: 1fr; gap: 10px; }
  .sched-side { align-items: flex-start; }
  .sched-ov-grid { grid-template-columns: 1fr 1fr; }
  .exec-grid { grid-template-columns: 1fr; }
  .exec-side { min-height: 0; }
  .pool-head, .pool-row { grid-template-columns: 1.1fr 1.8fr .5fr .7fr .9fr .7fr .7fr; }
  .pool-head span:nth-child(4), .pool-head span:nth-child(7),
  .pool-row span:nth-child(4), .pool-row span:nth-child(7) { display: none; }
}
@media (max-width: 680px) {
  .sched-topbar { height: 56px; padding: 0 13px; }
  .sched-asof, .sched-role, .sched-ai-top { display: none; }
  .sched-content { padding: 16px 12px 40px; }
  .sched-head h1 { font-size: 38px; }
  .sched-ov-grid, .sched-ai-body, .exec-compare-body { grid-template-columns: 1fr; }
  .capacity-lower { grid-template-columns: 1fr; }
  .sched-ai-panel { grid-column: auto; }
  .pool-head, .pool-row { grid-template-columns: 1.1fr 1.8fr .6fr .8fr .7fr; }
  .pool-head span:nth-child(3), .pool-head span:nth-child(4), .pool-head span:nth-child(7), .pool-head span:nth-child(9),
  .pool-row span:nth-child(3), .pool-row span:nth-child(4), .pool-row span:nth-child(7), .pool-row span:nth-child(9) { display: none; }
  .exec-head, .exec-row { grid-template-columns: 1.1fr 1.4fr .6fr .6fr .7fr; }
  .exec-head span:nth-child(5), .exec-head span:nth-child(7),
  .exec-row span:nth-child(5), .exec-row span:nth-child(7) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
