:root {
  --navy-950: #10243f;
  --navy-900: #173251;
  --navy-800: #224466;
  --blue-600: #2878c7;
  --blue-100: #eaf4ff;
  --ink-900: #172230;
  --ink-700: #435267;
  --ink-500: #778498;
  --line: #dce4ed;
  --surface: #ffffff;
  --canvas: #f3f6f9;
  --green: #168267;
  --green-soft: #e6f6f0;
  --amber: #b46b0c;
  --amber-soft: #fff4dc;
  --red: #b54141;
  --red-soft: #ffeded;
  --shadow: 0 12px 32px rgba(20, 45, 72, 0.08);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink-900); background: var(--canvas); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.erp-shell { min-height: 100vh; display: grid; grid-template-columns: 204px minmax(0, 1fr); }
.erp-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 12px 14px; background: linear-gradient(180deg, #f1f6fa 0%, #e6eef5 72%, #dce8f1 100%); color: #294963; border-right: 1px solid #cfdae4; }
.brand { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 0 2px 18px; color: var(--navy-950); border-bottom: 1px solid #cedbe6; }
.brand-mark { position: relative; flex: 0 0 42px; width: 42px; height: 42px; overflow: hidden; border: 1px solid #d6e0e8; border-radius: 11px; background: #fff; box-shadow: 0 5px 14px rgba(27, 56, 82, .10); }
.brand-mark img { position: absolute; top: -15px; left: -16px; width: 74px; max-width: none; height: auto; }
.brand-copy { min-width: 0; display: grid; gap: 2px; }
.brand strong, .brand small { display: block; white-space: nowrap; }
.brand strong { font-size: 9.5px; line-height: 1.25; letter-spacing: -.04em; }
.brand small { color: #6f879d; font-size: 9px; line-height: 1.35; }
.side-nav { padding: 18px 0; overflow-y: auto; }
.nav-label { margin: 17px 8px 8px; color: #6f879d; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nav-label:first-child { margin-top: 0; }
.nav-item { min-height: 44px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; margin: 3px 0; padding: 9px 13px; border: 1px solid transparent; border-radius: 9px; color: #294963; }
.nav-item:not(.is-disabled):hover { background: #d9e7f2; color: var(--navy-950); }
.nav-item.is-active { background: #fff; color: var(--navy-950); border-color: #cbd8e4; box-shadow: 0 7px 18px rgba(27, 56, 82, .10); font-weight: 700; }
.nav-item.is-disabled { color: #8297a9; cursor: default; }
.nav-item.is-disabled small { font-size: 10px; color: #7990a3; }
.nav-scroll-hint { display: none; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 14px 10px 0; border-top: 1px solid #cbd8e3; color: #68849a; font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #4bd1a9; box-shadow: 0 0 0 4px rgba(75,209,169,.12); }

.erp-main { min-width: 0; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 32px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar p { margin: 0; }
.topbar-kicker { color: var(--ink-500); font-size: 11px; }
.topbar-context { margin-top: 3px !important; font-weight: 700; color: var(--navy-900); }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--blue-100); color: var(--blue-600); font-weight: 800; }
.user-copy strong, .user-copy small { display: block; }
.user-copy strong { font-size: 13px; }
.user-copy small { margin-top: 2px; color: var(--ink-500); font-size: 11px; }
.text-button { min-height: 44px; appearance: none; border: 0; background: transparent; color: var(--ink-500); padding: 7px; }
.text-button:hover { color: var(--red); }

.page-area { max-width: 1560px; margin: 0 auto; padding: 28px 32px 56px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 22px; }
.page-heading.compact { align-items: center; }
.page-heading h1 { margin: 4px 0 8px; color: var(--navy-950); font-size: clamp(26px, 3vw, 36px); line-height: 1.15; letter-spacing: -.025em; }
.page-heading p { margin: 0; color: var(--ink-500); max-width: 760px; line-height: 1.7; }
.eyebrow { margin: 0; color: var(--blue-600) !important; font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 9px 16px; border: 1px solid transparent; border-radius: 8px; font-weight: 700; transition: .16s ease; }
a.button:not([aria-disabled="true"]):not(.disabled):hover,
button.button:not(:disabled):hover { transform: translateY(-1px); }
.button[aria-disabled="true"],
.button.disabled,
.button:disabled { color: #758494; background: #edf1f5; border-color: #d7dfe7; box-shadow: none; cursor: not-allowed; opacity: 1; pointer-events: none; transform: none; }
.button-primary { background: var(--blue-600); color: #fff; box-shadow: 0 7px 16px rgba(40,120,199,.18); }
.button-secondary { background: #fff; color: var(--navy-900); border-color: var(--line); }
.button-small { min-height: 32px; padding: 6px 10px; background: var(--blue-100); color: #155c9f; border-color: #cde3f7; font-size: 12px; }
.button-wide { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.quiet-link, .row-link { color: var(--blue-600); font-weight: 700; }
.quiet-link:hover, .row-link:hover { text-decoration: underline; }

.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.home-action-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
.masterdata-task-grid { grid-template-columns: repeat(3, minmax(0,1fr)); margin: 0; padding: 18px 20px; }
.masterdata-task-grid .action-card { min-height: 118px; height: 100%; }
.request-action-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
.request-action-grid .action-card { grid-template-columns: auto minmax(0,1fr); align-items: start; background: #fff; border-left-width: 1px; }
.request-action-grid .status-pill { display: inline-block; margin-top: 10px; }
.approval-overview-section > .request-action-grid { margin: 0; padding: 18px 20px; }
.approval-overview-section > .empty-state { border-top: 1px solid var(--line); }
.request-detail-panel { display: flex; flex-direction: column; }
.request-detail-panel-primary { min-height: 310px; }
.request-detail-panel-compact { min-height: 172px; }
.request-detail-panel .table-wrap { overflow-x: auto; overflow-y: visible; }
.action-card { min-height: 112px; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 15px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-left-width: 4px; border-radius: 11px; box-shadow: var(--shadow); }
.home-action-grid .action-card { background: #fff; border-left: 1px solid var(--line); }
.home-action-grid .action-card strong,
.home-metric-grid .home-metric-card > span {
  color: var(--navy-950);
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}
.home-action-grid .action-number,
.home-metric-grid .home-metric-card > strong {
  margin: 0;
  color: var(--navy-900);
  font-family: inherit;
  font-size: clamp(28px, 2.3vw, 32px);
  font-weight: 800;
  line-height: 1;
}
.home-action-grid .action-card small,
.home-metric-grid .home-metric-card > small {
  color: var(--ink-500);
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
}
.action-card:hover { border-color: #b9ccde; }
.tone-amber { border-left-color: #e0a23e; }.tone-red { border-left-color: #d86868; }.tone-blue { border-left-color: #4b91d5; }
.action-number { font-size: 32px; font-weight: 800; color: var(--navy-900); }
.action-card strong, .action-card small { display: block; }
.action-card small { margin-top: 6px; color: var(--ink-500); }
.action-arrow { color: var(--ink-500); font-size: 19px; }
.calm-state { display: flex; align-items: center; gap: 15px; margin-bottom: 22px; padding: 18px 20px; border: 1px solid #cbe8de; background: var(--green-soft); border-radius: 11px; }
.calm-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-weight: 800; }
.calm-state p { margin: 4px 0 0; color: #4c7165; }

.panel { margin-bottom: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(21,44,67,.045); overflow: hidden; }
.panel-heading { min-height: 74px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.panel-heading > * { min-width: 0; }
.panel-heading h2 { margin: 4px 0 0; font-size: 18px; color: var(--navy-900); }
.panel-heading p { margin: 0; }
.list-heading { border-top: 1px solid var(--line); }
.detail-panel { scroll-margin-top: 92px; }
.muted { color: var(--ink-500); }
.count-badge { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 20px; background: var(--blue-100); color: var(--blue-600); font-weight: 800; }

.filter-bar { display: flex; align-items: end; gap: 10px; padding: 18px 20px; background: #f9fbfd; }
.search-field { flex: 1; max-width: 620px; }
.search-field span, .login-form label span { display: block; margin-bottom: 6px; color: var(--ink-700); font-size: 12px; font-weight: 700; }
input[type="search"], .login-form input { width: 100%; min-height: 40px; padding: 9px 12px; color: var(--ink-900); background: #fff; border: 1px solid #cfd9e4; border-radius: 8px; outline: none; }
input:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(40,120,199,.11); }
.compact-search-bar, .filter-bar:has(input[type="search"]) { justify-content: flex-end; flex-wrap: wrap; padding: 12px 18px; background: #fff; }
.compact-search-bar .search-field, .filter-bar:has(input[type="search"]) .search-field { flex: 0 1 300px; max-width: 300px; }
.compact-search-bar .search-field > span, .compact-search-bar > label > span, .compact-search-bar .filter-field label, .filter-bar:has(input[type="search"]) .search-field > span, .filter-bar:has(input[type="search"]) > label > span, .filter-bar:has(input[type="search"]) .filter-field label { display: block; margin-bottom: 4px; color: var(--ink-500); font-size: 11px; font-weight: 700; }
.compact-search-bar input[type="search"], .compact-search-bar select, .compact-search-bar .filter-field input, .filter-bar:has(input[type="search"]) input[type="search"], .filter-bar:has(input[type="search"]) select, .filter-bar:has(input[type="search"]) .filter-field input { width: 100%; min-height: 36px; padding: 7px 10px; color: var(--ink-900); background: #fff; border: 1px solid #cfd9e4; border-radius: 8px; }
.compact-search-bar > label:not(.search-field), .compact-search-bar .filter-field, .filter-bar:has(input[type="search"]) > label:not(.search-field), .filter-bar:has(input[type="search"]) .filter-field { flex: 0 1 170px; min-width: 150px; }
.compact-search-bar .filter-query, .filter-bar:has(input[type="search"]) .filter-query { flex-basis: 300px; max-width: 300px; }
.compact-search-bar .button, .filter-bar:has(input[type="search"]) .button { min-height: 36px; padding: 8px 13px; }

.record-form .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px 18px; padding: 20px; }
.record-form .form-grid > label { min-width: 0; display: flex; flex-direction: column; gap: 6px; color: var(--ink-700); }
.record-form .form-grid > label > span { color: var(--ink-700); font-size: 12px; font-weight: 700; }
.record-form input[type="text"],
.record-form input[type="date"],
.record-form input[type="number"],
.record-form textarea,
.record-form select { width: 100%; min-width: 0; min-height: 42px; padding: 9px 11px; color: var(--ink-900); background: #fff; border: 1px solid #cfd9e4; border-radius: 8px; outline: none; }
.record-form textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.record-form input:focus,
.record-form textarea:focus,
.record-form select:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(40,120,199,.11); }
.record-form input:focus-visible,
.record-form textarea:focus-visible,
.record-form select:focus-visible,
.button:focus-visible,
.row-link:focus-visible,
.table-wrap:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; }
.record-form .form-help { color: var(--ink-500); font-size: 11px; line-height: 1.45; }
.record-form .form-error-text { color: var(--red); font-size: 11px; font-weight: 700; line-height: 1.45; }
.record-form .button-row { margin: 0; padding: 18px 20px 20px; border-top: 1px solid var(--line); }

.stack-form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px 18px; padding: 20px; }
.stack-form label { min-width: 0; display: grid; gap: 6px; color: var(--ink-700); font-size: 12px; font-weight: 700; }
.stack-form input,
.stack-form select,
.stack-form textarea { width: 100%; min-width: 0; min-height: 42px; padding: 9px 11px; color: var(--ink-900); background: #fff; border: 1px solid #cfd9e4; border-radius: 8px; outline: none; }
.stack-form textarea { min-height: 112px; resize: vertical; line-height: 1.5; }
.stack-form label:last-of-type,
.stack-form > .button { grid-column: 1 / -1; }
.stack-form > .button { min-width: 120px; min-height: 44px; justify-self: start; }
.stack-form input:focus,
.stack-form select:focus,
.stack-form textarea:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(40,120,199,.11); }
.compact-form { min-width: 260px; grid-template-columns: minmax(0, 1fr); padding: 12px; }
.compact-form > .button { width: 100%; justify-self: stretch; }

.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.data-table th { padding: 11px 14px; background: #f7f9fb; color: var(--ink-500); border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; letter-spacing: .04em; white-space: nowrap; }
.data-table td { padding: 14px; border-bottom: 1px solid #edf1f5; vertical-align: middle; color: var(--ink-700); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfdff; }
.data-table td strong, .data-table td small { display: block; }
.data-table td strong { color: var(--ink-900); }
.data-table td small { margin-top: 5px; color: var(--ink-500); line-height: 1.45; }
.data-table .danger-text { color: var(--red); }
.cell-action { text-align: right; white-space: nowrap; }
.json-summary { display: block; max-width: 210px; color: var(--ink-700); white-space: normal; word-break: break-word; font: 11px/1.45 "Cascadia Mono", monospace; }

.status-pill { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 9px; border-radius: 20px; background: #edf2f6; color: var(--ink-700); font-size: 11px; font-weight: 800; white-space: nowrap; }
.status-pill[aria-disabled="true"] { color: #758494; background: #edf1f5; border: 1px solid #d7dfe7; cursor: default; }
.status-effective, .status-confirmed { background: var(--green-soft); color: var(--green); }
.status-pending_approval, .status-pending_seal, .status-draft { background: var(--amber-soft); color: var(--amber); }
.status-rejected, .status-data_conflict { background: var(--red-soft); color: var(--red); }
.status-pill-danger { background: var(--red-soft); color: var(--red); }
.status-muted { color: var(--ink-500); }
.danger-text { color: var(--red) !important; }
/* 待用印超期行：整行标红提示，仍保持表格可读性。 */
.data-table tbody tr.row-overdue { background: var(--red-soft); }
.data-table tbody tr.row-overdue:hover { background: var(--red-soft); }
.data-table tbody tr.row-overdue td { border-bottom-color: #f3d3d3; }

.skip-link { position: fixed; left: -9999px; top: 8px; z-index: 100; }
.skip-link:focus { left: 8px; padding: 9px 12px; background: #fff; border-radius: 7px; box-shadow: var(--shadow); }
.page-area > .sidebar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); }
.page-area > .sidebar a, .page-area > .sidebar span { padding: 8px 11px; border-radius: 7px; color: var(--ink-700); background: #f4f7fa; font-size: 12px; font-weight: 700; }
.page-area > .sidebar a:hover { color: var(--blue-600); background: var(--blue-100); }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-head h1 { margin: 4px 0 0; color: var(--navy-950); font-size: 30px; }
.page-head p { margin: 0; max-width: 680px; color: var(--ink-500); }
.section { margin-top: 24px; }
.stack { display: grid; gap: 10px; }
.notice { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 9px; background: var(--blue-100); }
.notice.warning { color: #6b430c; background: var(--amber-soft); }
.empty { padding: 32px 20px; color: var(--ink-500); text-align: center; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 11px; }
.detail-grid > div { padding: 15px; background: #fff; }
.detail-grid dt { color: var(--ink-500); font-size: 11px; }
.detail-grid dd { margin: 5px 0 0; overflow-wrap: anywhere; }
.management-metrics { margin-bottom: 20px; }
.management-signal-list { display: grid; }
.management-signal { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.management-signal:last-child { border-bottom: 0; }
.management-signal strong, .management-signal small { display: block; }
.management-signal small { margin-top: 4px; color: var(--ink-500); }

.empty-state { padding: 52px 20px; text-align: center; color: var(--ink-500); }
.empty-state.compact { padding: 34px 20px; }
.empty-state > span { display: block; margin-bottom: 10px; color: #9db0c1; font-size: 28px; }
.empty-state h3 { margin: 0; color: var(--ink-700); }
.empty-state p { margin: 8px auto 0; max-width: 520px; line-height: 1.6; }

.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 15px; color: var(--ink-500); font-size: 12px; }
.breadcrumbs > * { min-width: 0; overflow-wrap: anywhere; }
.breadcrumbs a { color: var(--blue-600); }
.order-hero { display: flex; align-items: stretch; justify-content: space-between; gap: 20px; margin-bottom: 16px; padding: 23px 24px; background: linear-gradient(130deg, #fff 40%, #f4f9fd); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.title-line h1 { margin: 0; color: var(--navy-950); font-size: 29px; letter-spacing: -.02em; }
.order-title-block > p { margin: 8px 0 15px; color: var(--ink-700); font-size: 15px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 9px 20px; color: var(--ink-500); font-size: 12px; }
.hero-meta strong { margin-left: 4px; color: var(--ink-700); }
.next-action-box { min-width: 260px; display: flex; flex-direction: column; justify-content: center; padding: 16px 18px; border-left: 3px solid var(--blue-600); background: rgba(255,255,255,.75); border-radius: 8px; }
.next-action-box span { color: var(--ink-500); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.next-action-box strong { margin: 6px 0; color: var(--navy-900); font-size: 17px; }
.next-action-box small { color: var(--ink-500); }

.stage-strip { display: grid; grid-template-columns: repeat(7, minmax(110px,1fr)); margin-bottom: 14px; overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
.stage { position: relative; min-width: 115px; display: flex; align-items: center; gap: 8px; padding: 14px 13px; color: #8a98a9; border-right: 1px solid var(--line); }
.stage:last-child { border-right: 0; }
.stage span { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid #cad5df; border-radius: 50%; font-size: 10px; }
.stage strong { font-size: 11px; white-space: nowrap; }
.stage.is-done { color: var(--green); background: #f2fbf8; }
.stage.is-done span { background: var(--green); border-color: var(--green); color: #fff; }
.stage.is-current { color: var(--blue-600); background: var(--blue-100); }
.stage.is-current span { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.detail-tabs { position: sticky; top: 72px; z-index: 8; display: flex; gap: 3px; margin-bottom: 16px; padding: 8px; overflow-x: auto; background: rgba(255,255,255,.97); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 7px 18px rgba(21,44,67,.06); }
.detail-tabs a { min-height: 44px; display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 7px; color: var(--ink-700); font-weight: 700; white-space: nowrap; }
.detail-tabs a:hover { background: var(--blue-100); color: var(--blue-600); }
.detail-tabs a.is-active { color: #fff; background: var(--blue-600); }
.detail-tabs--compact { width: fit-content; max-width: 100%; gap: 2px; padding: 4px; box-shadow: none; }
.detail-tabs--compact a { min-height: 38px; padding: 6px 14px; }
.approval-filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.approval-filter-bar a { min-height: 44px; display: inline-flex; align-items: center; padding: 8px 11px; color: var(--ink-700); background: #fff; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; font-weight: 700; }
.approval-filter-bar a.is-active { color: #fff; background: var(--navy-900); border-color: var(--navy-900); }

.category-module-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin: 16px 0 20px; }
.category-module-card { min-height: 118px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; gap: 7px 12px; padding: 17px 18px; color: var(--ink-700); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.category-module-card:hover { color: var(--navy-900); border-color: #b9c9d9; transform: translateY(-1px); }
.category-module-card.is-active { background: #f1f6fa; border-color: #aebfce; box-shadow: 0 0 0 1px #aebfce, var(--shadow); }
.category-module-card > span { align-self: center; color: var(--navy-900); font-size: 15px; font-weight: 800; }
.category-module-card > strong { align-self: center; color: var(--navy-900); font-size: 22px; }
.category-module-card > small { grid-column: 1 / -1; color: var(--ink-500); line-height: 1.45; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 20px; scroll-margin-top: 140px; }
.metric-card { padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.home-metric-grid { gap: 14px; margin-bottom: 22px; }
.home-metric-card { min-height: 112px; padding: 20px; border-radius: 11px; box-shadow: var(--shadow); }
.metric-card > span, .metric-card > strong, .metric-card > small { display: block; }
.metric-card > span { color: var(--ink-500); font-size: 11px; font-weight: 700; }
.metric-card > strong { margin: 9px 0 7px; color: var(--navy-900); font-size: 20px; }
.metric-card > small { color: var(--ink-500); line-height: 1.45; }
.metric-card.is-unavailable { background: #f8fafc; border-style: dashed; }
.metric-card.is-unavailable > strong { color: var(--ink-500); font-size: 16px; font-weight: 600; }
.sample-filter-panel { margin-bottom: 14px; }
.sample-stage-overview { margin-bottom: 14px; }
.sample-stage-card { position: relative; color: inherit; text-decoration: none; border-top: 3px solid #9fb6cc; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.sample-stage-card:hover { border-color: var(--blue-600); box-shadow: var(--shadow); transform: translateY(-1px); }
.sample-stage-card.stage-pending { border-top-color: #3387d3; }
.sample-stage-card.stage-waiting { border-top-color: #d89b2b; }
.sample-stage-card.stage-closed { border-top-color: #4da67a; }
.sample-stage-panel { margin-bottom: 14px; scroll-margin-top: 110px; }
.inline-note { margin: 0; padding: 12px 18px; color: #557086; background: #f4f8fb; border-top: 1px solid var(--line); font-size: 12px; }

.execution-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; padding: 18px; }
.execution-card { padding: 17px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdff; }
.execution-card-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.execution-card-head small { color: var(--ink-500); }
.execution-card h3 { margin: 4px 0 0; color: var(--navy-900); }
.execution-card dl { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin: 17px 0 0; }
.execution-card dl div { padding: 9px 10px; background: #fff; border-radius: 7px; }
.execution-card dt { color: var(--ink-500); font-size: 10px; }
.execution-card dd { margin: 5px 0 0; color: var(--ink-900); font-weight: 700; word-break: break-word; }

.linkage-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0; }
.linkage-grid article { min-height: 120px; padding: 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.linkage-grid article:nth-child(3n) { border-right: 0; }
.linkage-grid article:nth-last-child(-n+3) { border-bottom: 0; }
.linkage-grid span, .linkage-grid strong, .linkage-grid small { display: block; }
.linkage-grid span { color: var(--ink-500); font-size: 11px; font-weight: 700; }
.linkage-grid strong { margin: 9px 0 6px; color: var(--navy-900); font-size: 23px; }
.linkage-grid small { color: var(--ink-500); line-height: 1.45; }
.linkage-grid .is-pending { background: #fafbfd; }
.linkage-grid .is-pending strong { color: var(--ink-500); font-size: 16px; }

.record-list { margin: 0; }
.record-list > div { display: grid; grid-template-columns: 180px minmax(0,1fr); gap: 18px; padding: 13px 20px; border-bottom: 1px solid #edf1f5; }
.record-list > div:last-child { border-bottom: 0; }
.record-list dt { color: var(--ink-500); }
.record-list dd { margin: 0; color: var(--ink-700); word-break: break-word; }

.message-stack { display: grid; gap: 8px; margin-bottom: 16px; }
.message { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.message.success { color: var(--green); background: var(--green-soft); border-color: #c6e6da; }
.error-panel { max-width: 720px; margin: 70px auto; padding: 34px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.error-panel h1 { margin: 10px 0; color: var(--navy-950); }
.error-panel > p { color: var(--ink-700); line-height: 1.7; }
.error-code { color: var(--red); font-weight: 800; letter-spacing: .08em; }
.error-panel dl div { padding: 12px; background: #f7f9fb; border-radius: 8px; }
.error-panel dt { color: var(--ink-500); font-size: 11px; }
.error-panel dd { margin: 5px 0 0; color: var(--ink-700); font-family: "Cascadia Mono", monospace; word-break: break-all; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 15% 20%, #274d73 0, var(--navy-950) 35%, #0c1d31 100%); }
.login-card { width: min(440px,100%); padding: 32px; background: rgba(255,255,255,.985); border: 1px solid rgba(255,255,255,.4); border-radius: 17px; box-shadow: 0 26px 80px rgba(0,0,0,.28); }
.login-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.login-brand strong, .login-brand small { display: block; }
.login-brand strong { color: var(--navy-900); font-size: 18px; }
.login-brand small { margin-top: 3px; color: var(--ink-500); font-size: 11px; }
.login-copy { padding: 25px 0 18px; }
.login-copy h1 { margin: 6px 0 10px; color: var(--navy-950); font-size: 25px; line-height: 1.25; }
.login-copy > p:last-child { margin: 0; color: var(--ink-500); line-height: 1.65; }
.login-form { display: grid; gap: 15px; }
.form-error { margin-bottom: 14px; padding: 10px 12px; color: var(--red); background: var(--red-soft); border-radius: 7px; font-size: 12px; }
.login-foot { margin: 18px 0 0; color: var(--ink-500); text-align: center; font-size: 10px; line-height: 1.55; }

@media (max-width: 1120px) {
  .category-module-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .action-grid { grid-template-columns: 1fr; }
  .home-action-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .masterdata-task-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .request-action-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .linkage-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .linkage-grid article, .linkage-grid article:nth-child(3n) { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .linkage-grid article:nth-child(2n) { border-right: 0; }
  .linkage-grid article:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (max-width: 820px) {
  .erp-shell { display: block; }
  .erp-sidebar { position: static; width: 100%; height: auto; padding: 14px 14px 10px; }
  .brand { padding: 0 2px 12px; }
  .side-nav { display: flex; gap: 6px; padding: 10px 0 5px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; }
  .nav-label, .nav-item.is-disabled, .sidebar-foot { display: none; }
  .nav-item { flex: 0 0 auto; min-width: max-content; min-height: 44px; margin: 0; white-space: nowrap; scroll-snap-align: start; }
  .nav-scroll-hint { display: block; margin: 4px 2px 0; color: #6f879d; font-size: 10px; text-align: right; }
  .topbar { top: 0; height: 62px; padding: 0 16px; }
  .topbar-kicker, .user-copy { display: none; }
  .page-area { padding: 20px 16px 42px; }
  .page-heading { align-items: start; flex-direction: column; }
  .category-module-grid { grid-template-columns: 1fr; }
  .page-heading .button { width: 100%; }
  .order-hero { flex-direction: column; padding: 19px; }
  .next-action-box { min-width: 0; border-left: 0; border-top: 3px solid var(--blue-600); }
  .detail-tabs { top: 62px; }
  .detail-tabs--compact a { min-height: 44px; }
  .execution-grid { grid-template-columns: 1fr; }
  .masterdata-task-grid { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .button-small { min-height: 44px; }
  body { font-size: 13px; }
  .page-heading h1 { font-size: 27px; }
  .metric-grid, .linkage-grid { grid-template-columns: 1fr; }
  .home-action-grid { grid-template-columns: 1fr; }
  .request-action-grid { grid-template-columns: 1fr; }
  .request-detail-panel-primary,
  .request-detail-panel-compact { min-height: 0; }
  .metric-card { padding: 15px; }
  .linkage-grid article, .linkage-grid article:nth-child(2n), .linkage-grid article:nth-child(3n), .linkage-grid article:nth-last-child(-n+2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .linkage-grid article:last-child { border-bottom: 0; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .filter-bar .button { width: 100%; }
  .record-form .form-grid { grid-template-columns: minmax(0,1fr); padding: 17px 16px; }
  .record-form .button-row { padding: 16px; }
  .record-form .button-row .button { width: 100%; }
  .stack-form { grid-template-columns: minmax(0,1fr); padding: 17px 16px; }
  .stack-form label:last-of-type,
  .stack-form > .button { grid-column: auto; }
  .stack-form > .button { width: 100%; min-height: 44px; justify-self: stretch; }
  .compact-search-bar, .filter-bar:has(input[type="search"]) { justify-content: stretch; }
  .compact-search-bar .search-field, .compact-search-bar > label:not(.search-field), .compact-search-bar .filter-field, .compact-search-bar .filter-query, .filter-bar:has(input[type="search"]) .search-field, .filter-bar:has(input[type="search"]) > label:not(.search-field), .filter-bar:has(input[type="search"]) .filter-field, .filter-bar:has(input[type="search"]) .filter-query { width: 100%; max-width: none; min-width: 0; flex: 1 1 auto; }
  .compact-search-bar .button, .filter-bar:has(input[type="search"]) .button { min-height: 44px; }
  .panel-heading { align-items: start; }
  .panel-heading .muted { display: none; }
  .title-line h1 { font-size: 23px; }
  .hero-meta { display: grid; grid-template-columns: 1fr 1fr; }
  .record-list > div { grid-template-columns: 1fr; gap: 5px; }
  .login-page { padding: 14px; }
  .login-card { padding: 23px; }
}

/* Mark's quote-stage cards remain one row at all widths; no global grid change. */
.category-module-grid.quote-stage-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  gap: clamp(6px, 1vw, 12px);
}
.quote-stage-grid > .category-module-card {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  gap: 6px;
  padding: clamp(7px, 1.4vw, 18px);
  overflow-wrap: anywhere;
}
.quote-stage-grid > .category-module-card > span { font-size: clamp(12px, 1.2vw, 15px); }
.quote-stage-grid > .category-module-card > strong { font-size: clamp(16px, 1.8vw, 22px); }
.quote-stage-grid > .category-module-card > small { font-size: clamp(11px, 1vw, 13px); }
