:root {
  --canvas: #f5f7fb;
  --surface: #fff;
  --ink: #172c43;
  --muted: #65778b;
  --line: #e1e7ef;
  --brand: #16865e;
  --brand-hover: #126f4e;
  --brand-soft: #e9f7f0;
  --attention: #be3648;
  --attention-soft: #fff0f2;
  --warning: #9a5b0c;
  --warning-soft: #fff4df;
  --blue: #356b9d;
  --blue-soft: #eef5fb;
  --radius: 12px;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { outline-offset: 2px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: var(--brand); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 28px; line-height: 1.3; letter-spacing: -.025em; }
h2 { margin-bottom: 6px; font-size: 18px; line-height: 1.35; }
h3 { margin-bottom: 5px; font-size: 15px; line-height: 1.4; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }
[hidden] { display: none !important; }

button,
.button {
  min-height: 42px;
  border: 1px solid #d5dfe8;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 14px;
  font-weight: 650;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
button:hover, .button:hover { border-color: #b5c4d2; background: #f9fbfd; }
button.primary, .button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
button.primary:hover, .button.primary:hover { background: var(--brand-hover); }
button.soft, .button.soft {
  border-color: transparent;
  background: var(--brand-soft);
  color: var(--brand);
}
button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
button.danger { background: var(--attention-soft); color: var(--attention); border-color: #f0cbd2; }
button.small { min-height: 34px; padding: 5px 10px; font-size: 12px; }
.icon-button {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
}

input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #d5dfe8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
}
textarea { resize: vertical; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--attention);
  box-shadow: 0 0 0 2px #be36481a;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 12px; font-weight: 700; color: var(--ink); }
.field-help { font-size: 12px; color: var(--muted); }
.required::after { content: " *"; color: var(--attention); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 16px; }
.field.full { grid-column: 1 / -1; }
.check-row { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.check-row input { width: 18px; min-height: 18px; margin: 0; accent-color: var(--brand); }

.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
  font-weight: 800; font-size: 18px;
}
.brand-name { font-weight: 780; font-size: 19px; line-height: 1.2; letter-spacing: .03em; }
.brand-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 7px; border-radius: 6px;
  background: #f1f4f7; color: var(--muted);
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge.green { background: var(--brand-soft); color: var(--brand); }
.badge.amber { background: var(--warning-soft); color: var(--warning); }
.badge.red { background: var(--attention-soft); color: var(--attention); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.notice {
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--brand-soft); color: #315b49; padding: 11px 13px;
  font-size: 13px;
}
.notice.warning { background: var(--warning-soft); border-color: #efddba; color: #72531f; }
.notice.error { background: var(--attention-soft); border-color: #f0cbd2; color: #8a2a3b; }
.empty {
  padding: 26px 18px; color: var(--muted); text-align: left;
}
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* Login */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .9fr) minmax(440px, 1.1fr); }
.login-intro {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: clamp(32px, 6vw, 82px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-intro h1 { max-width: 11ch; margin-top: 84px; font-size: clamp(34px, 4vw, 54px); letter-spacing: -.035em; }
.login-intro > div > p { max-width: 46ch; color: var(--muted); font-size: 16px; }
.login-principles { display: grid; gap: 13px; margin-top: 36px; padding: 0; list-style: none; }
.login-principles li { display: flex; gap: 10px; align-items: flex-start; color: #40566b; }
.login-principles span:first-child {
  width: 22px; height: 22px; min-width: 22px; border-radius: 50%;
  display: grid; place-items: center; margin-top: 1px;
  background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 11px;
}
.login-note { color: var(--muted); font-size: 12px; max-width: 54ch; }
.login-main { display: grid; place-items: center; padding: 32px 24px; }
.login-form-wrap { width: min(410px, 100%); }
.login-form-wrap h2 { font-size: 27px; margin-bottom: 6px; }
.login-form-wrap > p { color: var(--muted); margin-bottom: 28px; }
.login-form { display: grid; gap: 17px; }
.login-form button { width: 100%; min-height: 48px; margin-top: 5px; }
.login-status { min-height: 22px; margin: 0; font-size: 13px; color: var(--attention); }
.login-foot { margin-top: 24px; color: var(--muted); font-size: 12px; }

/* Desktop workbench */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 224px;
  background: #fff; border-right: 1px solid var(--line);
  padding: 24px 14px 16px; display: flex; flex-direction: column; z-index: 20;
}
.sidebar .brand { padding: 0 10px 25px; }
.nav-group { margin-top: 12px; }
.nav-title { padding: 0 12px 7px; font-size: 10px; font-weight: 800; letter-spacing: .12em; color: #91a0af; }
.nav-item {
  width: 100%; min-height: 42px; justify-content: flex-start;
  border-color: transparent; background: transparent; color: #52677d;
  padding: 9px 12px; font-weight: 600;
}
.nav-item:hover { background: #f5f8fa; }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.sidebar-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); }
.user-mini { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand);
  font-weight: 800; font-size: 12px; flex-shrink: 0;
}
.user-mini strong { display: block; font-size: 13px; }
.user-mini small { color: var(--muted); font-size: 11px; }
.main-shell { margin-left: 224px; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 15; height: 70px;
  padding: 0 30px; border-bottom: 1px solid var(--line); background: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.breadcrumb { color: var(--muted); font-size: 12px; }
.breadcrumb strong { color: var(--ink); font-weight: 650; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.page { max-width: 1600px; margin: 0 auto; padding: 28px 30px 44px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin-bottom: 22px; }
.page-head p { margin: 0; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.search-control { display: block; min-width: 260px; }
.search-control input { width: 100%; }
.priority-workspace { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 20px; overflow: hidden; }
.priority-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.priority-heading h2 { margin: 0; }
.priority-heading span { color: var(--muted); font-size: 12px; }
.priority-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.priority-item { min-width: 0; display: grid; grid-template-columns: 24px minmax(0,1fr); align-content: start; gap: 6px 10px; padding: 14px 17px 15px; border-right: 1px solid var(--line); }
.priority-item:last-child { border-right: 0; }
.priority-index { color: var(--muted); font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; }
.priority-item.red .priority-index { color: var(--attention); }
.priority-item.amber .priority-index { color: var(--warning); }
.priority-content { min-width: 0; }
.priority-content strong { display: block; font-size: 13px; line-height: 1.4; }
.priority-content small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.priority-item button { grid-column: 2; justify-self: start; margin-top: 5px; }
.priority-empty { grid-column: 1/-1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; color: var(--muted); }
.home-grid { grid-template-columns: minmax(0, 1.3fr) minmax(280px, .8fr); }
.home-overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.home-stat { min-width: 0; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.home-stat:nth-child(odd) { border-right: 1px solid var(--line); }
.home-stat span { display: block; color: var(--muted); font-size: 12px; }
.home-stat strong { display: block; margin-top: 4px; font-size: 24px; line-height: 1.2; }
.home-stat small { margin-left: 4px; color: var(--muted); font-size: 11px; font-weight: 400; }
.home-links { display: flex; flex-wrap: wrap; gap: 18px; padding: 12px 20px; }
.home-links a { font-size: 12px; font-weight: 650; text-decoration: none; }
.home-links a:hover { text-decoration: underline; }
.overview-grid { grid-template-columns: minmax(0, 1.8fr) minmax(270px, .72fr); margin-bottom: 20px; }
.route-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.route-card { min-width: 0; padding: 0 18px; }
.route-card + .route-card { border-left: 1px solid var(--line); }
.route-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px 0 13px; border-bottom: 1px solid var(--line); }
.route-head h3 { margin: 0 0 2px; font-size: 16px; }
.route-head small { color: var(--muted); }
.route-head > strong { font-size: 27px; line-height: 1; white-space: nowrap; }
.route-head > strong small { display: block; font-size: 10px; font-weight: 500; text-align: right; margin-top: 4px; }
.route-rows { padding: 5px 0; }
.route-row { min-height: 37px; display: grid; grid-template-columns: 89px minmax(0, 1fr) 46px; align-items: center; gap: 8px; border-bottom: 1px solid #edf1f5; }
.route-row:last-child { border-bottom: 0; }
.route-label { font-size: 12px; font-weight: 650; white-space: nowrap; }
.route-track { height: 9px; background: #e9edf1; border-radius: 2px; overflow: hidden; }
.route-progress { display: block; width: 100%; height: 9px; border: 0; border-radius: 2px; appearance: none; background: transparent; color: #526277; }
.route-progress::-webkit-progress-bar { background: transparent; }
.route-progress::-webkit-progress-value { background: currentColor; border-radius: 2px; }
.route-progress::-moz-progress-bar { background: currentColor; border-radius: 2px; }
.route-progress.stage-white_mold { color: #0f766e; }
.route-progress.stage-white_qc { color: #0891b2; }
.route-progress.stage-coating { color: #b87506; }
.route-progress.stage-sand_molding,.route-progress.stage-lost_molding { color: #2563eb; }
.route-progress.stage-pouring { color: #d94b32; }
.route-progress.stage-opening { color: #8c6845; }
.route-progress.stage-heat { color: #be185d; }
.route-progress.stage-machining { color: #6d28d9; }
.route-progress.stage-final_qc { color: #16803d; }
.route-row strong { text-align: right; font-size: 12px; font-weight: 750; }
.route-row strong.unknown { font-size: 10px; color: var(--muted); font-weight: 500; }
.route-foot { margin: 5px -18px 0; padding: 11px 18px; border-top: 1px solid var(--line); background: #f8fafc; display: flex; flex-wrap: wrap; gap: 5px 13px; color: #52677d; font-size: 11px; }
.machine-summary { padding: 10px 18px 16px; }
.machine-summary > strong { display: block; margin: 4px 0; }
.machine-summary p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.machine-line { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.machine-line strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.drawing-workspace { scroll-margin-top: 86px; }
.drawing-search { width: min(240px, 100%); flex-shrink: 0; }
.drawing-search input { width: 100%; }
.drawing-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.drawing-row:last-child { border-bottom: 0; }
.drawing-row-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.drawing-row-main strong { font-size: 13px; }
.drawing-row-main span, .drawing-more { color: var(--muted); font-size: 12px; }
.drawing-open { flex-shrink: 0; text-decoration: none; }
.drawing-more { margin: 0; padding: 9px 20px; border-top: 1px solid var(--line); }
.plan-workspace { margin-top: 20px; scroll-margin-top: 86px; }
.plan-filters { display: flex; align-items: center; gap: 7px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.plan-filters button { min-height: 32px; padding: 4px 11px; font-size: 12px; }
.plan-filters button.active { background: var(--brand-soft); border-color: #cfe4da; color: var(--brand); }
.plan-filters span { margin-left: auto; color: var(--muted); font-size: 11px; }
.position-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.position-list span { border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; background: #fff; color: #52677d; font-size: 11px; }
.position-list strong { color: var(--ink); }
.release-scope { padding: 10px 20px; border-bottom: 1px solid #efddba; background: var(--warning-soft); color: #72531f; font-size: 12px; }
.scope-note { margin-top: 16px; }
.focus-strip {
  border: 1px solid #cfe4da; background: var(--brand-soft);
  border-radius: var(--radius); min-height: 92px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 21px; margin-bottom: 20px;
}
.focus-strip .focus-copy { min-width: 0; }
.focus-strip h2 { font-size: 18px; margin-bottom: 4px; }
.focus-strip p { margin: 0; color: #476757; }
.focus-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 20px; align-items: start; }
.workspace {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); min-width: 0; overflow: hidden;
}
.workspace-head {
  padding: 18px 20px 15px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.workspace-head h2 { margin: 0; }
.workspace-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.workspace-body { padding: 20px; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.metric { padding: 15px 18px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { display: block; color: var(--muted); font-size: 11px; }
.metric strong { display: block; margin-top: 5px; font-size: 24px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.metric small { margin-left: 4px; color: var(--muted); font-size: 11px; font-weight: 400; }
.plan-table { width: 100%; border-collapse: collapse; }
.plan-table th {
  padding: 10px 18px; background: #f8fafc; color: var(--muted);
  font-size: 11px; text-align: left; font-weight: 700; border-bottom: 1px solid var(--line);
}
.plan-table td { padding: 13px 18px; border-bottom: 1px solid #edf1f5; vertical-align: top; }
.plan-table tbody tr { cursor: pointer; }
.plan-table tbody tr:hover, .plan-table tbody tr.selected { background: var(--brand-soft); }
.plan-table tr:last-child td { border-bottom: 0; }
.plan-number { font-weight: 750; }
.table-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
.plan-detail { border-top: 1px solid var(--line); background: #fbfcfe; }
.plan-detail-head {
  padding: 17px 20px; display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line);
}
.plan-detail-list { display: grid; }
.plan-detail-item { padding: 15px 20px; border-top: 1px solid #e8edf2; }
.plan-detail-item:first-child { border-top: 0; }
.drawing-link { display:inline-flex;margin-top:10px;color:var(--brand);font-size:13px;font-weight:650;text-decoration:none; }
.drawing-link:hover { text-decoration:underline; }
.detail-top { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.detail-facts { display: flex; flex-wrap: wrap; gap: 7px 16px; color: var(--muted); font-size: 12px; margin-top: 7px; }
.task-summary { text-align: right; min-width: 140px; }
.task-summary strong { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.task-summary small { color: var(--muted); }
.side-stack { display: grid; gap: 18px; min-width: 0; }
.report-list { display: grid; }
.report-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 13px 18px; border-top: 1px solid #edf1f5;
}
.report-row:first-child { border-top: 0; }
.report-row strong { display: block; font-size: 13px; }
.report-row small { color: var(--muted); }
.report-qty { color: var(--brand); font-weight: 800; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.report-total { padding: 18px; border-bottom: 1px solid var(--line); }
.report-total .value { font-size: 36px; font-weight: 680; line-height: 1.1; letter-spacing: -.03em; }
.report-total .value span { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 5px; }
.report-total p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }

/* Plan form */
.plan-form-panel {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 20px; overflow: hidden;
  scroll-margin-top: 80px;
}
#draft-recovery { margin-bottom: 20px; }
#draft-save-status { color: var(--brand); }
.plan-form-head {
  padding: 18px 20px 15px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
}
.plan-form-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.plan-form-body { padding: 20px; }
.section-title { margin: 25px 0 10px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section-title:first-child { margin-top: 0; }
.section-title h3 { margin: 0; font-size: 16px; }
.section-title p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.items-editor { display: grid; gap: 12px; }
.item-editor { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.item-editor-head {
  min-height: 43px; display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: #f8fafc; border-bottom: 1px solid var(--line);
}
.item-editor-head strong { font-size: 13px; }
.item-editor-body { padding: 15px; }
.item-editor-grid { display: grid; grid-template-columns: 1.2fr 1fr .75fr .6fr; gap: 13px; }
.item-editor-grid .wide { grid-column: span 2; }
.outsource-grid { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 20px; }
.form-error { min-height: 22px; margin: 12px 0 0; color: var(--attention); font-size: 13px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Worker */
.worker-page { min-height: 100vh; background: var(--canvas); }
.worker-top {
  position: sticky; top: 0; z-index: 12; background: #fff;
  border-bottom: 1px solid var(--line); padding: 12px 16px;
}
.worker-top-inner { max-width: 560px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.worker-brand { display: flex; align-items: center; gap: 9px; }
.worker-brand .brand-mark { width: 34px; height: 34px; border-radius: 9px; font-size: 15px; }
.worker-brand strong { font-size: 16px; white-space: nowrap; }
.worker-header-actions { display:flex;gap:6px;align-items:center;flex-wrap:wrap;justify-content:flex-end; }
.worker-top-inner { flex-wrap:wrap; }
.worker-main { max-width: 560px; margin: auto; padding: 22px 16px 40px; }
.worker-head { margin-bottom: 16px; }
.worker-head h1 { font-size: 25px; }
.worker-head p { margin: 0; color: var(--muted); }
.worker-summary {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 14px;
  padding: 16px 18px; margin-bottom: 14px;
  border: 1px solid #cfe4da; border-radius: var(--radius); background: var(--brand-soft);
}
.worker-summary span { color: #476757; }
.worker-summary strong { font-size: 30px; line-height: 1; color: var(--brand); font-variant-numeric: tabular-nums; }
.worker-tabs {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px;
  border-bottom: 1px solid var(--line); margin-bottom: 15px;
}
.worker-tab {
  min-height: 45px; border: 0; border-radius: 0; background: transparent;
  color: var(--muted); border-bottom: 2px solid transparent;
}
.worker-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.worker-panel[hidden] { display: none; }
.task-list { display: grid; gap: 9px; }
.worker-task {
  width: 100%; min-height: 0; display: grid; gap: 5px;
  justify-items: stretch; text-align: left; color: var(--ink);
  border-radius: 10px; padding: 14px 15px;
}
.worker-task:hover { border-color: #86b6a0; }
.task-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.task-line strong { font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-line b { color: var(--brand); font-size: 20px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.task-line b small { margin-left: 2px; color: var(--brand); font-size: 12px; }
.task-meta { color: var(--muted); font-size: 12px; }
.worker-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 12px; }
.worker-card h2 { font-size: 20px; }
.worker-detail { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; }
.worker-detail strong.remaining { color: var(--brand); font-size: 27px; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.worker-detail strong.remaining small { color: var(--brand); font-size: 12px; }
.worker-facts { margin: 13px 0 0; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 5px; color: #43576b; }
.quantity-label { display: block; margin: 18px 0 7px; font-size: 13px; font-weight: 750; }
.quantity-wrap { position: relative; }
.quantity-field {
  display: flex; align-items: stretch; border: 1px solid #b8c8d4; border-radius: 9px;
  background: #fff; overflow: hidden;
}
.quantity-field:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.quantity-field input {
  min-height: 60px; border: 0; outline: 0 !important; font-size: 28px; font-weight: 750;
  text-align: center; appearance: textfield;
}
.quantity-field input::-webkit-inner-spin-button { -webkit-appearance: none; }
.quantity-field button {
  border: 0; border-left: 1px solid var(--line); border-radius: 0;
  min-width: 64px; min-height: 60px; color: var(--brand);
}
.quantity-options {
  position: absolute; inset: calc(100% + 5px) 0 auto; z-index: 5;
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 12px 28px #172c431a; padding: 7px;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px;
}
.quantity-options button { min-height: 42px; border-radius: 6px; color: var(--brand); }
.quantity-options button.active { background: var(--brand-soft); border-color: var(--brand); }
.quantity-help { min-height: 20px; margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.worker-submit { width: 100%; min-height: 52px; margin-top: 13px; font-size: 15px; }
.worker-message { min-height: 22px; margin: 11px 0 0; font-size: 13px; color: var(--brand); }
.worker-message.error { color: var(--attention); }
.record-list { display: grid; }
.worker-record { padding: 13px 0; border-bottom: 1px solid var(--line); }
.worker-record:last-child { border-bottom: 0; }
.worker-record strong { display: block; }
.worker-record small { color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 100; max-width: calc(100vw - 32px); padding: 12px 17px;
  border-radius: 9px; background: #183d32; color: #fff; box-shadow: 0 10px 30px #172c4333;
  font-size: 13px;
}
.toast.error { background: #8a2a3b; }
.toast[hidden] { display: none; }

@media (max-width: 1180px) {
  .sidebar { width: 200px; }
  .main-shell { margin-left: 200px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.45fr) minmax(260px, .75fr); }
  .item-editor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item-editor-grid .wide { grid-column: span 2; }
  .route-row { grid-template-columns: 78px minmax(0,1fr) 42px; gap: 5px; }
  .route-label { font-size: 11px; }
}

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-intro { border-right: 0; border-bottom: 1px solid var(--line); padding: 30px 24px; }
  .login-intro h1 { margin-top: 42px; }
  .login-principles, .login-note { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .priority-list { grid-template-columns: 1fr; }
  .priority-item { border-right: 0; border-bottom: 1px solid var(--line); }
  .priority-item:last-child { border-bottom: 0; }
  .sidebar {
    position: static; width: auto; height: auto; padding: 12px 14px;
    border-right: 0; border-bottom: 1px solid var(--line);
    flex-direction: row; align-items: center; gap: 14px; overflow-x: auto;
  }
  .sidebar .brand { padding: 0 10px 0 0; flex-shrink: 0; }
  .brand-sub, .nav-title, .sidebar-foot { display: none; }
  .nav-group { display: flex; gap: 5px; margin: 0; }
  .nav-item { width: auto; white-space: nowrap; }
  .main-shell { margin-left: 0; }
  .topbar { position: static; height: auto; min-height: 58px; padding: 10px 18px; }
  .page { padding: 23px 18px 36px; }
}

@media (max-width: 700px) {
  .page-head { flex-direction: column; }
  .page-actions { width: 100%; }
  .search-control { min-width: 0; width: 100%; }
  .route-columns { grid-template-columns: 1fr; }
  .home-overview { grid-template-columns: 1fr; }
  .home-stat:nth-child(odd) { border-right: 0; }
  .route-card + .route-card { border-left: 0; border-top: 1px solid var(--line); }
  .priority-heading { align-items: flex-start; flex-direction: column; }
  .page-actions .button, .page-actions button { flex: 1; }
  .focus-strip { align-items: stretch; flex-direction: column; }
  .focus-actions .button, .focus-actions button { width: 100%; }
  .metrics { grid-template-columns: 1fr; }
  .metric { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
  .plan-table thead { display: none; }
  .plan-table, .plan-table tbody, .plan-table tr, .plan-table td { display: block; width: 100%; }
  .plan-table tr { padding: 13px 16px; border-bottom: 1px solid var(--line); }
  .plan-table td { padding: 2px 0; border: 0; }
  .plan-table td[data-label]::before { content: attr(data-label) "："; color: var(--muted); }
  .plan-detail-head, .detail-top { flex-direction: column; }
  .task-summary { text-align: left; }
  .form-grid, .item-editor-grid { grid-template-columns: 1fr; }
  .item-editor-grid .wide { grid-column: auto; }
  .workspace-body, .plan-form-body { padding: 16px; }
  .drawing-workspace .workspace-head { flex-direction: column; }
  .drawing-search { width: 100%; }
  .drawing-row { padding: 12px 16px; }
  .top-actions .button span { display: none; }
}

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

/* Compact quantity control: arbitrary integer entry plus bounded adjustments. */
.quantity-field input { flex:1; min-width:0; width:0; }
.quantity-field button { min-width:44px; padding:8px; }
.quantity-options { grid-template-columns:repeat(3,minmax(0,1fr)); }

/* Delivery warnings retain the workbench palette and type scale. */
.delivery-workspace { margin-bottom: 24px; }
.delivery-workspace .workspace-heading { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:22px 24px; }
.delivery-workspace h2 { margin:0 0 6px; font-size:20px; }
.delivery-workspace p { margin:0; }
.delivery-counts { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); border-top:1px solid var(--line); }
.delivery-count { padding:18px 24px; color:var(--ink); text-decoration:none; border-right:1px solid var(--line); display:flex; gap:10px; flex-direction:column; }
.delivery-count:last-child { border-right:0; }
.delivery-count:hover { background:var(--brand-soft); }
.delivery-count span { font-size:14px; }
.delivery-count strong { font-size:28px; font-variant-numeric:tabular-nums; }
.delivery-count small { font-size:13px; font-weight:400; }
.delivery-count.overdue strong { color:var(--attention); }
.delivery-count.today strong, .delivery-count.soon strong { color:var(--warning); }
.delivery-controls { border-top:1px solid var(--line); padding:22px 24px 14px; }
.delivery-controls form { display:flex; gap:10px; max-width:560px; margin-bottom:18px; }
.delivery-controls input { min-width:0; flex:1; }
.delivery-filters { display:flex; flex-wrap:wrap; gap:8px; }
.delivery-filters button.active { background:var(--brand-soft); color:var(--brand); border-color:var(--brand); }
.delivery-explanation { padding:0 24px 20px; color:var(--muted); font-size:14px; line-height:1.7; }
.delivery-table-wrap { overflow:auto; }
.delivery-table { width:100%; border-collapse:collapse; text-align:left; }
.delivery-table th { background:var(--canvas); font-size:13px; color:var(--muted); }
.delivery-table th,.delivery-table td { padding:18px 24px; border-top:1px solid var(--line); }
.delivery-table td { vertical-align:middle; }
.delivery-table td small { display:block; margin-top:8px; color:var(--muted); line-height:1.5; }
.delivery-order { font-weight:700; color:var(--ink); text-underline-offset:4px; }
.delivery-pager { border-top:1px solid var(--line); padding:18px 24px; display:flex; justify-content:space-between; align-items:center; gap:16px; color:var(--muted); }
.delivery-pager div { display:flex; gap:8px; }
.delivery-empty { padding:32px 24px; color:var(--muted); line-height:1.8; }
@media(max-width:760px) { .delivery-counts { grid-template-columns:repeat(2,minmax(0,1fr)); } .delivery-count { padding:16px; } .delivery-table { min-width:720px; } }

/* Company identity and compact, thumb-reachable navigation. */
.company-logo { width: 46px; height: 46px; flex: none; object-fit: contain; border-radius: 7px; }
.branded-login { background: var(--canvas) url('/app/assets/factory.png') center center / cover no-repeat fixed; }
.branded-login .login-shell { min-height: 100svh; display: flex; justify-content: flex-end; padding: clamp(24px,5vw,80px); align-items: center; }
.branded-login .login-main { width: min(440px,100%); background: var(--surface); padding: 36px; border-radius: var(--radius); box-shadow: 0 16px 48px #172c432b; }
.branded-login .login-form-wrap { width: 100%; }
.branded-login .brand { margin-bottom: 32px; }
.branded-login h1 { font-size: 24px; margin-bottom: 28px; }
.branded-login .login-foot { margin: 24px 0 0; }
.plan-assist { margin: 0 22px 20px; border-bottom: 1px solid var(--line); }
.plan-assist summary { padding: 14px 0; color: var(--brand); cursor: pointer; font-weight: 650; }
.plan-assist-body { display: grid; gap: 10px; padding-bottom: 20px; }
.plan-assist-body p { margin: 0; }
.plan-assist-body button { justify-self: start; }
.plan-candidate { padding: 14px 0; border-top: 1px solid var(--line); }
.mobile-bottom-nav { display: none; }
.mobile-menu { border: 0; border-radius: 14px 14px 0 0; padding: 0 20px 24px; color: var(--ink); width: min(100%,540px); max-height: 85svh; margin: auto auto 0; background: var(--surface); }
.mobile-menu::backdrop { background: #172c4370; }
.mobile-menu nav { display: grid; gap: 6px; padding: 12px 0 20px; }
.mobile-menu nav a { padding: 13px 16px; text-decoration: none; color: var(--ink); }
.mobile-menu nav a.active { background: var(--brand-soft); color: var(--brand); }
@media(max-width:900px) {
  .app-shell .sidebar { display: none; }
  .app-shell .main-shell { margin-left: 0; }
  .app-shell .topbar { min-height: 54px; padding: 14px 20px; }
  .app-shell .top-actions { display: none; }
  .app-shell .page { padding-bottom: 140px; }
  .mobile-bottom-nav { display: grid; grid-template-columns: repeat(4,1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 10001; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .mobile-bottom-nav a,.mobile-bottom-nav button { min-height: 44px; display: grid; place-items: center; text-decoration: none; border: 0; color: var(--muted); background: transparent; border-radius: 7px; font-weight: 600; padding: 6px; }
  .mobile-bottom-nav .active { background: var(--brand-soft); color: var(--brand); }
  body:has(.mobile-bottom-nav) .acceptance-notice { bottom: calc(61px + env(safe-area-inset-bottom)); font-size: 11px; padding: 5px 8px; }
  .branded-login .login-shell { padding: 24px; justify-content: center; }
  .branded-login .login-main { padding: 28px; }
  .branded-login { background-position: 40% center; }
}

@media(max-width:900px) {
  .worker-main { padding-bottom: 150px; }
  .worker-tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10001; margin: 0; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .worker-page .acceptance-notice { bottom: calc(61px + env(safe-area-inset-bottom)); font-size: 11px; padding: 5px 8px; }
}
.order-circulation {display:flex;gap:20px;align-items:center;padding:20px 24px;border-bottom:1px solid var(--line);flex-wrap:wrap}
.order-qr {width:144px;min-height:144px;display:grid;place-items:center;font-size:13px;color:var(--muted)}
.order-qr img {display:block;width:144px;height:144px}
.traveler-page {padding:24px;background:var(--canvas)}
.traveler-actions {max-width:1000px;margin:0 auto 20px;display:flex;justify-content:space-between;align-items:center;gap:16px}
.traveler-sheet {max-width:1000px;margin:auto;background:white;padding:32px;color:var(--ink)}
.traveler-head {display:flex;justify-content:space-between;align-items:center;gap:20px;flex-wrap:wrap}
.traveler-qr {width:200px;height:200px}
.traveler-sheet table {width:100%;border-collapse:collapse;margin:24px 0}
.traveler-sheet th,.traveler-sheet td {padding:12px;border:1px solid var(--line);text-align:left}
.traveler-url {overflow-wrap:anywhere;font-size:12px}
.task-pager {display:flex;justify-content:space-between;align-items:center;margin:16px 0}
@media print { .traveler-actions,.traveler-page .acceptance-notice {display:none!important} .traveler-page {padding:0;background:white} .traveler-sheet {max-width:none;padding:0} .traveler-head {break-inside:avoid} .traveler-sheet tr {break-inside:avoid} .traveler-sheet thead {display:table-header-group} .traveler-qr {width:45mm;height:45mm} }

/* Order scanning keeps the existing green/white typography and palette. */
.order-scanner{width:min(520px,calc(100vw - 24px));max-height:calc(100dvh - 32px);overflow:auto;border:1px solid var(--line);border-radius:16px;padding:20px;color:var(--text);background:white}
.order-scanner::backdrop{background:rgba(0,0,0,.45)}
.scanner-heading,.scanner-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.order-scanner video{width:100%;max-height:45dvh;object-fit:cover;border-radius:10px;background:#111}
.order-scanner [data-status]{min-height:3em;margin:14px 0}
.order-scanner input[type=file]{position:absolute;inset:0;opacity:0;width:100%;height:100%;cursor:pointer}
.scanner-actions label{position:relative;overflow:hidden;cursor:pointer}
.order-scanner details{margin-top:18px}.order-scanner summary{cursor:pointer;padding:10px 0}
.order-scanner input[type=url]{width:100%;margin:8px 0}

/* Full-flow test workspace */

    .sim-flow .sim-controls{display:flex;gap:10px;align-items:end;margin:16px 0}.sim-flow .sim-controls .field{flex:1}
    .sim-flow .sim-intro{margin-bottom:16px}.sim-flow .sim-intro h1{font-size:23px;margin-top:9px}.sim-flow .sim-intro p{margin-bottom:5px}
    .sim-flow .sim-pager{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:14px 0}
    .sim-flow .sim-result{margin:14px 0}.sim-flow .sim-result p{margin-bottom:8px}.sim-flow .sim-status-row{display:flex;justify-content:space-between;gap:12px;padding:8px 0;border-bottom:1px solid var(--line)}
    .sim-flow .sim-status-row:last-child{border-bottom:0}.sim-flow .sim-product summary{cursor:pointer;font-weight:700;min-height:42px}
    .sim-flow .sim-action{margin-top:18px}.sim-flow .sim-action select{margin-top:7px}.sim-flow .sim-error{margin:12px 0}
    .sim-flow .sim-tabs{display:flex;flex-wrap:wrap}.sim-flow .sim-tabs button{flex:1}.sim-flow .sim-note{white-space:pre-wrap;overflow-wrap:anywhere}
    .sim-flow .sim-balance-title{display:flex;justify-content:space-between;gap:12px;margin-bottom:8px}.sim-flow .sim-record-meta{display:block;overflow-wrap:anywhere}
    .sim-flow .quantity-field input{min-width:0;flex:1;width:0}.sim-flow .quantity-field button{min-width:44px;padding:8px}.sim-flow .quantity-options{grid-template-columns:repeat(3,minmax(0,1fr))}
    .sim-flow .sim-progress{font-size:12px;color:var(--muted);margin-bottom:12px}.sim-flow .sim-actions{display:flex;gap:8px;flex-wrap:wrap}
  
