:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #047857;
  --danger: #b91c1c;
  --warning: #a16207;
  --background: #f4f7fb;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --foreground: #0f172a;
  --muted: #526174;
  --border: #dbe5f2;
  --border-strong: #c4d2e3;
  --sidebar: #0b1f3a;
  --sidebar-muted: #9fb0c6;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --success-text: #065f46;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --error-text: #991b1b;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 12px;
  --sidebar-width: 236px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--foreground);
  background: var(--background);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--background); }
body { margin: 0; min-height: 100vh; font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { touch-action: manipulation; }
svg { width: 20px; height: 20px; fill: currentColor; flex: 0 0 auto; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0, #e9f2ff 0, var(--background) 52%); }
.login-card { width: min(430px, 100%); padding: 34px; border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: 0 24px 60px rgba(15,23,42,.12); }
.login-brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 12px; color: #dbeafe; background: var(--sidebar); }
.login-brand-mark svg { width: 30px; height: 30px; }
.login-eyebrow { margin: 22px 0 4px; color: var(--primary-dark); font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.login-card h1 { margin: 0; font-size: 28px; line-height: 1.3; }
.login-intro { margin: 10px 0 24px; color: var(--muted); }
.login-form { display: grid; gap: 16px; }
.login-form .button { width: 100%; min-height: 48px; margin-top: 2px; }
.login-help { margin: 18px 0 0; color: var(--muted); font-size: 13px; text-align: center; }

.direct-open-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top, #e8f1ff 0, var(--background) 48%); }
.direct-open-card { width: min(620px, 100%); padding: 34px; border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: 0 18px 50px rgba(15,23,42,.12); }
.direct-open-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 12px; color: #92400e; background: #fef3c7; }
.direct-open-icon svg { width: 28px; height: 28px; }
.direct-open-eyebrow { margin: 20px 0 4px; color: #b45309; font-size: 13px; font-weight: 800; letter-spacing: .06em; }
.direct-open-card h1 { margin: 0; font-size: clamp(24px, 4vw, 32px); line-height: 1.3; }
.direct-open-card > p:not(.direct-open-eyebrow):not(.direct-open-safe) { margin: 14px 0 22px; color: var(--muted); }
.direct-open-button { width: 100%; min-height: 48px; text-decoration: none; }
.direct-open-steps { margin-top: 22px; padding: 16px 18px; border-left: 4px solid var(--primary); background: #eff6ff; color: #1e3a5f; }
.direct-open-steps ol { margin: 8px 0 0; padding-left: 20px; }
.direct-open-steps li + li { margin-top: 5px; }
.direct-open-safe { margin: 16px 0 0; color: #047857; font-size: 13px; font-weight: 700; }

.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 14px; transform: translateY(-150%); background: #fff; color: var(--primary-dark); border: 2px solid var(--primary); border-radius: 8px; }
.skip-link:focus { transform: translateY(0); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }

.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 14px 18px; background: var(--sidebar); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; color: #dbeafe; background: rgba(37,99,235,.35); }
.brand-mark svg { width: 25px; height: 25px; }
.brand strong, .brand small { display: block; }
.brand strong span { display: block; }
.brand strong { font-size: 16px; letter-spacing: .02em; }
.brand small { margin-top: 2px; color: var(--sidebar-muted); font-size: 12px; }
.nav-list { display: grid; gap: 6px; padding-top: 20px; }
.nav-item { min-height: 46px; display: flex; align-items: center; gap: 12px; width: 100%; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: #c9d6e7; text-align: left; cursor: pointer; transition: background-color 180ms ease, color 180ms ease; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: #1e4f91; color: #fff; font-weight: 600; }
.nav-item:focus-visible, .button:focus-visible, .icon-button:focus-visible, .text-button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.sidebar-footer { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.12); color: var(--sidebar-muted); }
.local-badge { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; color: #d8e6f7; font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52,211,153,.12); }
.sidebar-footer small { font-size: 12px; }

.content-shell { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 82px; display: flex; align-items: center; gap: 20px; padding: 14px 28px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border); backdrop-filter: blur(10px); }
.topbar-title { min-width: 190px; }
.topbar-title h1 { margin: 0; font-size: 22px; line-height: 1.25; }
.topbar-title p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.current-user { min-height: 44px; display: flex; align-items: center; gap: 10px; padding-left: 12px; border-left: 1px solid var(--border); }
.current-user span, .current-user strong, .current-user small { display: block; }
.current-user strong { max-width: 120px; overflow: hidden; color: #1e3a5f; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.current-user small { color: var(--muted); font-size: 11px; }
.current-user .text-button { min-height: 34px; padding: 0 8px; color: var(--primary-dark); background: transparent; font-weight: 700; }
.button, .icon-button, .text-button { border: 0; cursor: pointer; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 8px; font-weight: 600; white-space: nowrap; transition: background-color 180ms ease, border-color 180ms ease, opacity 180ms ease; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { background: #fff; color: #1e3a5f; border: 1px solid var(--border-strong); }
.button.secondary:hover { background: #f1f5f9; }
.button.danger-secondary { color: var(--danger); background: #fff; border: 1px solid #fca5a5; }
.button.danger-secondary:hover { color: #991b1b; background: #fef2f2; border-color: #ef4444; }
.button:disabled { cursor: not-allowed; opacity: .52; }
.badge { display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.success { background: #d1fae5; color: #065f46; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.badge.warning { background: #fef3c7; color: #854d0e; }
.badge.neutral { background: #eef2f7; color: #475569; }

body:not(.can-schedule) #import-button,
body:not(.can-schedule) #run-button,
body:not(.can-schedule) #publish-button,
body:not(.can-schedule) #add-order,
body:not(.can-schedule) #open-reorder,
body:not(.can-schedule) #add-event,
body:not(.can-schedule) #open-overtime-range,
body:not(.can-schedule) #open-baseline,
body:not(.can-schedule) [data-change-order],
body:not(.can-schedule) [data-reverse-change],
body:not(.can-schedule) [data-master-move],
body:not(.can-schedule) [data-edit-event],
body:not(.can-schedule) .parameter-actions,
body:not(.can-schedule) .parameter-capacity-form,
body:not(.can-report) #add-actual,
body:not(.can-report) [data-schedule-actual],
body:not(.can-report) [data-edit-actual],
body:not(.can-admin) .admin-only { display: none !important; }

.user-role-guide { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-subtle); }
.user-role-guide span { min-height: 68px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); background: #fff; font-size: 12px; }
.user-role-guide strong { display: block; margin-bottom: 3px; color: #1e3a5f; font-size: 13px; }
.user-editor { width: min(760px, 100%); }
.user-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.user-password-field, .user-active-field { grid-column: 1 / -1; }
.user-active-field { min-height: 64px; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-subtle); cursor: pointer; }
.user-active-field input { width: 18px; height: 18px; margin: 2px 0 0; }
.user-active-field span, .user-active-field strong, .user-active-field small { display: block; }
.user-active-field small { margin-top: 2px; color: var(--muted); }

main { padding: 24px 28px 40px; }
.page { display: none; }
.page.active { display: block; }
.notice { min-height: 58px; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid; border-radius: 10px; }
.notice svg { width: 24px; height: 24px; }
.notice strong, .notice span { display: block; }
.notice span { margin-top: 1px; font-size: 13px; }
.notice.success { color: var(--success-text); background: var(--success-bg); border-color: var(--success-border); }
.notice.danger { color: var(--error-text); background: var(--error-bg); border-color: var(--error-border); }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.metric-card { min-width: 0; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric-card span { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.metric-card strong { display: block; margin-top: 5px; font-size: 28px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.metric-card small { display: block; margin-top: 4px; color: #6b7a8d; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .7fr); gap: 18px; margin-top: 18px; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel.full-height { min-height: calc(100vh - 146px); }
.panel-header { min-height: 74px; display: flex; align-items: center; gap: 20px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.panel-header h2 { margin: 0; font-size: 17px; }
.panel-header p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.panel-header.toolbar { justify-content: space-between; }
.text-button { min-height: 40px; padding: 0 10px; color: var(--primary-dark); background: transparent; font-weight: 600; }
.text-button:hover { text-decoration: underline; }
.table-wrap { width: 100%; overflow: auto; }
.table-wrap.compact { max-height: 460px; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 5; background: #edf4fc; color: #334155; font-size: 12px; letter-spacing: .02em; }
td { font-size: 13px; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #f8fbff; }
td.number, th.number { text-align: right; }
td.note-cell { max-width: 390px; white-space: normal; line-height: 1.4; color: #475569; }
.empty-cell { padding: 36px 18px; color: var(--muted); text-align: center; }
.status-panel { align-self: start; }
.status-list { margin: 0; padding: 6px 18px 12px; }
.status-list div { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.status-list dt { color: var(--muted); font-size: 13px; }
.status-list dd { margin: 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 600; text-align: right; }
.safety-note { margin: 0 18px 18px; padding: 12px; border-left: 4px solid #60a5fa; background: #eff6ff; color: #1e3a5f; }
.safety-note strong { font-size: 13px; }
.safety-note p { margin: 3px 0 0; font-size: 12px; }
.search-field { display: grid; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
.search-field input { width: 280px; height: 38px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 7px; color: var(--foreground); background: #fff; font-size: 14px; }
.search-field input::placeholder { color: #94a3b8; }
.toolbar-controls { display: flex; align-items: end; justify-content: flex-end; gap: 16px; }
.event-toolbar { align-items: center; flex-wrap: wrap; gap: 10px; }
.schedule-toolbar { align-items: center; }
.view-switch { display: inline-flex; min-height: 42px; padding: 3px; border: 1px solid var(--border-strong); border-radius: 9px; background: #eef3f8; }
.view-switch-button { min-height: 34px; padding: 0 13px; border: 0; border-radius: 6px; color: #475569; background: transparent; font-weight: 700; cursor: pointer; transition: color 180ms ease, background-color 180ms ease, box-shadow 180ms ease; }
.view-switch-button:hover { color: var(--primary-dark); }
.view-switch-button.active { color: #1e3a5f; background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.view-switch-button:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.filter-button { white-space: nowrap; }
.filter-count { min-width: 21px; height: 21px; display: inline-grid; place-items: center; padding: 0 6px; border-radius: 999px; color: #fff; background: var(--primary); font-size: 11px; }
.filter-count[hidden] { display: none; }
.filter-panel { padding: 16px 18px 18px; border-bottom: 1px solid var(--border); background: #f8fafc; }
.filter-panel[hidden] { display: none; }
.filter-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; gap: 14px 12px; }
.filter-grid > * { min-width: 0; }
.filter-span-2 { grid-column: span 2; }
.filter-span-3 { grid-column: span 3; }
.filter-field { display: grid; gap: 5px; color: #475569; font-size: 12px; font-weight: 700; }
.filter-field input { width: 100%; min-height: 42px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--foreground); background: #fff; font-size: 14px; }
.filter-choice { position: relative; min-width: 0; }
.filter-choice summary { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; color: #334155; background: #fff; font-size: 13px; font-weight: 700; cursor: pointer; list-style: none; }
.filter-choice-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-choice summary::-webkit-details-marker { display: none; }
.filter-choice summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid #64748b; border-bottom: 2px solid #64748b; transform: translateY(-2px) rotate(45deg); transition: transform 180ms ease; }
.filter-choice[open] summary::after { transform: translateY(2px) rotate(225deg); }
.filter-choice[open] summary { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.filter-options { position: absolute; z-index: 15; top: calc(100% + 5px); left: 0; width: max(100%, 230px); max-height: 270px; overflow: auto; padding: 6px; border: 1px solid var(--border-strong); border-radius: 9px; background: #fff; box-shadow: 0 12px 30px rgba(15,23,42,.16); }
.filter-option { min-height: 40px; display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; color: #334155; font-size: 13px; cursor: pointer; }
.filter-option:hover { background: #eff6ff; }
.filter-option input, .filter-check input { width: 18px; height: 18px; accent-color: var(--primary); }
.filter-check-group { min-height: 42px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 5px 9px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; }
.filter-check-box { min-height: 42px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; }
.filter-check { min-height: 36px; display: flex; align-items: center; gap: 8px; color: #334155; font-size: 13px; font-weight: 600; cursor: pointer; }
.filter-summary { min-height: 45px; display: flex; align-items: center; gap: 10px; padding: 6px 18px; border-bottom: 1px solid var(--border); background: #fff; }
.filter-summary > strong { flex: 0 0 auto; color: #334155; font-size: 13px; }
.filter-chips { min-width: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.filter-chip { min-height: 28px; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; border: 1px solid #bfdbfe; border-radius: 999px; color: #1e40af; background: #eff6ff; font-size: 12px; }
.filter-chip button { width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border: 0; color: #475569; background: transparent; cursor: pointer; font-size: 16px; }
.filter-summary > .text-button { margin-left: auto; flex: 0 0 auto; }
.filter-choice summary:focus-visible, .filter-chip button:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.filter-toggle { min-height: 38px; display: flex; align-items: center; gap: 8px; color: #334155; font-size: 13px; font-weight: 600; white-space: nowrap; }
.filter-toggle input { width: 17px; height: 17px; accent-color: var(--primary); }
.quantity-positive { color: #0f766e; font-weight: 700; }
.quantity-complete { color: #64748b; }
.variance-short { color: var(--danger); font-weight: 700; }
.variance-over { color: var(--accent); font-weight: 700; }
.date-stale { color: var(--warning); }
.date-stale small { display: block; font-size: 11px; }
.change-early { color: #047857; font-weight: 700; }
.change-late { color: #b91c1c; font-weight: 700; }
.change-new { color: #1d4ed8; font-weight: 700; }
.change-out { color: #c2410c; font-weight: 700; }
.order-status { display: inline-flex; min-height: 26px; align-items: center; padding: 0 8px; border-radius: 999px; background: #eef2f7; color: #475569; font-size: 12px; font-weight: 700; }
.order-status.running { background: #dbeafe; color: #1e40af; }
.order-status.scheduled { background: #dcfce7; color: #166534; }
.order-status.complete { background: #f1f5f9; color: #475569; }
.order-status.cancelled { background: #fee2e2; color: #991b1b; }
.order-status.split { background: #ede9fe; color: #5b21b6; }
.progress-cell { min-width: 115px; }
.progress-track { width: 100%; height: 7px; overflow: hidden; border-radius: 999px; background: #e2e8f0; }
.progress-fill { height: 100%; border-radius: inherit; background: #2563eb; }
.progress-label { display: block; margin-top: 3px; color: #475569; font-size: 11px; text-align: right; }
.adjustment-header span, .adjustment-header small { display: block; }
.adjustment-header small { margin-top: 2px; color: #64748b; font-size: 10px; font-weight: 500; white-space: nowrap; }
.adjustment-cell { min-width: 190px; padding-top: 5px; padding-bottom: 5px; }
.order-change-button { width: 100%; min-height: 48px; display: grid; grid-template-columns: minmax(0,1fr) 18px; align-items: center; gap: 5px 8px; padding: 5px 7px; border: 1px solid transparent; border-radius: 8px; color: #1e3a5f; background: transparent; text-align: left; cursor: pointer; transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease; }
.order-change-button:hover { border-color: #bfdbfe; background: #eff6ff; }
.order-change-button:focus-visible { outline: 3px solid #93c5fd; outline-offset: 1px; }
.order-change-button svg { grid-column: 2; grid-row: 1 / span 3; width: 16px; height: 16px; color: #64748b; }
.order-change-button small { color: var(--muted); font-size: 10px; }
.change-chip { width: fit-content; max-width: 100%; display: block; overflow: hidden; padding: 2px 7px; border-radius: 999px; color: #334155; background: #e2e8f0; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.change-chip + .change-chip { margin-top: 3px; }
.change-chip.reduce { color: #92400e; background: #fef3c7; }
.change-chip.split { color: #5b21b6; background: #ede9fe; }
.change-chip.cancel { color: #991b1b; background: #fee2e2; }
.change-chip.legacy { color: #475569; background: #f1f5f9; }
.change-chip.wip-transfer { color: #1e3a8a; background: #dbeafe; }
.change-chip.wip-credit { color: #047857; background: #d1fae5; }
.change-chip.reversed { color: #475569; background: #e2e8f0; text-decoration: line-through; }
.change-empty { color: #64748b; font-size: 12px; font-weight: 600; }
.batch-cell strong, .batch-cell small { display: block; }
.batch-cell small { margin-top: 3px; color: #6d28d9; font-size: 10px; font-weight: 700; white-space: nowrap; }
.batch-cell.child-batch { position: relative; padding-left: 20px; }
.batch-cell.child-batch::before { content: ""; position: absolute; left: 8px; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; background: #a78bfa; }
.reorder-overlay { position: fixed; z-index: 90; inset: 0; padding: 18px; background: rgba(15,23,42,.62); backdrop-filter: blur(5px); }
.reorder-overlay[hidden] { display: none; }
body.reorder-open { overflow: hidden; }
.reorder-workbench { width: min(1280px, 100%); height: calc(100vh - 36px); display: grid; grid-template-rows: auto auto auto minmax(0,1fr) auto; margin: 0 auto; overflow: hidden; border-radius: 16px; background: #fff; box-shadow: 0 24px 70px rgba(15,23,42,.3); }
.reorder-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.reorder-eyebrow { margin: 0 0 3px; color: var(--primary-dark); font-size: 12px; font-weight: 800; letter-spacing: .06em; }
.reorder-header h2 { margin: 0; font-size: 22px; }
.reorder-header p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.reorder-tools { display: grid; grid-template-columns: auto minmax(370px,1fr) auto; align-items: center; gap: 18px; padding: 12px 24px; background: #f8fafc; border-bottom: 1px solid var(--border); }
.selection-summary { display: flex; align-items: center; gap: 6px; color: #334155; white-space: nowrap; }
.selection-summary strong { color: var(--primary-dark); font-size: 18px; }
.move-to-position { display: grid; grid-template-columns: auto 76px auto auto; align-items: center; justify-content: center; gap: 7px; }
.move-to-position input { width: 76px; min-height: 40px; padding: 0 9px; border: 1px solid var(--border-strong); border-radius: 7px; background: #fff; }
.move-to-position small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; text-align: center; }
.history-actions { display: flex; gap: 8px; }
.reorder-column-head, .reorder-item { display: grid; grid-template-columns: 64px 92px minmax(230px,1.5fr) minmax(110px,.7fr) minmax(90px,.65fr) minmax(105px,.7fr) minmax(105px,.7fr); align-items: center; gap: 12px; }
.reorder-column-head { min-height: 40px; padding: 0 24px; background: #edf4fc; color: #475569; font-size: 12px; font-weight: 700; }
.reorder-list { min-height: 0; margin: 0; padding: 8px 14px 24px; overflow: auto; list-style: none; background: #f4f7fb; }
.reorder-item { min-height: 64px; margin-bottom: 7px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.03); cursor: grab; transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease, transform 160ms ease; }
.reorder-item:hover { border-color: #93b4db; box-shadow: 0 5px 14px rgba(15,23,42,.07); }
.reorder-item:active { cursor: grabbing; }
.reorder-item.selected { border-color: #60a5fa; background: #eff6ff; }
.reorder-item.dragging { opacity: .45; }
.reorder-item.drop-before { border-top: 4px solid var(--primary); transform: translateY(2px); }
.reorder-select { min-width: 44px; min-height: 44px; display: grid; place-items: center; }
.reorder-select input { width: 19px; height: 19px; accent-color: var(--primary); }
.reorder-rank { display: flex; align-items: center; gap: 9px; font-variant-numeric: tabular-nums; }
.drag-handle { width: 28px; color: #64748b; font-size: 20px; line-height: 1; letter-spacing: -4px; user-select: none; }
.reorder-rank strong { font-size: 17px; }
.reorder-order strong, .reorder-order span, .reorder-order small { display: block; }
.reorder-order span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.reorder-order small { margin-top: 2px; color: #6d28d9; font-size: 10px; font-weight: 700; }
.reorder-value { overflow-wrap: anywhere; font-size: 13px; }
.reorder-quantity { color: #0f766e; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.reorder-drop-end { min-height: 48px; display: grid; place-items: center; border: 2px dashed var(--border-strong); border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.65); }
.reorder-drop-end.drop-before { border-color: var(--primary); color: var(--primary-dark); background: #eff6ff; }
.reorder-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 24px; border-top: 1px solid var(--border); background: #fff; }
.reorder-footer strong, .reorder-footer span { display: block; }
.reorder-footer span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.reorder-footer-actions { display: flex; gap: 10px; }
.order-editor-overlay { position: fixed; z-index: 95; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(15,23,42,.62); backdrop-filter: blur(5px); }
.order-editor-overlay[hidden] { display: none; }
body.order-editor-open { overflow: hidden; }
.order-editor { width: min(860px, 100%); max-height: calc(100vh - 48px); display: grid; grid-template-rows: auto minmax(0,1fr) auto; overflow: hidden; border-radius: 16px; background: #fff; box-shadow: 0 24px 70px rgba(15,23,42,.3); }
.order-change-editor { width: min(920px, 100%); }
.change-reversal-overlay { z-index: 100; }
.change-reversal-editor { width: min(680px, 100%); }
.event-editor { width: min(780px, 100%); }
.overtime-range-editor { width: min(720px, 100%); }
.order-editor-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.order-editor-eyebrow { margin: 0 0 3px; color: var(--primary-dark); font-size: 12px; font-weight: 800; letter-spacing: .06em; }
.order-editor-header h2 { margin: 0; font-size: 22px; }
.order-editor-header p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.order-editor-body { min-height: 0; overflow-y: auto; padding: 20px 24px; background: #f8fafc; }
.order-form-section { padding: 20px; border: 1px solid var(--border); border-radius: 11px; background: #fff; }
.order-form-section + .order-form-section { margin-top: 16px; }
.order-form-section-title { min-height: 40px; display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.order-form-section-title > span { width: 25px; height: 25px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #fff; background: var(--primary); font-size: 12px; font-weight: 800; }
.order-form-section-title h3 { margin: 0; font-size: 15px; }
.order-form-section-title p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.order-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); align-items: start; gap: 16px; }
.order-form-grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-field { min-width: 0; display: grid; gap: 7px; color: #334155; font-size: 13px; font-weight: 700; }
.form-field b { color: var(--danger); }
.form-field input, .form-field select { width: 100%; height: 46px; min-height: 46px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--foreground); background: #fff; font-size: 14px; }
.form-field small { color: var(--muted); font-size: 11px; font-weight: 500; }
.form-field input:disabled, .form-field select:disabled, .form-field input:read-only { color: #64748b; background: #f1f5f9; cursor: not-allowed; opacity: 1; }
.form-field input:read-only { color: #475569; background: #f8fafc; cursor: default; }
.form-field input:user-invalid, .form-field select:user-invalid { border-color: #ef4444; }
.order-editor[data-mode="create"] .edit-only { display: none; }
.order-editor[data-mode="edit"] .create-only { display: none; }
.order-editor[data-mode="edit"] .order-form-section-title > span { display: none; }
.order-editor[data-mode="edit"] .order-form-section-title { min-height: 0; margin-bottom: 14px; }
.order-adjustment-context { display: grid; grid-template-columns: minmax(110px,.7fr) minmax(0,1.5fr); gap: 12px; margin-bottom: 16px; padding: 14px 16px; border-radius: 9px; background: #f1f5f9; }
.order-adjustment-context span, .order-adjustment-context strong, .order-adjustment-context small { display: block; }
.order-adjustment-context span { margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.order-adjustment-context strong { overflow-wrap: anywhere; color: #1e3a5f; font-size: 14px; }
.order-adjustment-context small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.order-derived-summary { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 12px; }
.order-derived-summary[hidden] { display: none; }
.order-derived-summary > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 9px 12px; border-radius: 8px; background: #eff6ff; color: #1e3a5f; }
.order-derived-summary span { font-size: 12px; }
.order-derived-summary strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.form-error { margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--error-border); border-radius: 8px; color: var(--error-text); background: var(--error-bg); font-size: 13px; font-weight: 700; }
.form-error[hidden] { display: none; }
.order-save-note { margin: 12px 0 0; color: #047857; font-size: 12px; font-weight: 700; }
.order-editor-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--border); background: #fff; }
.event-editor-footer { align-items: center; justify-content: space-between; }
.event-editor-footer > div { display: flex; gap: 10px; }
.event-date-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); align-items: stretch; gap: 16px; }
.event-date-note { min-height: 71px; display: flex; flex-direction: column; justify-content: center; padding: 10px 13px; border: 1px solid #bfdbfe; border-radius: 8px; color: #1e3a5f; background: #eff6ff; }
.event-date-note strong, .event-date-note span { display: block; }
.event-date-note strong { font-size: 13px; }
.event-date-note span { margin-top: 3px; color: #526174; font-size: 11px; }
.event-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); align-items: start; gap: 18px 16px; }
.event-impact-section { padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: #f8fafc; }
.event-equipment-note { margin: 9px 0 0; padding: 8px 10px; border-left: 3px solid #2563eb; color: #1e3a5f; background: #eff6ff; font-size: 11px; line-height: 1.5; }
.event-impact-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.event-impact-heading strong, .event-impact-heading span { display: block; }
.event-impact-heading strong { color: #334155; font-size: 13px; }
.event-impact-heading span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.event-impact-list { display: grid; gap: 9px; margin-top: 12px; }
.event-impact-row { display: grid; grid-template-columns: minmax(230px,1.4fr) minmax(135px,.6fr) 44px; align-items: end; gap: 10px; }
.event-impact-row .form-field { gap: 5px; }
.event-impact-row .button { width: 44px; padding: 0; color: var(--danger); }
.event-impact-total { min-height: 42px; display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; margin-top: 10px; padding: 8px 11px; border-top: 1px solid var(--border); color: #334155; }
.event-impact-total span, .event-impact-total small { color: var(--muted); font-size: 11px; }
.event-impact-total strong { color: #1e3a5f; font-size: 20px; font-variant-numeric: tabular-nums; }
.event-secondary-grid { margin-top: 16px; }
.event-reason-list { min-width: 230px; display: grid; gap: 4px; white-space: normal; }
.event-reason-list > span { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.event-reason-list strong { color: #334155; font-size: 12px; font-weight: 600; }
.event-reason-list small { color: #64748b; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.overtime-range-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); align-items: start; gap: 16px; }
.overtime-range-preview { min-height: 62px; display: flex; flex-direction: column; justify-content: center; margin-top: 16px; padding: 11px 13px; border: 1px solid #bfdbfe; border-left: 4px solid var(--primary); border-radius: 8px; color: #1e3a5f; background: #eff6ff; }
.overtime-range-preview strong { font-size: 14px; }
.overtime-range-preview span { margin-top: 3px; color: #526174; font-size: 11px; }
.event-date-cell { min-width: 122px; padding-top: 5px; padding-bottom: 5px; }
.event-date-button, .event-date-readonly { min-height: 47px; display: grid; align-content: center; justify-items: start; gap: 1px; padding: 5px 8px; border-radius: 7px; text-align: left; }
.event-date-button { width: 100%; border: 1px solid transparent; color: #1e3a5f; background: transparent; cursor: pointer; transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease; }
.event-date-button:hover { color: var(--primary-dark); border-color: #bfdbfe; background: #eff6ff; }
.event-date-button:focus-visible { outline: 3px solid #93c5fd; outline-offset: 1px; }
.event-date-button strong, .event-date-readonly strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.event-date-button small, .event-date-readonly small { color: #64748b; font-size: 10px; font-weight: 600; }
.event-date-readonly { color: #475569; }
.actuals-metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
.actuals-metrics article { min-width: 0; min-height: 92px; display: grid; align-content: center; padding: 13px 16px; border: 1px solid var(--border); border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.actuals-metrics span, .actuals-metrics small { color: var(--muted); }
.actuals-metrics span { font-size: 12px; font-weight: 700; }
.actuals-metrics strong { margin-top: 2px; overflow-wrap: anywhere; font-size: 21px; font-variant-numeric: tabular-nums; }
.actuals-metrics small { margin-top: 1px; font-size: 11px; }
.actuals-panel { min-height: calc(100vh - 254px); }
.actuals-toolbar { align-items: center; flex-wrap: wrap; gap: 10px; }
.actuals-guidance { min-height: 44px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 26px; padding: 8px 18px; border-bottom: 1px solid var(--border); color: #526174; background: #f8fafc; font-size: 12px; }
.actuals-guidance strong { color: #334155; }
.actual-edit-button { width: 100%; min-height: 42px; display: grid; align-content: center; justify-items: start; padding: 4px 7px; border: 1px solid transparent; border-radius: 7px; color: #1e3a5f; background: transparent; text-align: left; cursor: pointer; }
.actual-edit-button:hover { border-color: #bfdbfe; background: #eff6ff; }
.actual-edit-button:focus-visible { outline: 3px solid #93c5fd; outline-offset: 1px; }
.actual-edit-button strong, .actual-edit-button small { display: block; }
.actual-edit-button small { color: #64748b; font-size: 10px; }
.actual-grade { display: inline-flex; min-height: 26px; align-items: center; padding: 0 8px; border-radius: 999px; color: #475569; background: #eef2f7; font-size: 11px; font-weight: 800; }
.actual-grade.qualified { color: #065f46; background: #d1fae5; }
.actual-grade.rejected { color: #991b1b; background: #fee2e2; }
.actual-impact-qualified { color: #047857; font-weight: 700; }
.actual-impact-quality { color: #64748b; }
.actual-locked { color: #64748b; font-size: 11px; font-weight: 700; }
.baseline-history { border-top: 14px solid var(--background); }
.baseline-history-heading { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 18px; border-bottom: 1px solid var(--border); }
.baseline-history-heading h3 { margin: 0; font-size: 15px; }
.baseline-history-heading p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.actual-editor, .baseline-editor { width: min(920px, 100%); }
.actual-form-grid { display: grid; grid-template-columns: minmax(150px,.7fr) minmax(280px,1.45fr) minmax(150px,.7fr); gap: 16px; }
.actual-plan-field { margin-top: 16px; }
.actual-order-context { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); overflow: hidden; margin-top: 14px; border: 1px solid #dbeafe; border-radius: 9px; background: #dbeafe; gap: 1px; }
.actual-order-context[hidden] { display: none; }
.actual-order-context > div { min-width: 0; padding: 10px 12px; background: #f8fbff; }
.actual-order-context span, .actual-order-context strong { display: block; }
.actual-order-context span { color: var(--muted); font-size: 11px; }
.actual-order-context strong { margin-top: 2px; overflow-wrap: anywhere; color: #1e3a5f; font-size: 13px; }
.actual-quantity-grid { display: grid; grid-template-columns: minmax(180px,.65fr) minmax(300px,1.35fr); gap: 16px; }
.form-field textarea { width: 100%; min-height: 82px; resize: vertical; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--foreground); background: #fff; font-size: 14px; line-height: 1.45; }
.actual-impact-note { margin-top: 13px; padding: 10px 12px; border-left: 4px solid var(--accent); color: #065f46; background: #ecfdf5; font-size: 12px; font-weight: 700; }
.actual-impact-note.quality-only { border-left-color: #94a3b8; color: #475569; background: #f1f5f9; }
.schedule-actual-cell { min-width: 132px; }
.schedule-actual-button { min-width: 118px; min-height: 42px; display: grid; align-content: center; justify-items: start; gap: 1px; padding: 5px 9px; border: 1px solid #bfdbfe; border-radius: 7px; color: #1e40af; background: #eff6ff; text-align: left; cursor: pointer; transition: background-color 180ms ease, border-color 180ms ease; }
.schedule-actual-button:hover { border-color: #60a5fa; background: #dbeafe; }
.schedule-actual-button:focus-visible { outline: 3px solid #93c5fd; outline-offset: 1px; }
.schedule-actual-button strong, .schedule-actual-button small { display: block; }
.schedule-actual-button strong { font-size: 12px; }
.schedule-actual-button small { color: #526174; font-size: 10px; }
.schedule-actual-button.completed { border-color: #a7f3d0; color: #065f46; background: #ecfdf5; }
.schedule-actual-button:disabled { cursor: not-allowed; opacity: .58; }
.baseline-date-grid { display: grid; grid-template-columns: minmax(170px,1fr) minmax(170px,1fr) auto; align-items: end; gap: 16px; }
.baseline-preview-button { min-width: 156px; }
.baseline-check-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); overflow: hidden; border: 1px solid var(--border); border-radius: 9px; background: var(--border); gap: 1px; }
.baseline-check-grid > div { min-height: 70px; display: grid; align-content: center; padding: 10px 13px; background: #f8fafc; }
.baseline-check-grid span, .baseline-check-grid strong { display: block; }
.baseline-check-grid span { color: var(--muted); font-size: 11px; }
.baseline-check-grid strong { margin-top: 2px; font-size: 19px; font-variant-numeric: tabular-nums; }
.baseline-check-grid .complete { color: #047857; background: #ecfdf5; }
.baseline-check-grid .incomplete { color: #991b1b; background: #fef2f2; }
.baseline-missing-wrap { margin-top: 12px; padding: 12px 14px; border: 1px solid #fecaca; border-radius: 8px; color: #7f1d1d; background: #fff7f7; font-size: 12px; }
.baseline-missing-wrap ul { max-height: 150px; margin: 7px 0 0; padding-left: 20px; overflow: auto; }
.baseline-missing-wrap li + li { margin-top: 4px; }
.baseline-reason-field { margin-top: 16px; }
.baseline-warning { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; padding: 11px 13px; border-left: 4px solid #d97706; color: #854d0e; background: #fffbeb; font-size: 12px; }
.baseline-warning strong { white-space: nowrap; }
.button.primary.danger-action { background: var(--danger); }
.button.primary.danger-action:hover { background: #991b1b; }
.button[hidden] { display: none; }
.change-order-context { display: grid; grid-template-columns: 1fr 1.6fr .75fr .85fr; gap: 1px; overflow: hidden; margin-bottom: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--border); }
.change-order-context > div { min-width: 0; padding: 12px 14px; background: #fff; }
.change-order-context span, .change-order-context strong, .change-order-context small { display: block; }
.change-order-context span { margin-bottom: 3px; color: var(--muted); font-size: 11px; }
.change-order-context strong { overflow-wrap: anywhere; color: #1e3a5f; font-size: 15px; font-variant-numeric: tabular-nums; }
.change-order-context small { margin-top: 2px; color: #64748b; font-size: 10px; }
.change-type-group { margin: 0; padding: 0; border: 0; }
.change-type-group legend { margin-bottom: 9px; color: #334155; font-size: 13px; font-weight: 800; }
.change-type-options { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.change-type-card { position: relative; min-height: 88px; display: grid; grid-template-columns: 20px minmax(0,1fr); align-items: start; gap: 10px; padding: 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: #fff; cursor: pointer; transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease; }
.change-type-card:hover { border-color: #93b4db; background: #f8fbff; }
.change-type-card:has(input:focus-visible) { outline: 3px solid #93c5fd; outline-offset: 2px; }
.change-type-card:has(input:checked) { border-color: var(--primary); background: #eff6ff; box-shadow: inset 0 0 0 1px var(--primary); }
.change-type-card.danger-choice:has(input:checked) { border-color: #dc2626; background: #fef2f2; box-shadow: inset 0 0 0 1px #dc2626; }
.change-type-card input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.change-type-mark { width: 19px; height: 19px; border: 2px solid #94a3b8; border-radius: 50%; background: #fff; }
.change-type-card:has(input:checked) .change-type-mark { border: 5px solid var(--primary); }
.change-type-card.danger-choice:has(input:checked) .change-type-mark { border-color: #dc2626; }
.change-type-card strong, .change-type-card small { display: block; }
.change-type-card strong { color: #1e293b; font-size: 14px; }
.change-type-card small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.change-type-card:has(input:disabled) { cursor: not-allowed; opacity: .5; }
.change-detail-panel { margin-top: 14px; padding: 16px; border: 1px solid #bfdbfe; border-radius: 10px; background: #f8fbff; }
.change-detail-panel[hidden] { display: none; }
.change-panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.change-panel-heading h3 { margin: 0; font-size: 15px; }
.change-panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.change-detail-panel > .form-field { max-width: 320px; }
.change-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.change-result-preview { max-width: 320px; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 9px 12px; border-radius: 8px; color: #1e3a5f; background: #e8f1ff; }
.change-result-preview span { font-size: 12px; }
.change-result-preview strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.split-preview { display: grid; grid-template-columns: minmax(0,1fr) 32px minmax(0,1fr); align-items: center; gap: 12px; margin-top: 14px; }
.split-preview > div { min-height: 66px; padding: 10px 12px; border: 1px solid #dbeafe; border-radius: 9px; background: #fff; }
.split-preview > svg { width: 24px; height: 24px; color: var(--primary); }
.split-preview span, .split-preview strong, .split-preview small { display: block; }
.split-preview span { color: var(--muted); font-size: 11px; }
.split-preview strong { margin-top: 2px; color: #1e3a5f; font-size: 17px; font-variant-numeric: tabular-nums; }
.split-preview small { margin-top: 2px; color: #6d28d9; font-size: 11px; font-weight: 700; }
.split-routing-note { margin: 11px 0 0; color: #1d4ed8; font-size: 12px; font-weight: 700; }
.cancel-panel { border-color: #fecaca; background: #fff7f7; }
.cancel-impact { min-height: 64px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 14px; padding: 10px 13px; border-left: 4px solid #dc2626; background: #fff; }
.cancel-impact span { color: #7f1d1d; font-size: 12px; font-weight: 700; }
.cancel-impact strong { color: #991b1b; font-size: 20px; font-variant-numeric: tabular-nums; }
.cancel-impact small { grid-column: 1 / -1; color: #7f1d1d; font-size: 11px; }
.change-history-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.change-history-section[hidden] { display: none; }
.change-history-section h3 { margin: 0 0 8px; font-size: 13px; }
.change-history-section ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.change-history-section li { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 6px 12px; padding: 9px 11px; border-radius: 8px; background: #fff; color: #334155; font-size: 12px; }
.change-history-section li small { color: var(--muted); font-size: 10px; }
.change-history-section li.legacy { background: #f1f5f9; }
.change-history-section li.legacy small { grid-column: 1 / -1; }
.change-history-section li.reversed { background: #f8fafc; }
.change-history-detail { min-width: 0; }
.change-history-detail > span, .change-history-detail > small { display: block; }
.change-history-detail > span { font-weight: 700; }
.change-history-detail > small { margin-top: 2px; line-height: 1.45; }
.change-history-section li.reversed .change-history-detail > span { color: #64748b; text-decoration: line-through; }
.change-history-reversed-note { color: #047857 !important; font-weight: 700; text-decoration: none; }
.change-history-blocked-note { display: block; max-width: 150px; text-align: right; line-height: 1.35; }
.change-reverse-button { min-height: 34px; padding: 0 10px; color: #1d4ed8; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 7px; font-size: 11px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.change-reverse-button:hover { background: #dbeafe; }
.change-reversal-summary { display: grid; grid-template-columns: .7fr 1.3fr 1fr; gap: 1px; overflow: hidden; margin-bottom: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--border); }
.change-reversal-summary > div { min-width: 0; padding: 12px 14px; background: #fff; }
.change-reversal-summary span, .change-reversal-summary strong { display: block; }
.change-reversal-summary span { margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.change-reversal-summary strong { overflow-wrap: anywhere; color: #1e3a5f; font-size: 13px; }
.change-reversal-section { padding: 18px; }
.change-reversal-effect { min-height: 58px; padding: 11px 13px; border-left: 4px solid #2563eb; color: #1e3a5f; background: #eff6ff; }
.change-reversal-effect span, .change-reversal-effect strong { display: block; }
.change-reversal-effect span { font-size: 11px; }
.change-reversal-effect strong { margin-top: 3px; font-size: 14px; line-height: 1.5; }
.change-reversal-reason-field { margin-top: 16px; }
.change-reversal-warning { display: flex; align-items: flex-start; gap: 6px; margin: 14px 0 0; padding: 10px 12px; border-left: 4px solid #d97706; color: #854d0e; background: #fffbeb; font-size: 11px; line-height: 1.5; }
.change-reversal-warning strong { white-space: nowrap; }
.parameter-grid { display: grid; grid-template-columns: minmax(220px,.8fr) minmax(420px,1.4fr) minmax(220px,.8fr); align-items: start; gap: 16px; padding: 18px; }
.parameter-capacity-group { grid-column: 1 / -1; order: -1; }
.parameter-reason-group { grid-column: span 2; }
.parameter-group { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 11px; background: #fff; }
.parameter-group > header { min-height: 76px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 15px; border-bottom: 1px solid var(--border); background: var(--surface-subtle); }
.parameter-group h3 { margin: 0; font-size: 15px; }
.parameter-group header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.parameter-add-form { padding: 13px 14px; border-bottom: 1px solid var(--border); }
.parameter-add-form > label { display: block; margin-bottom: 5px; color: #475569; font-size: 12px; font-weight: 700; }
.parameter-add-form > div { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.parameter-capacity-form > .capacity-form-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.capacity-form-heading strong { color: #334155; font-size: 12px; }
.capacity-form-heading span { color: var(--muted); font-size: 11px; }
.parameter-capacity-form > .capacity-entry-grid { display: grid; grid-template-columns: minmax(130px,1.2fr) repeat(3,minmax(105px,.85fr)) minmax(88px,.65fr) auto; align-items: end; gap: 8px; }
.capacity-entry-grid > label, .parameter-capacity-item > label { min-width: 0; display: grid; gap: 5px; color: #475569; font-size: 11px; font-weight: 700; }
.capacity-entry-grid > label span, .parameter-capacity-item > label span { white-space: nowrap; }
.parameter-add-form input, .parameter-capacity-item input { min-width: 0; width: 100%; min-height: 44px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--foreground); background: #fff; }
.parameter-policy-note { min-height: 70px; display: flex; align-items: center; padding: 13px 14px; border-bottom: 1px solid var(--border); color: #526174; background: #f8fafc; font-size: 12px; line-height: 1.5; }
.parameter-list { max-height: calc(100vh - 390px); min-height: 120px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.parameter-item { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.parameter-item:last-child { border-bottom: 0; }
.parameter-item > div:first-child { min-width: 0; }
.parameter-item strong, .parameter-item small { display: block; }
.parameter-item strong { overflow-wrap: anywhere; font-size: 13px; }
.parameter-item small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.parameter-item.inactive { background: #f8fafc; }
.parameter-item.inactive > div:first-child strong { color: #64748b; text-decoration: line-through; }
.parameter-toggle { min-width: 66px; min-height: 38px; padding: 0 10px; }
.parameter-capacity-item { display: grid; grid-template-columns: minmax(130px,1.2fr) repeat(3,minmax(105px,.85fr)) minmax(88px,.65fr) auto; align-items: end; }
.parameter-capacity-item input { min-height: 44px; }
.capacity-total-cell { min-height: 44px; display: grid; grid-template-columns: 1fr auto; align-content: center; gap: 0 4px; padding: 4px 9px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; }
.capacity-total-cell span { grid-column: 1 / -1; color: #475569; font-size: 10px; font-weight: 700; }
.capacity-total-cell strong { color: #0f3d75; font-size: 15px; font-variant-numeric: tabular-nums; }
.capacity-total-cell small { align-self: end; margin: 0; color: #64748b; font-size: 9px; }
.parameter-actions { display: flex; gap: 6px; }
.parameter-actions .button { min-height: 44px; padding: 0 10px; font-size: 12px; }
.parameter-order-actions { display: flex; gap: 8px; margin-top: 7px; }
.parameter-actions .parameter-order-actions { margin-top: 0; }
.parameter-order-button { flex: 0 0 44px; border: 1px solid var(--border-strong); background: #fff; transition: border-color 160ms ease, color 160ms ease, background 160ms ease; }
.parameter-order-button:hover:not(:disabled) { border-color: #93c5fd; color: #0754c7; background: #eff6ff; }
.parameter-order-button:disabled { cursor: not-allowed; opacity: .34; }
.parameter-order-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.parameter-empty { padding: 28px 14px; color: var(--muted); font-size: 13px; text-align: center; }
.toast { position: fixed; z-index: 50; right: 24px; bottom: 24px; max-width: min(420px, calc(100vw - 48px)); padding: 13px 16px; border-radius: 9px; color: #fff; background: #1e293b; box-shadow: 0 12px 30px rgba(15,23,42,.25); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #991b1b; }
.icon-button { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px; color: #1e3a5f; background: #eff6ff; }
.mobile-only { display: none; }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actuals-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .workspace-grid { grid-template-columns: 1fr; }
  .status-panel { align-self: stretch; }
  .topbar-actions .badge { display: none; }
  .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .parameter-grid { grid-template-columns: 1fr 1fr; }
  .parameter-capacity-group { grid-column: 1 / -1; grid-row: auto; }
  .parameter-group:nth-child(2), .parameter-reason-group { grid-column: auto; grid-row: auto; }
}

@media (max-width: 1360px) {
  .panel-header.toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-controls { justify-content: flex-start; }
  #page-events .panel-header.toolbar > .filter-button { align-self: flex-start; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(290px, 88vw); transform: translateX(-105%); transition: transform 200ms ease; box-shadow: 18px 0 40px rgba(15,23,42,.25); }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open::after { content: ""; position: fixed; z-index: 30; inset: 0; background: rgba(15,23,42,.45); }
  .mobile-only { display: grid; }
  .topbar { align-items: flex-start; flex-wrap: wrap; padding: 12px 14px; }
  .topbar-title { flex: 1; }
  .topbar-actions { width: 100%; margin-left: 0; }
  .topbar-actions { flex-wrap: wrap; }
  .topbar-actions .button { flex: 1 1 145px; }
  main { padding: 16px 14px 30px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { padding: 13px 14px; }
  .metric-card strong { font-size: 22px; }
  .panel-header.toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-controls { align-items: stretch; flex-direction: column; gap: 8px; }
  #page-events .panel-header.toolbar > .filter-button { width: 100%; align-self: stretch; }
  .view-switch { width: 100%; }
  .view-switch-button { flex: 1; min-height: 40px; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-span-2, .filter-span-3 { grid-column: span 1; }
  .filter-summary { align-items: flex-start; flex-wrap: wrap; padding: 8px 14px; }
  .filter-chips { order: 3; width: 100%; }
  .filter-options { position: static; width: 100%; margin-top: 5px; box-shadow: none; }
  .search-field input { width: 100%; min-height: 44px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .reorder-overlay { padding: 0; }
  .reorder-workbench { width: 100%; height: 100vh; border-radius: 0; }
  .reorder-header { padding: 14px; }
  .reorder-header p:last-child { max-width: 280px; }
  .reorder-tools { grid-template-columns: 1fr auto; gap: 10px; padding: 10px 14px; }
  .move-to-position { grid-column: 1 / -1; grid-row: 2; justify-content: stretch; grid-template-columns: auto 68px auto minmax(110px,1fr); }
  .history-actions .button { min-width: 70px; padding: 0 10px; }
  .reorder-column-head { display: none; }
  .reorder-list { padding: 8px 10px 18px; }
  .reorder-item { grid-template-columns: 48px 70px minmax(0,1fr); gap: 8px; min-height: 112px; }
  .reorder-order { align-self: start; }
  .reorder-value { grid-column: 3; }
  .reorder-spec::before { content: "规格："; color: var(--muted); }
  .reorder-department::before { content: "部门："; color: var(--muted); }
  .reorder-quantity { grid-column: 3; text-align: left; }
  .reorder-quantity::before { content: "待排："; color: var(--muted); font-weight: 500; }
  .reorder-date { grid-column: 3; color: var(--muted); }
  .reorder-date::before { content: "开工："; }
  .reorder-footer { align-items: stretch; flex-direction: column; padding: 10px 14px; }
  .reorder-footer-actions { display: grid; grid-template-columns: 1fr 1.5fr; }
  .order-editor-overlay { padding: 0; }
  .order-editor { width: 100%; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
  .order-editor-header { padding: 14px; }
  .order-editor-body { padding: 12px 14px; }
  .order-form-section { padding: 14px; }
  .order-form-grid, .order-form-grid-3 { grid-template-columns: 1fr; }
  .event-date-row, .event-form-grid, .overtime-range-grid { grid-template-columns: 1fr; }
  .event-impact-heading { align-items: stretch; flex-direction: column; }
  .event-impact-row { grid-template-columns: 1fr 110px 44px; }
  .actual-form-grid, .actual-quantity-grid, .baseline-date-grid { grid-template-columns: 1fr; }
  .actual-order-context, .baseline-check-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .baseline-preview-button { width: 100%; }
  .order-adjustment-context { grid-template-columns: 1fr; }
  .change-order-context { grid-template-columns: 1fr 1fr; }
  .change-type-options, .change-detail-grid { grid-template-columns: 1fr; }
  .change-type-card { min-height: 74px; }
  .change-panel-heading { align-items: flex-start; flex-direction: column; gap: 3px; }
  .order-editor-footer { padding: 10px 14px; }
  .order-editor-footer .button { flex: 1; min-height: 46px; }
  .event-editor-footer { align-items: stretch; flex-direction: column-reverse; }
  .event-editor-footer > div { display: grid; grid-template-columns: 1fr 1.4fr; }
  .parameter-grid { grid-template-columns: 1fr; padding: 12px; }
  .parameter-capacity-group, .parameter-group:nth-child(2), .parameter-reason-group { grid-column: auto; grid-row: auto; }
  .parameter-list { max-height: none; }
  .parameter-capacity-form > .capacity-form-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
  .parameter-capacity-form > .capacity-entry-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .capacity-entry-grid > label:first-child { grid-column: span 2; }
  .parameter-capacity-item { grid-template-columns: repeat(3,minmax(0,1fr)); align-items: end; }
  .capacity-spec-cell { grid-column: 1 / -1; }
  .parameter-capacity-item .parameter-actions { grid-column: span 2; }
  .parameter-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .user-role-guide { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .user-form-grid { grid-template-columns: 1fr; }
  .user-password-field, .user-active-field { grid-column: auto; }
}

@media (max-width: 430px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .actuals-metrics, .actual-order-context, .baseline-check-grid { grid-template-columns: 1fr; }
  .topbar-actions { flex-direction: column; }
  .topbar-actions .button { flex: none; width: 100%; min-height: 46px; }
  .change-order-context { grid-template-columns: 1fr; }
  .split-preview { grid-template-columns: 1fr; }
  .split-preview > svg { margin: 0 auto; transform: rotate(90deg); }
  .event-impact-row { grid-template-columns: minmax(0,1fr) 44px; }
  .event-impact-row .impact-hours-field { grid-column: 1; }
  .parameter-capacity-form > .capacity-entry-grid, .parameter-capacity-item { grid-template-columns: 1fr; }
  .capacity-entry-grid > label:first-child, .parameter-capacity-item .parameter-actions { grid-column: auto; }
  .event-impact-row .button { grid-column: 2; grid-row: 1 / span 2; align-self: end; }
  .user-role-guide { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
