@layer tokens, reset, base, layout, components, pages, overlays, responsive, accessibility;

@layer tokens {
  :root {
    color-scheme: light;
    --font-ui: Aptos, "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
    --font-display: "Aptos Display", Aptos, "Microsoft YaHei UI", sans-serif;
    --bg: #f3f5f3;
    --surface: #ffffff;
    --surface-soft: #f8faf8;
    --surface-muted: #eef2ef;
    --surface-raised: rgba(255, 255, 255, 0.96);
    --line: #d9e0dc;
    --line-strong: #c6d0cb;
    --text: #15201d;
    --text-soft: #4f5f5a;
    --muted: #71807b;
    --brand: #087b67;
    --brand-strong: #056452;
    --brand-soft: #e7f4f0;
    --brand-quiet: #f1f8f5;
    --info: #1769d1;
    --info-soft: #eaf2fe;
    --success: #17864a;
    --success-soft: #e9f7ef;
    --warning: #b86808;
    --warning-soft: #fff4df;
    --danger: #c43d36;
    --danger-soft: #fff0ee;
    --sidebar: #13231f;
    --sidebar-soft: #1a302a;
    --sidebar-text: #eff8f5;
    --ui-sky: #438bd1;
    --ui-sky-soft: #eaf4ff;
    --ui-amber: #d49327;
    --ui-amber-soft: #fff3d9;
    --ui-violet: #8065c8;
    --ui-violet-soft: #f0ebff;
    --ui-coral: #d96772;
    --ui-coral-soft: #fdebed;
    --ui-teal: #2a9d8f;
    --ui-teal-soft: #e2f6f2;
    --radius-control: 11px;
    --radius-panel: 16px;
    --radius-float: 22px;
    --shadow-panel: 0 1px 2px rgba(22, 40, 34, 0.05), 0 8px 24px rgba(22, 40, 34, 0.04);
    --shadow-float: 0 24px 70px rgba(12, 31, 25, 0.2);
    --focus: 0 0 0 3px rgba(8, 123, 103, 0.19);
    --control-h: 44px;
    --sidebar-w: 224px;
    --ease: 180ms cubic-bezier(0.2, 0.7, 0.2, 1);
  }
}

@layer pages {
  .assignment-route-preview {
    min-height: 0;
    margin: 12px 0 0;
    padding: 14px;
    overflow: auto;
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
    color: var(--muted);
    background: #f7faf8;
    border: 1px solid #d8e6e0;
    border-radius: var(--radius-control);
  }

  .assignment-route-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
  }

  .assignment-route-head > div { display: grid; gap: 3px; }
  .assignment-route-head strong { color: var(--text); }
  .assignment-route-head span { font-size: 12px; }

  .assignment-route-flow {
    display: flex;
    align-items: stretch;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .assignment-route-step {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 9px;
    min-width: 154px;
    padding: 10px 12px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .assignment-route-step b {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    color: #fff;
    background: var(--brand);
    border-radius: 9px;
    font-size: 12px;
  }

  .assignment-route-step span { display: grid; gap: 2px; }
  .assignment-route-step small { color: var(--muted); font-size: 11px; }
  .assignment-route-step i { margin-left: auto; color: var(--brand); font-style: normal; }
  .route-preview-warning { color: var(--warning); font-weight: 700; }

  .assignment-route-flow.operation-dispatch-list {
    display: grid;
    gap: 10px;
    overflow: visible;
    padding-right: 3px;
  }

  .operation-dispatch-row {
    display: grid;
    grid-template-columns: minmax(210px, 240px) minmax(180px, 220px) minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding: 10px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .operation-dispatch-title,
  .operation-recommendation { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .operation-dispatch-title b {
    display: grid;
    place-items: center;
    flex: 0 0 32px;
    height: 32px;
    color: #fff;
    background: var(--brand);
    border-radius: 9px;
  }
  .operation-dispatch-title span,
  .operation-recommendation { display: grid; gap: 3px; }
  .operation-dispatch-title small,
  .operation-recommendation span { color: var(--muted); font-size: 12px; }

  .operation-assignee-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 6px;
  }
  .operation-assignee-grid label {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    min-height: 48px;
    padding: 5px 8px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 9px;
    cursor: pointer;
    transition: background-color var(--ease), border-color var(--ease), box-shadow var(--ease);
  }
  .operation-assignee-grid label:hover { background: #fff; border-color: #aabbb5; }
  .operation-assignee-grid label.is-matched { background: var(--brand-quiet); border-color: #9ccfc0; }
  .operation-assignee-grid label:has(input:checked) {
    background: #edf8f4;
    border-color: #6fb7a4;
    box-shadow: inset 3px 0 0 var(--brand);
  }
  .operation-assignee-grid input[type="checkbox"] {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    border: 0;
    accent-color: var(--brand);
  }
  .operation-assignee-grid label > span { display: grid; gap: 2px; min-width: 0; }
  .operation-assignee-grid strong {
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .operation-assignee-grid small {
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .operation-dispatch-actions {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto minmax(250px, 300px) auto;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 8px 10px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
  }
  .operation-dispatch-actions .compact-toggle {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 52px;
    padding: 6px 9px;
  }
  .operation-dispatch-actions .compact-toggle input {
    width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .operation-dispatch-actions .compact-toggle span {
    min-width: 0;
  }
  .operation-dispatch-actions .compact-toggle strong,
  .operation-dispatch-actions .compact-toggle small {
    overflow: hidden;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .operation-dispatch-action-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
  }
  .operation-dispatch-action-copy strong {
    color: var(--text);
    font-size: 14px;
  }
  .operation-dispatch-action-copy span {
    color: var(--muted);
    font-size: 11px;
  }

  .assignment-list-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
  }

  .assignment-list-heading h2 { margin: 0; }

  .assignment-list-heading > span {
    padding: 5px 10px;
    color: var(--text-soft);
    background: var(--surface-muted);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 720;
    white-space: nowrap;
  }

  .assignment-filter-panel {
    display: grid;
    grid-template-columns: minmax(280px, 1.5fr) minmax(180px, 0.8fr) minmax(160px, 0.7fr) minmax(150px, 0.6fr) auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
    padding: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .assignment-filter-panel > label:not(.assignment-overdue-toggle) {
    display: grid;
    gap: 5px;
    min-width: 0;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 720;
  }

  .assignment-filter-panel .input {
    width: 100%;
    min-width: 0;
  }

  .assignment-overdue-toggle {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: var(--control-h);
    padding: 5px 10px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-control);
    cursor: pointer;
  }

  .assignment-overdue-toggle > input[type="checkbox"] {
    box-sizing: border-box;
    width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    border: 0;
    accent-color: var(--danger);
  }

  .assignment-overdue-toggle > span {
    display: grid;
    gap: 1px;
    min-width: 0;
  }

  .assignment-overdue-toggle strong { font-size: 12px; }
  .assignment-overdue-toggle small { color: var(--muted); font-size: 10px; }
  .assignment-overdue-toggle:focus-within { border-color: var(--brand); box-shadow: var(--focus); }
  .assignment-filter-panel > .ghost-button { min-width: 108px; }

  .personnel-filter-panel {
    display: grid;
    grid-template-columns: minmax(260px, 1.55fr) repeat(4, minmax(135px, 0.8fr)) auto;
    gap: 10px;
    align-items: end;
    margin: 12px 0;
    padding: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .personnel-filter-panel > label {
    display: grid;
    gap: 5px;
    min-width: 0;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 720;
  }

  .personnel-filter-panel .input {
    width: 100%;
    min-width: 0;
  }

  .personnel-filter-panel > .ghost-button {
    min-width: 108px;
  }

  #viewResults #resultFilters {
    flex: 0 0 auto;
    margin-bottom: 12px;
  }

  .assignment-mode-block { display: grid; gap: 4px; }
  .assignment-mode-block small { color: var(--muted); }

  .capability-disclosure {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    transition: border-color 160ms ease, box-shadow 160ms ease;
  }
  .capability-disclosure[open] {
    border-color: #9ccfc0;
    box-shadow: 0 8px 24px rgba(22, 84, 66, 0.08);
  }
  .capability-disclosure summary {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 10px 14px;
    list-style: none;
    cursor: pointer;
    user-select: none;
  }
  .capability-disclosure summary::-webkit-details-marker { display: none; }
  .capability-disclosure summary::after {
    width: 8px;
    height: 8px;
    margin-left: 2px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    content: "";
    transform: rotate(45deg) translateY(-2px);
    transition: transform 160ms ease;
  }
  .capability-disclosure[open] summary::after {
    transform: rotate(225deg) translate(-2px, -2px);
  }
  .capability-summary-copy {
    display: grid;
    flex: 1 1 auto;
    gap: 2px;
    min-width: 0;
  }
  .capability-summary-copy strong { color: var(--text); font-size: 13px; }
  .capability-summary-copy small { color: var(--muted); font-size: 11px; font-weight: 500; }
  .capability-selected-count {
    flex: 0 0 auto;
    padding: 4px 8px;
    color: var(--muted);
    background: var(--surface-muted);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
  }
  .capability-disclosure.has-selection .capability-selected-count {
    color: var(--brand-strong);
    background: var(--brand-quiet);
  }
  .capability-scroll {
    max-height: min(320px, 42vh);
    padding: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    border-top: 1px solid var(--line);
  }
  .capability-scroll::-webkit-scrollbar { width: 8px; }
  .capability-scroll::-webkit-scrollbar-thumb { background: #bcc8c3; border: 2px solid transparent; border-radius: 999px; background-clip: padding-box; }
  .capability-disclosure .capability-check-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .capability-disclosure .capability-option {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    min-height: 52px;
    padding: 12px 14px;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
  }
  .capability-disclosure .capability-option:hover {
    background: var(--surface);
    border-color: #aabbb5;
  }
  .capability-disclosure .capability-option:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 132, 105, 0.14);
  }
  .capability-disclosure .capability-option:has(input:checked) {
    color: var(--brand-strong);
    background: var(--brand-quiet);
    border-color: #79baa7;
    box-shadow: inset 3px 0 0 var(--brand);
  }
  .capability-disclosure .capability-option input {
    box-sizing: border-box;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    min-height: 20px;
    margin: 0;
    padding: 0;
    accent-color: var(--brand);
  }
  .capability-option-name {
    min-width: 0;
    overflow: hidden;
    font-weight: 680;
    text-overflow: ellipsis;
    white-space: nowrap;
    writing-mode: horizontal-tb;
  }
  .capability-option-status {
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--brand-strong);
    font-size: 12px;
    font-weight: 720;
    opacity: 0;
    visibility: hidden;
    transition: opacity 150ms ease;
  }
  .capability-option:has(input:checked) .capability-option-status {
    opacity: 1;
    visibility: visible;
  }

  @media (max-width: 720px) {
    .operation-dispatch-row { grid-template-columns: minmax(160px, 0.8fr) minmax(0, 2fr); }
    .operation-recommendation { grid-column: 2; }
    .operation-assignee-grid { grid-column: 1 / -1; }
  }

  @media (max-width: 720px) {
    .operation-dispatch-row { grid-template-columns: 1fr; }
    .operation-recommendation,
    .operation-assignee-grid { grid-column: auto; }
    .operation-assignee-grid { grid-template-columns: 1fr; }
    .operation-dispatch-actions { grid-template-columns: 1fr; align-items: stretch; }
  }
}

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html {
    min-height: 100%;
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
  }

  body {
    min-height: 100vh;
    margin: 0;
  }

  button,
  input,
  select,
  textarea {
    font: inherit;
  }

  button {
    cursor: pointer;
  }

  img {
    max-width: 100%;
  }

  [hidden] {
    display: none !important;
  }
}

@layer base {
  body {
    color: var(--text);
    background: var(--bg);
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
  }

  h1,
  h2,
  h3,
  p {
    overflow-wrap: anywhere;
  }

  h1,
  h2,
  h3,
  strong,
  th {
    font-family: var(--font-display);
  }

  a {
    color: var(--brand);
  }

  ::selection {
    color: #073d34;
    background: #bce8dc;
  }

  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: #aebbb6;
    background-clip: padding-box;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: #8e9e98;
    background-clip: padding-box;
  }

  .production-view {
    display: none;
  }

  .production-view.active {
    display: block;
    animation: view-in var(--ease) both;
  }

  .visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  .skip-link {
    position: fixed;
    z-index: 3000;
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    color: #fff;
    background: var(--text);
    border-radius: var(--radius-control);
    transform: translateY(-160%);
    transition: transform var(--ease);
  }

  .skip-link:focus {
    transform: translateY(0);
  }

  @keyframes view-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

@layer layout {
  .app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    height: 100vh;
    color: var(--sidebar-text);
    background: var(--sidebar);
    border-right: 1px solid rgba(255, 255, 255, 0.07);
  }

  .brand-block {
    position: relative;
    flex: 0 0 auto;
    padding: 19px 16px 17px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  }

  .brand-logo {
    display: block;
    width: 46px;
    height: 46px;
    margin-bottom: 10px;
    object-fit: contain;
    filter: drop-shadow(0 5px 11px rgba(0, 0, 0, 0.2));
  }

  .brand-title {
    color: #fff;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 750;
    letter-spacing: -0.02em;
  }

  .brand-name {
    margin-top: 10px;
    color: rgba(239, 248, 245, 0.78);
    font-size: 15px;
  }

  .brand-role {
    margin-top: 3px;
    color: #76dcc4;
    font-size: 13px;
    font-weight: 700;
  }

  .side-menu {
    display: grid;
    align-content: start;
    flex: 1 1 auto;
    gap: 3px;
    min-height: 0;
    padding: 12px 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(118, 220, 196, 0.38) transparent;
  }

  .side-menu-group {
    display: grid;
    gap: 4px;
    margin-bottom: 5px;
  }

  .side-menu-group + .side-menu-group {
    padding-top: 9px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
  }

  .side-menu-heading {
    margin: 0;
    padding: 0 10px 3px;
    color: rgba(230, 244, 239, 0.46);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.12em;
  }

  .side-link {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 0 10px;
    color: rgba(239, 248, 245, 0.76);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 17px;
    line-height: 1.35;
    text-align: left;
    transition: color var(--ease), background var(--ease), border-color var(--ease), transform var(--ease);
  }

  .side-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    transform: translateX(2px);
  }

  .side-link.active {
    color: #fff;
    background: rgba(98, 214, 187, 0.14);
    border-color: rgba(98, 214, 187, 0.2);
    box-shadow: inset 3px 0 0 #62d6bb;
  }

  .side-link-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .menu-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    margin-left: auto;
    padding: 0 6px;
    color: #092c25;
    background: #76dcc4;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
  }

  .sidebar-footer {
    flex: 0 0 auto;
    margin-top: auto;
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
  }

  .logout-button {
    width: 100%;
    min-height: 44px;
    color: rgba(239, 248, 245, 0.78);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 16px;
  }

  .logout-button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
  }

  .content {
    width: 100%;
    min-width: 0;
    padding: 24px clamp(18px, 2vw, 32px) 48px;
    overflow: auto;
  }

  /*
   * Keep the desktop composition intact on smaller computer screens.
   * JavaScript exposes a virtual desktop canvas and this transform scales the
   * application shell without triggering a different grid arrangement.
   * Dialogs and floating tooltips stay outside the transformed shell so their
   * viewport positioning remains accurate.
   */
  @media (min-width: 761px) {
    html.desktop-canvas-mode,
    html.desktop-canvas-mode body.production-body {
      width: 100%;
      height: 100%;
      min-height: 0;
      overflow: hidden;
    }

    html.desktop-canvas-mode .app-layout {
      width: var(--desktop-canvas-width);
      height: var(--desktop-canvas-height);
      min-height: var(--desktop-canvas-height);
      transform: scale(var(--desktop-canvas-scale));
      transform-origin: top left;
    }

    html.desktop-canvas-mode .sidebar,
    html.desktop-canvas-mode .content {
      height: var(--desktop-canvas-height);
      max-height: var(--desktop-canvas-height);
    }
  }

  .page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
  }

  .page-head > div:first-child {
    min-width: 0;
  }

  .page-head h1 {
    margin: 0;
    color: var(--text);
    font-size: clamp(28px, 2.2vw, 36px);
    font-weight: 760;
    line-height: 1.12;
    letter-spacing: -0.035em;
  }

  .page-head p:not(.page-kicker) {
    max-width: 760px;
    margin: 7px 0 0;
    color: var(--text-soft);
    font-size: 14px;
  }

  .page-kicker,
  .panel-eyebrow,
  .resource-eyebrow {
    margin: 0 0 5px;
    color: var(--brand);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.09em;
  }

  .head-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    flex-wrap: wrap;
  }
}

@layer components {
  .card-panel,
  .profile-card,
  .form-panel,
  .stats-rank-card,
  .drawing-library-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-panel);
  }

  .card-panel,
  .profile-card,
  .form-panel {
    margin-bottom: 16px;
    padding: 20px;
  }

  .card-panel > h2,
  .profile-card > h2,
  .form-panel > h2,
  .stats-rank-card > h2 {
    margin: 0 0 16px;
    color: var(--text);
    font-size: 20px;
    font-weight: 720;
    letter-spacing: -0.015em;
  }

  .primary-button,
  .ghost-button,
  .danger-button,
  .small-primary,
  .action-btn,
  .icon-button,
  .small-ghost,
  .link-danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--control-h);
    padding: 0 16px;
    border-radius: var(--radius-control);
    font-weight: 720;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: transform var(--ease), color var(--ease), background var(--ease), border-color var(--ease), box-shadow var(--ease);
  }

  .primary-button,
  .small-primary {
    color: #fff;
    background: var(--brand);
    border: 1px solid var(--brand);
    box-shadow: 0 1px 2px rgba(6, 77, 64, 0.14);
  }

  .primary-button:hover,
  .small-primary:hover {
    background: var(--brand-strong);
    border-color: var(--brand-strong);
  }

  .ghost-button,
  .action-btn,
  .small-ghost,
  .icon-button {
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line-strong);
  }

  .ghost-button:hover,
  .action-btn:hover,
  .small-ghost:hover,
  .icon-button:hover {
    color: var(--brand-strong);
    background: var(--brand-quiet);
    border-color: #9ec9bd;
  }

  .danger-button {
    color: #fff;
    background: var(--danger);
    border: 1px solid var(--danger);
  }

  .danger-button:hover {
    background: #a92e29;
    border-color: #a92e29;
  }

  .link-danger-button {
    min-height: 30px;
    padding: 0 7px;
    color: var(--danger);
    background: transparent;
    border: 0;
    font-size: 12px;
  }

  .small-primary,
  .small-ghost,
  .action-btn,
  .tiny,
  .ghost-button.small {
    min-height: 34px;
    padding-inline: 11px;
    font-size: 13px;
  }

  .icon-button {
    width: 38px;
    min-height: 38px;
    padding: 0;
  }

  .full-button {
    width: 100%;
  }

  button:disabled,
  .primary-button:disabled,
  .ghost-button:disabled {
    cursor: not-allowed;
    color: #8b9994;
    background: #edf1ef;
    border-color: #dce3df;
    box-shadow: none;
  }

  button:not(:disabled):active,
  button.is-pressing,
  .side-link.is-pressing,
  .dashboard-card.is-pressing,
  .stats-kpi.is-pressing,
  .stats-rank-card.is-pressing {
    transform: translateY(1px) scale(0.985);
  }

  .input,
  input,
  select,
  textarea {
    width: 100%;
    min-width: 0;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-control);
    outline: 0;
    transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
  }

  .input,
  input,
  select {
    min-height: var(--control-h);
    padding: 0 12px;
  }

  textarea,
  .textarea {
    min-height: 96px;
    padding: 11px 12px;
    line-height: 1.55;
    resize: vertical;
  }

  .big-input {
    min-height: 52px;
    font-size: 18px;
  }

  input::placeholder,
  textarea::placeholder {
    color: #98a49f;
  }

  input:hover,
  select:hover,
  textarea:hover,
  .input:hover {
    border-color: #aebbb5;
  }

  input:focus,
  select:focus,
  textarea:focus,
  .input:focus,
  .operator-picker-trigger:focus {
    border-color: var(--brand);
    box-shadow: var(--focus);
  }

  .wheel-date-input {
    padding-right: 40px !important;
    cursor: pointer;
    caret-color: transparent;
    background-image:
      linear-gradient(45deg, transparent 50%, #77847f 50%),
      linear-gradient(135deg, #77847f 50%, transparent 50%);
    background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px;
    background-repeat: no-repeat;
    background-size: 5px 5px, 5px 5px;
  }

  .form-grid,
  .assignment-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-grid.four,
  .assignment-form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .form-grid.compact-grid {
    gap: 10px;
  }

  .field-block,
  .form-grid label,
  .confirm-input-wrap {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 680;
  }

  .permission-toggle {
    grid-template-columns: auto 1fr;
    align-items: center;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
  }

  .permission-toggle[hidden] {
    display: none;
  }

  .permission-toggle input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
  }

  .permission-toggle span {
    display: grid;
    gap: 2px;
  }

  .permission-toggle small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
  }

  .security-badge {
    display: inline-flex;
    margin-left: 6px;
    padding: 3px 7px;
    border-radius: 999px;
    background: #fff1c9;
    color: #825500;
    font-size: 10px;
    font-weight: 750;
  }

  .span-2 {
    grid-column: span 2;
  }

  .field-help,
  .form-note,
  .subtext,
  .muted-text {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
  }

  .form-note {
    margin: 12px 0 0;
    line-height: 1.65;
  }

  .form-actions,
  .modal-actions,
  .row-actions,
  .icon-actions,
  .file-actions,
  .card-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
  }

  .form-actions {
    grid-column: 1 / -1;
    margin-top: 2px;
  }

  .toolbar-row,
  .stats-filter-bar,
  .drill-filter-bar,
  .filter-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
  }

  .toolbar-row.filter-grid,
  .stats-filter-bar.filter-grid,
  .drill-filter-bar.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(164px, 1fr));
    align-items: end;
    gap: 11px;
  }

  .card-panel > .toolbar-row:not(#resultFilters) + .table-scroll {
    margin-top: 12px;
  }

  #btnFillRemaining {
    margin-top: 8px;
  }

  .filter-field {
    display: grid;
    gap: 6px;
    min-width: 0;
  }

  .filter-field > span {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
  }

  .search-input {
    flex: 1 1 250px;
  }

  .select-input,
  .date-input {
    flex: 0 1 190px;
  }

  .inline-control {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: var(--control-h);
    color: var(--text-soft);
    font-size: 13px;
  }

  .inline-control input {
    width: 17px;
    min-height: 17px;
    accent-color: var(--brand);
  }

  .segmented-control,
  .stats-switch-row {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(78px, auto);
    gap: 3px;
    padding: 3px;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .segmented-control button,
  .stats-switch-row button {
    min-height: 36px;
    padding: 0 13px;
    color: var(--text-soft);
    background: transparent;
    border: 0;
    border-radius: 9px;
    font-weight: 680;
  }

  .segmented-control button.active,
  .stats-switch-row button.active {
    color: var(--brand-strong);
    background: #fff;
    box-shadow: 0 1px 4px rgba(20, 40, 34, 0.11);
  }

  .table-scroll {
    width: 100%;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
    scrollbar-gutter: stable;
  }

  .data-table {
    width: 100%;
    min-width: 860px;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--text);
    font-size: 13px;
  }

  .wide-table,
  .results-table {
    min-width: 1080px;
  }

  #viewAdjustments .data-table :is(th, td):nth-child(-n + 3) {
    white-space: nowrap;
  }

  #viewAdjustments .data-table :is(th, td):nth-child(1) {
    min-width: 110px;
  }

  #viewAdjustments .data-table :is(th, td):nth-child(2) {
    min-width: 80px;
  }

  #viewAdjustments .data-table :is(th, td):nth-child(3) {
    min-width: 100px;
  }

  #viewAdjustments .data-table :is(th, td):nth-child(5) {
    min-width: 320px;
  }

  #viewAdjustments .data-table :is(th, td):nth-child(6) {
    min-width: 120px;
  }

  #viewAdjustments .data-table :is(th, td):nth-child(9) {
    min-width: 80px;
    white-space: nowrap;
  }

  #viewAdjustments .data-table :is(th, td):last-child {
    width: 186px;
    min-width: 186px;
    white-space: nowrap;
  }

  #viewAdjustments .data-table tbody tr {
    height: 64px;
  }

  #viewAdjustments .row-actions {
    flex-wrap: nowrap;
    justify-content: flex-start;
  }

  #viewAdjustments .row-actions > button {
    flex: 0 0 48px;
    width: 48px;
    height: 34px;
    min-height: 34px;
    padding: 0;
  }

  .data-table th,
  .data-table td {
    padding: 12px 13px;
    border-bottom: 1px solid #e6ebe8;
    text-align: left;
    vertical-align: middle;
  }

  .data-table th {
    position: sticky;
    z-index: 2;
    top: 0;
    color: #586762;
    background: #f5f7f5;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.025em;
    white-space: nowrap;
  }

  .data-table tbody tr:last-child td {
    border-bottom: 0;
  }

  .data-table tbody tr {
    transition: background var(--ease), box-shadow var(--ease);
  }

  .data-table tbody tr:hover {
    background: #f6faf8;
    box-shadow: inset 3px 0 0 rgba(8, 123, 103, 0.38);
  }

  .table-total,
  .status-pill,
  .blue-badge,
  .account-status,
  .legacy-tag,
  .resource-chip,
  .quality-gap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 25px;
    padding: 2px 9px;
    color: var(--text-soft);
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.2;
    white-space: nowrap;
  }

  .status-pill,
  .blue-badge {
    color: var(--info);
    background: var(--info-soft);
    border-color: #cfe0f8;
  }

  .status-pill.green,
  .account-status.green,
  .green-badge {
    color: var(--success);
    background: var(--success-soft);
    border-color: #c9ead6;
  }

  .status-pill.orange,
  .legacy-tag,
  .quality-gap {
    color: #8e5009;
    background: var(--warning-soft);
    border-color: #efdbb8;
  }

  .status-pill.red,
  .account-status.red {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #f0cbc7;
  }

  .green-text { color: var(--success) !important; }
  .orange-text { color: var(--warning) !important; }
  .red-text { color: var(--danger) !important; }

  .table-link,
  .stat-link,
  .result-order-link,
  .progress-order-link,
  .progress-operator-toggle,
  .drill-breadcrumb-link {
    padding: 0;
    color: var(--brand);
    background: transparent;
    border: 0;
    font: inherit;
    font-weight: 720;
    text-align: left;
  }

  .table-link:hover,
  .stat-link:hover,
  .result-order-link:hover,
  .progress-order-link:hover,
  .progress-operator-toggle:hover,
  .drill-breadcrumb-link:hover {
    color: var(--brand-strong);
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .empty-cell,
  .empty-library,
  .timeline-empty,
  .rank-empty,
  .empty-hint {
    padding: 34px 18px !important;
    color: var(--muted);
    background: var(--surface-soft);
    text-align: center;
  }

  .empty-cell::before,
  .empty-library::before,
  .timeline-empty::before {
    display: block;
    margin-bottom: 6px;
    color: #a6b2ad;
    content: "—";
    font-size: 22px;
  }
}

@layer pages {
  .production-body {
    background: var(--bg);
  }

  .dashboard-head,
  .library-head {
    align-items: flex-end;
  }

  /* Login */
  .login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    background:
      radial-gradient(circle at 18% 18%, rgba(8, 123, 103, 0.09), transparent 34%),
      linear-gradient(145deg, #edf3f0 0%, #f8faf9 56%, #eef2f0 100%);
  }

  .login-shell {
    width: min(470px, 100%);
  }

  .login-card {
    padding: 30px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(210, 220, 215, 0.92);
    border-radius: 24px;
    box-shadow: 0 28px 80px rgba(23, 48, 40, 0.13);
    backdrop-filter: blur(18px);
  }

  .login-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
  }

  .login-title img {
    width: 52px;
    height: 52px;
    object-fit: contain;
  }

  .login-title h1 {
    margin: 0;
    color: var(--text);
    font-size: 25px;
    font-weight: 770;
    letter-spacing: -0.03em;
  }

  .login-title p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
  }

  .login-system-notice {
    display: grid;
    gap: 5px;
    margin-bottom: 18px;
    padding: 13px 14px;
    color: #3e5a52;
    background: var(--brand-quiet);
    border: 1px solid #d3e9e2;
    border-radius: 12px;
    line-height: 1.55;
  }

  .login-system-notice strong {
    color: var(--brand-strong);
    font-size: 13px;
  }

  .login-system-notice span,
  .login-note {
    color: var(--text-soft);
    font-size: 12px;
  }

  .login-switch {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3px;
    margin-bottom: 18px;
    padding: 3px;
    background: var(--surface-muted);
    border-radius: 12px;
  }

  .login-switch:has(button:only-child) {
    grid-template-columns: 1fr;
  }

  .login-switch button {
    min-height: 38px;
    color: var(--text-soft);
    background: transparent;
    border: 0;
    border-radius: 9px;
    font-weight: 700;
  }

  .login-switch button.active {
    color: var(--brand-strong);
    background: #fff;
    box-shadow: 0 1px 4px rgba(20, 40, 34, 0.1);
  }

  .login-form {
    display: grid;
    gap: 14px;
  }

  .login-form label {
    display: grid;
    gap: 7px;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 680;
  }

  .login-form .primary-button {
    margin-top: 4px;
  }

  .login-form .remember-login-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    cursor: pointer;
  }

  .login-form .remember-login-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
  }

  .login-form .remember-login-row span {
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  .login-form .remember-login-row small {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
  }

  #registerForm {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #registerForm > label:first-child,
  #registerForm > label:last-of-type,
  #registerForm > .capability-disclosure,
  #registerForm > .primary-button {
    grid-column: 1 / -1;
  }

  .quantity-rule-field {
    align-content: start;
  }

  .checkbox-inline {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: var(--control-h);
    padding: 0 12px;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-weight: 650;
  }

  .checkbox-inline input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
  }

  .input-action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .login-note {
    margin: 14px 0 0;
    line-height: 1.65;
  }

  .login-message {
    min-height: 20px;
    margin-top: 12px;
    color: var(--success);
    font-size: 13px;
  }

  .login-message.error {
    color: var(--danger);
  }

  .role-switcher-body {
    align-items: start;
    overflow-y: auto;
  }

  .role-switcher-body .login-shell {
    width: min(920px, 100%);
    margin: auto;
  }

  .role-switcher-body .login-card {
    padding: 28px;
  }

  .role-switcher-body .login-title {
    margin-bottom: 16px;
  }

  .test-role-notice {
    margin-bottom: 14px;
  }

  .test-entry-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 14px;
    padding: 4px;
    background: var(--surface-muted);
    border-radius: 13px;
  }

  .test-entry-switch button {
    min-height: 42px;
    color: var(--text-soft);
    background: transparent;
    border: 0;
    border-radius: 10px;
    font-weight: 760;
    cursor: pointer;
  }

  .test-entry-switch button.active {
    color: #fff;
    background: var(--brand);
    box-shadow: 0 4px 14px rgba(8, 123, 103, 0.18);
  }

  .test-role-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .test-role-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 86px;
    padding: 13px 14px;
    color: var(--text);
    text-align: left;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(22, 40, 34, 0.04);
    cursor: pointer;
    transition: transform var(--ease), border-color var(--ease), box-shadow var(--ease), background-color var(--ease);
  }

  .test-role-card:hover {
    transform: translateY(-2px);
    background: var(--brand-quiet);
    border-color: #88bdad;
    box-shadow: 0 10px 24px rgba(20, 58, 47, 0.09);
  }

  .test-role-card:focus-visible {
    outline: none;
    box-shadow: var(--focus);
  }

  .test-role-card:disabled {
    cursor: wait;
    opacity: 0.58;
  }

  .test-role-card.is-loading {
    opacity: 1;
    background: var(--brand-soft);
    border-color: var(--brand);
  }

  .test-role-index {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: var(--brand-strong);
    background: var(--brand-soft);
    border: 1px solid #c5e4da;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 800;
  }

  .test-role-copy {
    display: grid;
    gap: 5px;
    min-width: 0;
  }

  .test-role-copy strong {
    color: var(--text);
    font-size: 16px;
  }

  .test-role-copy small {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .test-role-arrow {
    padding: 6px 9px;
    color: var(--brand-strong);
    background: var(--brand-quiet);
    border-radius: 9px;
    font-size: 12px;
    font-weight: 760;
  }

  .test-role-tip {
    margin: 13px 0 0;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
  }

  /* Dashboard */
  #viewDashboard.active {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    gap: 16px;
  }

  #viewDashboard .page-head,
  #viewDashboard .card-panel {
    margin-bottom: 0;
  }

  #viewDashboard .page-head h1 {
    font-size: clamp(28px, 2vw, 32px);
  }

  .dashboard-command {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(560px, 1.1fr) minmax(480px, 0.9fr);
    gap: 16px;
    align-items: stretch;
    padding: 18px;
    overflow: hidden;
    color: #ecfffb;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.98), rgba(20, 33, 31, 0.98)), #14211f;
    border: 1px solid rgba(94, 234, 212, 0.26);
    border-radius: 8px;
    box-shadow: 0 20px 54px rgba(27, 47, 44, 0.14);
  }

  .dashboard-command::before {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    content: "";
    background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.13) 42%, transparent 68%);
  }

  .dashboard-command::after {
    position: absolute;
    right: -80px;
    bottom: -120px;
    z-index: 0;
    width: 300px;
    height: 300px;
    pointer-events: none;
    content: "";
    background: radial-gradient(circle, rgba(94, 234, 212, 0.16), transparent 66%);
  }

  .dashboard-command-main {
    position: relative;
    z-index: 1;
    display: grid;
    align-content: center;
    min-width: 0;
    align-self: stretch;
    grid-column: 1;
    grid-row: 1;
    padding: 16px;
    background: rgba(255, 255, 255, 0.075);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  .dashboard-command h2 {
    margin: 0;
    color: #fff;
    max-width: 100%;
    font-size: clamp(21px, 1.32vw, 25px);
    font-weight: 740;
    letter-spacing: -0.025em;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .dashboard-command p {
    margin: 7px 0 0;
    color: rgba(238, 252, 248, 0.76);
  }

  .dashboard-command-main > p:not(.panel-eyebrow) {
    max-width: 100%;
    font-size: 17px;
    line-height: 1.5;
  }

  .dashboard-command .panel-eyebrow,
  .dashboard-action-title,
  .dashboard-ai-head strong {
    color: rgba(238, 252, 248, 0.74);
    font-size: 16px;
  }

  .dashboard-focus-line,
  .dashboard-ai-meta,
  .dashboard-ai-links {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
  }

  .dashboard-focus-line {
    margin-top: 15px;
  }

  .focus-chip,
  .dashboard-ai-meta button {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 11px;
    color: #effcf8;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
  }

  .dashboard-ai-meta {
    margin-top: 9px;
    color: rgba(238, 252, 248, 0.6);
    font-size: 11px;
  }

  .dashboard-wip-panel,
  .dashboard-command-actions,
  .dashboard-ai-panel {
    position: relative;
    z-index: 1;
    align-self: stretch;
    min-width: 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.075);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  .dashboard-command-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .dashboard-wip-panel {
    position: relative;
    z-index: 1;
    display: grid;
    grid-column: 1;
    grid-row: 1;
    gap: 12px;
    min-width: 0;
    padding: 15px;
    color: #ecfffb;
    background: rgba(255, 255, 255, 0.075);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  .dashboard-command:not(.dashboard-command-with-ai) {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-command:not(.dashboard-command-with-ai) .dashboard-wip-panel {
    grid-column: 1 / -1;
  }

  .dashboard-ai-panel {
    grid-column: 2;
    grid-row: 1;
    display: grid;
    grid-template-rows: auto auto auto minmax(210px, 1fr);
    align-content: start;
    gap: 8px;
    color: #ecfffb;
    overflow: hidden;
  }

  .dashboard-wip-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
  }

  .dashboard-wip-head h2 {
    margin-top: 2px;
  }

  .dashboard-wip-subtitle {
    max-width: 620px;
    font-size: 13px;
    line-height: 1.55;
  }

  .dashboard-wip-head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    justify-content: flex-end;
    color: rgba(238, 252, 248, 0.68);
    font-size: 11px;
  }

  .dashboard-wip-head-actions span,
  .dashboard-wip-head-actions time {
    white-space: nowrap;
  }

  .dashboard-wip-head-actions button {
    min-height: 30px;
    padding: 0 10px;
    color: #effcf8;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
  }

  .dashboard-wip-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(92px, 1fr));
    gap: 8px;
  }

  .dashboard-wip-kpis > span {
    display: flex;
    gap: 10px;
    align-items: baseline;
    justify-content: space-between;
    min-width: 0;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 7px;
  }

  .dashboard-wip-kpis small {
    color: rgba(238, 252, 248, 0.7);
    font-size: 12px;
    font-weight: 700;
  }

  .dashboard-wip-kpis strong {
    color: #fff;
    font-size: 20px;
    font-variant-numeric: tabular-nums;
  }

  .dashboard-wip-kpis .high strong { color: #fecaca; }
  .dashboard-wip-kpis .attention strong { color: #fed7aa; }
  .dashboard-wip-kpis .normal strong { color: #99f6e4; }

  .dashboard-wip-chart-scroll {
    min-width: 0;
    overflow-x: auto;
    scrollbar-color: rgba(153, 246, 228, 0.48) transparent;
  }

  .dashboard-wip-chart {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, minmax(58px, 1fr));
    gap: 12px;
    align-items: end;
    min-width: 360px;
    height: 180px;
    padding: 14px 8px 0;
  }

  .dashboard-wip-grid {
    position: absolute;
    inset: 14px 8px 34px;
    pointer-events: none;
    background: repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.11) 0,
      rgba(255, 255, 255, 0.11) 1px,
      transparent 1px,
      transparent 25%
    );
  }

  .dashboard-wip-bar {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: minmax(0, 1fr) 28px;
    gap: 5px;
    align-items: end;
    height: 100%;
    padding: 0 6px;
    color: #ecfffb;
    background: transparent;
    border: 0;
    border-radius: 7px;
    text-align: center;
  }

  .dashboard-wip-bar:hover,
  .dashboard-wip-bar:focus-visible {
    z-index: 6;
    background: rgba(255, 255, 255, 0.07);
  }

  .dashboard-wip-bar > strong {
    display: none;
  }

  .dashboard-wip-bar > .dashboard-wip-tooltip {
    display: none;
  }

  .dashboard-wip-floating-tooltip {
    position: fixed;
    z-index: 1200;
    display: grid;
    gap: 8px;
    width: max-content;
    min-width: 198px;
    max-width: 220px;
    padding: 10px 12px;
    color: #173a33;
    pointer-events: none;
    background: rgba(250, 255, 253, 0.98);
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(3, 28, 23, 0.25);
    font-size: 11px;
    animation: dashboard-wip-tooltip-in 120ms ease-out;
  }

  @keyframes dashboard-wip-tooltip-in {
    from {
      opacity: 0;
      transform: translateX(6px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  .dashboard-wip-tooltip-head,
  .dashboard-wip-tooltip-departments,
  .dashboard-wip-tooltip-department {
    display: flex;
  }

  .dashboard-wip-tooltip-head {
    justify-content: space-between;
    gap: 12px;
  }

  .dashboard-wip-tooltip-head strong {
    color: #0f766e;
    font-size: 13px;
  }

  .dashboard-wip-tooltip-head small {
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
  }

  .dashboard-wip-tooltip-departments {
    flex-direction: column;
    gap: 6px;
  }

  .dashboard-wip-tooltip-department {
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    color: #475569;
  }

  .dashboard-wip-tooltip-department b {
    overflow: hidden;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-wip-tooltip-department strong {
    color: #0f766e;
    font-size: 12px;
    white-space: nowrap;
  }

  .dashboard-wip-stack {
    display: flex;
    flex-direction: column;
    align-self: end;
    width: min(54px, 72%);
    min-height: 3px;
    margin: 0 auto;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 6px 6px 2px 2px;
    box-shadow: 0 8px 18px rgba(3, 18, 15, 0.2);
  }

  .dashboard-wip-segment {
    display: block;
    min-height: 0;
  }

  .dashboard-wip-segment.high { background: #ef6a62; }
  .dashboard-wip-segment.attention { background: #f2a13a; }
  .dashboard-wip-segment.normal { background: #4fd1bd; }

  .dashboard-wip-bar > small {
    align-self: start;
    color: rgba(238, 252, 248, 0.82);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.25;
  }

  .dashboard-wip-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    color: rgba(238, 252, 248, 0.74);
    font-size: 12px;
  }

  .dashboard-wip-legend span::before {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 6px;
    border-radius: 2px;
    content: "";
  }

  .dashboard-wip-legend .high::before { background: #ef6a62; }
  .dashboard-wip-legend .attention::before { background: #f2a13a; }
  .dashboard-wip-legend .normal::before { background: #4fd1bd; }

  .dashboard-wip-legend small {
    margin-left: auto;
    color: rgba(238, 252, 248, 0.52);
  }

  .dashboard-wip-empty {
    display: grid;
    place-items: center;
    min-height: 180px;
    color: rgba(238, 252, 248, 0.7);
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 7px;
  }

  .dashboard-action-title {
    color: #f7fffd;
    font-size: 16px;
    font-weight: 800;
  }

  .dashboard-suggestion-list {
    counter-reset: suggestion;
    display: grid;
    gap: 9px;
    margin: 10px 0 0;
    padding: 0;
  }

  .dashboard-suggestion-list li {
    counter-increment: suggestion;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 9px;
    list-style: none;
  }

  .dashboard-suggestion-list li::before {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin-top: 13px;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    content: counter(suggestion);
    font-size: 11px;
    font-weight: 800;
  }

  .dashboard-command-actions button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    min-height: 54px;
    padding: 9px 11px;
    color: #12463b;
    background: rgba(246, 255, 252, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    text-align: left;
  }

  .dashboard-command-actions button::after {
    position: absolute;
    top: 50%;
    right: 12px;
    content: "›";
    font-size: 22px;
    opacity: 0;
    transform: translate(-8px, -50%);
    transition: opacity var(--ease), transform var(--ease);
  }

  .dashboard-command-actions button:hover::after {
    opacity: 0.72;
    transform: translate(0, -50%);
  }

  .dashboard-command-actions button.red { color: #8f302b; background: #fff3f1; }
  .dashboard-command-actions button.orange { color: #87500c; background: #fff7e9; }
  .dashboard-command-actions button.blue,
  .dashboard-command-actions button.cyan { color: #14528c; background: #eef6ff; }
  .dashboard-command-actions button.green { color: #17683d; background: #edf9f2; }

  .focus-action-title {
    font-size: 15px;
    font-weight: 900;
  }

  .focus-action-desc {
    margin-top: 2px;
    color: currentColor;
    font-size: 12px;
    font-weight: 700;
    opacity: 0.72;
  }

  .dashboard-ai-card,
  .dashboard-ai-answer,
  .dashboard-ai-input,
  .dashboard-ai-block,
  .dashboard-ai-result,
  .dashboard-ai-loading,
  .dashboard-ai-empty {
    display: grid;
    gap: 8px;
  }

  .dashboard-ai-head,
  .dashboard-ai-result-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .dashboard-ai-head span,
  .dashboard-ai-input span,
  .dashboard-ai-result-head span,
  .dashboard-ai-block > span {
    color: rgba(236, 255, 251, 0.68);
    font-size: 13px;
    font-weight: 800;
  }

  .dashboard-ai-head strong {
    color: #fff;
    font-size: 15px;
  }

  .dashboard-ai-head button {
    min-height: 28px;
    padding: 0 9px;
    color: #dffdf8;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
  }

  .dashboard-ai-input {
    display: grid;
  }

  .dashboard-ai-input textarea {
    width: 100%;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    resize: none;
    overflow-y: auto;
    color: #07221e;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(204, 251, 241, 0.42);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.45;
  }

  .dashboard-ai-input textarea::placeholder {
    color: #7a8a85;
  }

  .dashboard-ai-submit {
    width: 100%;
    min-height: 34px;
    color: #06221e;
    background: #ccfbf1;
    border: 1px solid rgba(204, 251, 241, 0.8);
    border-radius: 8px;
    font-weight: 900;
  }

  .dashboard-ai-answer {
    height: 100%;
    min-height: 210px;
    max-height: none;
    overflow: auto;
    color: #10231f;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(204, 251, 241, 0.42);
    border-radius: 8px;
  }

  .dashboard-ai-result,
  .dashboard-ai-empty,
  .dashboard-ai-loading {
    padding: 10px 12px;
    color: #10231f;
    background: transparent;
    border: 0;
    border-radius: 0;
  }

  .dashboard-ai-empty {
    align-content: start;
    min-height: 104px;
  }

  .dashboard-ai-empty span {
    color: #0f766e;
    font-size: 13px;
    font-weight: 900;
  }

  .dashboard-ai-empty strong {
    color: #0b2c27;
    font-size: 15px;
    line-height: 1.35;
  }

  .dashboard-ai-result > strong {
    color: #06221e;
    font-size: 15px;
    line-height: 1.35;
  }

  .dashboard-ai-block > span {
    color: #64736f;
  }

  .dashboard-ai-block li {
    color: #213f39;
    font-size: 13px;
    line-height: 1.45;
  }

  .dashboard-ai-block ol {
    display: grid;
    gap: 5px;
    margin: 0;
    padding-left: 18px;
  }

  .dashboard-ai-links button {
    min-height: 28px;
    padding: 0 10px;
    color: #0f4f47;
    background: #e3f6f2;
    border: 1px solid #bdebe3;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
  }

  .dashboard-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(140px, 1fr));
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-panel);
  }

  /* The dashboard progress view is the primary work surface; keep the summary cards out of its flow. */
  #dashboardCards {
    display: none;
  }

  .dashboard-card,
  .stats-kpi {
    position: relative;
    min-width: 0;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-panel);
    text-align: left;
  }

  .dashboard-card {
    min-height: 100px;
    padding: 14px 15px;
    overflow: hidden;
    background: transparent;
    border: 0;
    border-right: 1px solid var(--line-soft);
    border-radius: 0;
    box-shadow: none;
  }

  .dashboard-card:disabled {
    cursor: default;
    color: var(--text);
    background: transparent;
    border-color: var(--line-soft);
  }

  .dashboard-card:last-child {
    border-right: 0;
  }

  .dashboard-card::after,
  .stats-kpi::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--brand);
    content: "";
  }

  .dashboard-card::after {
    content: none;
  }

  .stats-kpi::after {
    content: none;
  }

  .dashboard-card.blue::after,
  .stats-kpi.blue::after { background: var(--info); }
  .dashboard-card.orange::after,
  .stats-kpi.orange::after { background: var(--warning); }
  .dashboard-card.red::after,
  .stats-kpi.red::after { background: var(--danger); }
  .dashboard-card.green::after,
  .stats-kpi.green::after { background: var(--success); }
  .dashboard-card.cyan::after { background: #198fa2; }
  .stats-kpi.purple::after { background: #7a56b4; }

  .dashboard-card:hover,
  .stats-kpi:hover,
  .stats-rank-card:hover {
    transform: translateY(-2px);
    border-color: #b9c9c2;
  }

  .dashboard-card:not(:disabled):hover {
    background: var(--surface-soft);
    border-color: var(--line-soft);
    transform: none;
  }

  .dashboard-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .dashboard-card-label,
  .dashboard-card-top,
  .dashboard-card-hint,
  .stats-kpi span,
  .stats-kpi small {
    color: var(--muted);
    font-size: 12px;
  }

  .dashboard-card-top em {
    padding: 2px 7px;
    color: var(--brand);
    background: var(--brand-soft);
    border-radius: 999px;
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
  }

  .dashboard-card-value,
  .stats-kpi strong {
    display: block;
    margin-top: 8px;
    color: var(--text);
    font-size: 30px;
    font-weight: 760;
    letter-spacing: -0.035em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }

  .dashboard-card-value {
    font-size: 27px;
  }

  .dashboard-card-hint,
  .stats-kpi small {
    display: block;
    margin-top: 8px;
  }

  .dashboard-alert-line {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 9px;
  }

  .dashboard-alert-line button {
    min-height: 28px;
    padding: 0 8px;
    color: var(--warning);
    background: var(--warning-soft);
    border: 0;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 720;
  }

  .dashboard-panel-head,
  .progress-detail-head,
  .result-detail-head,
  .defect-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
  }

  .dashboard-panel-head {
    margin-bottom: 14px;
  }

  .dashboard-progress-sticky-head {
    position: sticky;
    top: -24px;
    z-index: 8;
    margin-top: -24px;
    margin-right: -20px;
    margin-left: -20px;
    width: calc(100% + 40px);
    padding: 24px 20px 0;
    background: #d7eee6;
    border-radius: 0 0 14px 14px;
    box-shadow: none;
  }

  .dashboard-panel-head h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 720;
  }

  .dashboard-table-panel {
    padding: 18px 20px;
  }

  .dashboard-priority-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    min-height: 0;
    overflow: clip;
    border-top: 3px solid var(--brand);
  }

  .dashboard-panel-note {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
  }

  .dashboard-progress-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr) minmax(150px, 0.8fr) minmax(130px, 0.65fr) auto auto;
    align-items: end;
    gap: 10px;
    margin: 0 0 14px;
    padding: 12px;
    background: #d7eee6;
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .dashboard-progress-toolbar > label:not(.dashboard-progress-overdue) {
    display: grid;
    gap: 6px;
    min-width: 0;
  }

  .dashboard-progress-toolbar > label > span:first-child {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 720;
  }

  .dashboard-progress-toolbar .input {
    width: 100%;
    min-width: 0;
  }

  .dashboard-progress-overdue {
    display: inline-flex;
    align-items: center;
    min-height: var(--control-h);
    gap: 8px;
    padding: 0 11px;
    color: var(--text-soft);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    cursor: pointer;
  }

  .dashboard-progress-overdue > input[type="checkbox"] {
    box-sizing: border-box;
    flex: 0 0 16px;
    width: 16px;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 3px;
    box-shadow: none;
    accent-color: var(--danger);
  }

  .dashboard-progress-overdue:focus-within {
    border-color: var(--brand);
    box-shadow: var(--focus);
  }

  .dashboard-progress-overdue span {
    display: grid;
    gap: 1px;
  }

  .dashboard-progress-overdue strong,
  .dashboard-progress-overdue small {
    line-height: 1.1;
  }

  .dashboard-progress-overdue strong {
    font-size: 11px;
  }

  .dashboard-progress-overdue small {
    color: var(--muted);
    font-size: 9px;
  }

  .dashboard-operation-list {
    display: grid;
    grid-auto-rows: max-content;
    align-content: start;
    gap: 12px;
    max-height: none;
    padding: 2px 8px 2px 0;
    overflow: visible;
    overscroll-behavior: auto;
    scrollbar-color: #9fc7bb #eef4f1;
    scrollbar-gutter: auto;
  }

  .operation-progress-card {
    --dashboard-fade-progress: 0;
    --dashboard-fade-opacity: 1;
    --dashboard-fade-blur: 0px;
    min-width: 0;
    padding: 16px 18px 14px;
    overflow: hidden;
    opacity: var(--dashboard-fade-opacity);
    filter: blur(var(--dashboard-fade-blur));
    transform: translate3d(0, calc(var(--dashboard-fade-progress) * -16px), 0);
    transform-origin: center top;
    transition: opacity 180ms linear, filter 220ms linear, transform 220ms cubic-bezier(.22, .72, .2, 1);
    will-change: opacity, filter, transform;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfb 100%);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(22, 40, 34, 0.03);
  }

  .operation-progress-card.is-late {
    border-color: #edc4bf;
    box-shadow: inset 3px 0 0 var(--danger);
  }

  .operation-progress-card.is-scroll-faded {
    pointer-events: none;
  }

  @media (prefers-reduced-motion: reduce) {
    .dashboard-operation-list .operation-progress-card {
      transition: none;
      transform: none;
    }
  }

  .operation-progress-card-head,
  .operation-progress-card-state,
  .operation-progress-meta {
    display: flex;
    align-items: center;
  }

  .operation-progress-card-head {
    justify-content: space-between;
    gap: 16px;
  }

  .operation-progress-order {
    min-width: 0;
  }

  .operation-progress-order .stat-link {
    font-size: 16px;
    font-weight: 780;
  }

  .operation-progress-order > span {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .operation-progress-card-state {
    flex: 0 0 auto;
    gap: 8px;
  }

  .operation-overall {
    padding: 5px 9px;
    color: var(--brand-strong);
    background: var(--brand-soft);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 740;
  }

  .operation-route-count {
    padding: 5px 9px;
    color: var(--text-soft);
    background: #f1f4f2;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 720;
  }

  .operation-progress-meta {
    gap: 7px 16px;
    margin-top: 10px;
    padding-bottom: 12px;
    color: var(--muted);
    font-size: 11px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
  }

  .operation-progress-meta b {
    color: var(--text);
    font-variant-numeric: tabular-nums;
  }

  .operation-progress-meta .is-late,
  .operation-progress-meta .is-late b {
    color: var(--danger);
  }

  .operation-progress-due {
    align-items: flex-start;
    display: inline-flex;
    flex-direction: column;
    line-height: 1.35;
  }

  .operation-progress-overdue {
    display: block;
    font-weight: 720;
  }

  .operation-progress-scroll {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    cursor: grab;
    scrollbar-width: none;
    -ms-overflow-style: none;
    touch-action: pan-x pan-y;
  }

  .operation-progress-scroll::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .operation-progress-scroll.is-dragging {
    cursor: grabbing;
    user-select: none;
  }

  .operation-progress-scroll.is-long {
    padding-bottom: 3px;
  }

  .operation-progress-rail {
    display: flex;
    width: max-content;
    min-width: 100%;
    padding: 15px 2px 4px;
  }

  .operation-progress-rail.is-short {
    justify-content: flex-start;
  }

  .operation-progress-node {
    --operation-color: #aab5b0;
    position: relative;
    z-index: 0;
    flex: 0 0 132px;
    min-width: 132px;
    padding: 0;
    color: var(--muted);
    font: inherit;
    text-align: center;
    appearance: none;
    background: transparent;
    border: 0;
    cursor: pointer;
  }

  .operation-progress-node.is-complete { --operation-color: var(--success); }
  .operation-progress-node.is-active { --operation-color: var(--info); }
  .operation-progress-node.is-inspection { --operation-color: var(--warning); }

  .operation-progress-node.operation-inspection-node,
  .operation-progress-node.operation-review-node {
    cursor: pointer;
  }

  .operation-progress-node:not(:last-child)::after {
    position: absolute;
    z-index: -1;
    top: 31px;
    left: calc(50% + 30px);
    width: calc(100% - 60px);
    height: 2px;
    background: var(--line-strong);
    content: '';
  }

  .operation-progress-node.is-complete:not(:last-child)::after {
    background: linear-gradient(90deg, var(--success), #77b999);
  }

  .operation-progress-ring {
    position: relative;
    display: grid;
    width: 62px;
    height: 62px;
    margin: 0 auto;
    place-items: center;
    background: conic-gradient(
      var(--operation-color) calc(var(--operation-progress) * 1%),
      #e0e6e2 0
    );
    border-radius: 50%;
    transition: transform 160ms ease, box-shadow 160ms ease;
  }

  .operation-progress-ring::before {
    position: absolute;
    inset: 5px;
    background: #fff;
    border: 1px solid rgba(197, 208, 202, 0.72);
    border-radius: inherit;
    content: '';
  }

  .operation-progress-ring span {
    position: relative;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
  }

  .operation-progress-node.is-active .operation-progress-ring,
  .operation-progress-node.is-inspection .operation-progress-ring {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--operation-color) 12%, transparent);
  }

  .operation-progress-node:hover .operation-progress-ring,
  .operation-progress-node:focus-visible .operation-progress-ring {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--operation-color) 16%, transparent), 0 8px 18px rgba(18, 48, 37, 0.13);
  }

  .operation-progress-node:focus-visible {
    outline: none;
  }

  .operation-progress-node > strong {
    display: block;
    max-width: 108px;
    margin: 7px auto 0;
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    font-weight: 720;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .operation-progress-node > small {
    display: block;
    max-width: 110px;
    margin: 2px auto 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .operation-progress-missing,
  .operation-progress-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
  }

  .operation-progress-missing {
    margin-top: 13px;
  }

  .operation-progress-missing > span {
    display: grid;
    flex: 0 0 30px;
    height: 30px;
    color: var(--warning);
    background: var(--warning-soft);
    border-radius: 50%;
    font-weight: 800;
    place-items: center;
  }

  .operation-progress-missing strong,
  .operation-progress-empty strong {
    color: var(--text-soft);
    font-size: 12px;
  }

  .operation-progress-missing p,
  .operation-progress-empty span {
    margin: 2px 0 0;
    font-size: 10px;
  }

  .dashboard-progress-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 11px;
  }

  .dashboard-progress-pagination > div {
    display: inline-flex;
    align-items: center;
    gap: 10px;
  }

  .dashboard-progress-pagination strong {
    min-width: 48px;
    color: var(--text-soft);
    text-align: center;
    font-variant-numeric: tabular-nums;
  }

  .operation-progress-tooltip {
    position: fixed;
    z-index: 3000;
    display: grid;
    width: min(290px, calc(100vw - 20px));
    gap: 6px;
    padding: 12px 14px;
    color: #dce8e2;
    background: rgba(22, 34, 29, 0.97);
    border: 1px solid rgba(160, 193, 178, 0.28);
    border-radius: 11px;
    box-shadow: 0 14px 34px rgba(7, 18, 13, 0.24);
    font-size: 11px;
    line-height: 1.45;
    pointer-events: none;
  }

  .operation-progress-tooltip[hidden] {
    display: none;
  }

  .operation-progress-tooltip strong {
    color: #fff;
    font-size: 12px;
  }

  .operation-progress-tooltip b {
    color: #72deb0;
    font-variant-numeric: tabular-nums;
  }

  .operation-progress-tooltip em {
    margin-top: 2px;
    color: #9eb2a9;
    font-size: 10px;
    font-style: normal;
  }

  .operation-scroll-hint {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    margin-top: 5px;
    color: var(--muted);
    font-size: 9px;
  }

  .operation-scroll-hint span {
    color: var(--brand);
    font-size: 14px;
    line-height: 1;
  }

  /* Desktop dashboard flow: let the page own vertical scrolling. */
  @media (min-width: 721px) {
    #dashboardProgressPanel {
      padding: 14px 16px;
    }

    #dashboardProgressPanel .dashboard-progress-sticky-head {
      margin-right: -16px;
      margin-left: -16px;
      width: calc(100% + 32px);
      padding: 24px 16px 0;
    }

    #dashboardProgressPanel .dashboard-panel-head {
      margin-bottom: 8px;
    }

    #dashboardProgressPanel .dashboard-progress-toolbar {
      margin-bottom: 8px;
      padding: 8px 10px;
    }

    .dashboard-operation-list {
      gap: 7px;
      max-height: none;
      padding: 2px 8px 2px 0;
      overflow: visible;
      overscroll-behavior-y: auto;
      scrollbar-gutter: auto;
    }

    .operation-progress-card {
      display: grid;
      grid-template-areas: "summary meta route";
      grid-template-columns: clamp(220px, 15vw, 250px) clamp(420px, 31vw, 480px) minmax(280px, 1fr);
      justify-content: start;
      column-gap: 8px;
      align-items: center;
      height: 92px;
      min-height: 92px;
      padding: 7px 12px 7px 14px;
    }

    .operation-progress-card-head {
      grid-area: summary;
      display: grid;
      min-width: 0;
      gap: 5px;
      align-content: center;
    }

    .operation-progress-order .stat-link {
      font-size: 14px;
    }

    .operation-progress-order > span {
      margin-top: 1px;
      font-size: 10px;
    }

    .operation-progress-card-state {
      gap: 5px;
      flex-wrap: wrap;
    }

    .operation-overall,
    .operation-route-count {
      padding: 3px 7px;
      font-size: 10px;
    }

    .operation-progress-meta {
      grid-area: meta;
      display: grid;
      grid-template-columns: minmax(190px, 1.45fr) minmax(80px, 0.65fr) minmax(115px, 0.9fr);
      gap: 4px 8px;
      min-width: 0;
      margin: 0;
      padding: 0 8px;
      border-right: 1px solid var(--line);
      border-bottom: 0;
      border-left: 1px solid var(--line);
      font-size: 12px;
      line-height: 1.35;
    }

    .operation-progress-meta > span {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    /* Keep the report count beside the route; let the reporter list use two lines. */
    .operation-progress-meta > span:nth-child(2) {
      grid-column: 3;
      grid-row: 1;
    }

    .operation-progress-meta > span:nth-child(3) {
      grid-column: 2;
      grid-row: 1;
    }

    .operation-progress-meta > .operation-progress-reporters {
      align-self: start;
      display: -webkit-box;
      max-height: 2.7em;
      overflow: hidden;
      line-height: 1.35;
      text-overflow: clip;
      white-space: normal;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
    }

    .operation-progress-meta > .operation-progress-due {
      align-self: start;
      overflow: visible;
      line-height: 1.35;
      text-overflow: clip;
      white-space: normal;
      overflow-wrap: anywhere;
    }

    .operation-progress-scroll {
      grid-area: route;
      min-width: 0;
    }

    .operation-progress-rail {
      align-items: flex-start;
      padding: 2px 0 1px;
    }

    .operation-progress-rail.is-short,
    .operation-progress-rail.is-standard {
      width: max-content;
      justify-content: flex-start;
    }

    .operation-progress-node {
      flex: 0 0 92px;
      flex-basis: 92px;
      min-width: 92px;
    }

    .operation-progress-node:not(:last-child)::after {
      top: 24px;
      left: calc(50% + 24px);
      width: calc(100% - 48px);
      height: 1px;
    }

    .operation-progress-ring {
      width: 48px;
      height: 48px;
    }

    .operation-progress-ring::before {
      inset: 4px;
    }

    .operation-progress-ring span {
      font-size: 11px;
    }

    .operation-progress-node > strong {
      max-width: 88px;
      margin-top: 3px;
      font-size: 12px;
      line-height: 1.1;
    }

    .operation-progress-node > small {
      display: none;
    }

    .operation-progress-missing {
      grid-area: route;
      min-height: 58px;
      margin-top: 0;
      padding: 8px 10px;
    }

    .operation-progress-missing > span {
      flex-basis: 26px;
      height: 26px;
    }

    .operation-scroll-hint {
      display: none;
    }

    #dashboardProgressPanel .dashboard-progress-pagination {
      margin-top: 8px;
    }
  }

  @media (max-width: 720px) {
    .dashboard-progress-sticky-head {
      top: -18px;
      margin-top: -18px;
      margin-right: -20px;
      margin-left: -20px;
      width: calc(100% + 40px);
      padding: 18px 20px 0;
    }

    .dashboard-progress-toolbar {
      grid-template-columns: 1fr 1fr;
    }

    .dashboard-progress-search,
    .dashboard-progress-toolbar .ghost-button {
      grid-column: 1 / -1;
    }

    .operation-progress-card {
      padding: 14px 12px 12px;
    }

    .operation-progress-card-head {
      align-items: flex-start;
      flex-direction: column;
      gap: 8px;
    }

    .operation-progress-card-state {
      flex-wrap: wrap;
    }

    .operation-progress-meta {
      gap: 6px 11px;
    }

    .operation-progress-node {
      flex-basis: 104px;
      min-width: 104px;
    }

    .dashboard-progress-pagination {
      align-items: stretch;
      flex-direction: column;
    }

    .dashboard-progress-pagination > div {
      justify-content: space-between;
    }
  }

  /* Drawing library and order configuration */
  .library-toolbar {
    padding: 14px;
  }

  .drawing-library-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .drawing-library-card {
    min-width: 0;
    padding: 18px;
  }

  .drawing-card-head,
  .drawing-card-actions,
  .file-status-card,
  .resource-summary summary,
  .version-history-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .drawing-card-head h2 {
    margin: 0;
    font-size: 20px;
    letter-spacing: -0.02em;
  }

  .drawing-card-head p,
  .drawing-tech {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
  }

  .resource-summary,
  .version-history-shell {
    margin: 13px 0;
    padding: 10px 11px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 11px;
  }

  .resource-summary.ready { background: var(--success-soft); border-color: #c7e7d3; }
  .resource-summary.complete { background: var(--info-soft); border-color: #cadcf5; }
  .resource-summary.missing { background: var(--warning-soft); border-color: #ead6b2; }

  .resource-summary summary,
  .version-history-head {
    cursor: pointer;
    list-style: none;
  }

  .resource-summary summary::-webkit-details-marker,
  .version-history-head::-webkit-details-marker {
    display: none;
  }

  .resource-summary summary strong {
    display: block;
    color: var(--text);
    font-size: 13px;
  }

  .resource-chip {
    color: var(--brand);
    background: rgba(8, 123, 103, 0.08);
    border-color: rgba(8, 123, 103, 0.14);
  }

  .resource-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .resource-toggle-open { display: none; }

  .resource-toggle-icon {
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform var(--ease);
  }

  .resource-summary[open] .resource-toggle-closed { display: none; }
  .resource-summary[open] .resource-toggle-open { display: inline; }
  .resource-summary[open] .resource-toggle-icon { transform: rotate(-135deg); }

  .resource-compact-line {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 10px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 11px;
  }

  .resource-detail {
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid rgba(95, 113, 107, 0.16);
  }

  .resource-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
  }

  .resource-summary-grid span,
  .resource-file-lines span,
  .version-history,
  .version-history-head {
    color: var(--muted);
    font-size: 11px;
  }

  .resource-summary-grid strong,
  .resource-file-lines strong {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .resource-file-lines,
  .version-history,
  .file-status-grid {
    display: grid;
    gap: 7px;
  }

  .resource-file-lines {
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid rgba(95, 113, 107, 0.16);
  }

  .version-history {
    max-height: 86px;
    margin-top: 7px;
    overflow-y: auto;
  }

  .version-history-empty {
    padding: 8px 0 2px;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
  }

  .version-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
  }

  .version-row > div:first-child {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 7px;
  }

  .file-status-card {
    align-items: center;
    min-height: 56px;
    padding: 9px 11px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
  }

  .file-status-card.ready { background: var(--success-soft); border-color: #c7e7d3; }
  .file-status-card.missing { background: var(--warning-soft); border-color: #ead6b2; }

  .file-status-card span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
  }

  .drawing-card-actions {
    align-items: center;
    margin-top: 14px;
  }

  .drawing-card-actions button {
    flex: 1;
  }

  .order-config-panel {
    padding: 0;
    overflow: visible;
  }

  .order-config-panel > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 66px;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
  }

  .order-config-panel > summary::-webkit-details-marker,
  .order-action-menu > summary::-webkit-details-marker {
    display: none;
  }

  .order-config-panel strong {
    display: block;
    margin-top: 3px;
    font-size: 14px;
  }

  .order-config-toggle {
    color: var(--brand-strong);
    font-size: 13px;
    font-weight: 760;
  }

  .order-config-toggle::after {
    margin-left: 7px;
    content: '⌄';
  }

  .order-config-panel[open] .order-config-toggle::after {
    content: '⌃';
  }

  .order-config-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-top: 1px solid var(--line-soft);
  }

  .order-config-body p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
  }

  .order-prefix-form {
    display: flex;
    gap: 8px;
  }

  .order-prefix-form .input {
    width: 132px;
  }

  .order-worklist-panel {
    position: relative;
    padding: 0;
  }

  .order-worklist-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--line-soft);
  }

  .order-worklist-head h2 {
    margin: 0;
    font-size: 18px;
  }

  .order-worklist-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
  }

  .order-worklist-actions .head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .order-scope-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .order-scope-tabs button {
    min-height: 34px;
    padding: 0 12px;
    color: var(--text-soft);
    background: transparent;
    border: 0;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 720;
  }

  .order-scope-tabs button.active {
    color: var(--brand-strong);
    background: var(--surface);
    box-shadow: 0 1px 4px rgba(16, 42, 35, 0.12);
  }

  .order-scope-tabs button span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 21px;
    min-height: 21px;
    margin-left: 5px;
    padding: 0 6px;
    background: rgba(20, 130, 105, 0.09);
    border-radius: 999px;
    font-size: 11px;
  }

  .order-search-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px 8px;
  }

  .order-search-field {
    flex: 1;
    max-width: none;
  }

  .order-search-field .input {
    width: 100%;
  }

  .order-filter-panel {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
    gap: 12px;
    margin: 0 20px 10px;
    padding: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .order-filter-panel label {
    display: grid;
    gap: 6px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 720;
  }

  .order-filter-panel .ghost-button {
    align-self: end;
    min-width: 118px;
  }

  .order-filter-chips {
    display: flex;
    gap: 7px;
    min-height: 8px;
    padding: 0 20px 8px;
    flex-wrap: wrap;
  }

  .order-filter-chip {
    min-height: 28px;
    padding: 0 9px;
    color: var(--brand-strong);
    background: var(--brand-quiet);
    border: 1px solid #c6e3db;
    border-radius: 999px;
    font-size: 12px;
  }

  .order-filter-chip span {
    margin-left: 5px;
    color: var(--muted);
    font-size: 15px;
  }

  .order-worklist-panel .table-scroll {
    border-top: 1px solid var(--line-soft);
  }

  .order-worklist-table {
    min-width: 760px;
  }

  .order-worklist-table th:nth-child(1) { width: 32%; }
  .order-worklist-table th:nth-child(2) { width: 14%; }
  .order-worklist-table th:nth-child(3) { width: 22%; }
  .order-worklist-table th:nth-child(4) { width: 18%; }
  .order-worklist-table th:nth-child(5) { width: 14%; }

  .order-identity-cell strong {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
  }

  .order-progress-cell {
    min-width: 150px;
  }

  .order-progress-cell > div:first-child {
    display: flex;
    align-items: baseline;
    margin-bottom: 7px;
  }

  .order-progress-cell strong {
    color: var(--brand-strong);
    font-size: 14px;
  }

  .order-progress-cell span {
    color: var(--muted);
    font-size: 12px;
  }

  .order-progress-track {
    width: 100%;
    height: 6px;
    overflow: hidden;
    background: #e5ece9;
    border-radius: 999px;
  }

  .order-progress-track .order-progress-fill {
    display: block;
    height: 100%;
    background: var(--brand);
    border-radius: inherit;
  }

  .order-due-cell {
    display: grid;
    gap: 4px;
  }

  .order-due-cell span {
    color: var(--muted);
    font-size: 12px;
  }

  .order-due-cell .red-text { color: var(--danger); }
  .order-due-cell .orange-text { color: var(--warning); }
  .order-due-cell .green-text { color: var(--success); }

  .order-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
  }

  .order-action-menu {
    position: relative;
  }

  .order-action-menu > summary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    min-height: 34px;
    cursor: pointer;
    list-style: none;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-control);
    font-size: 20px;
    line-height: 1;
  }

  .order-action-menu[open] > summary {
    color: var(--brand-strong);
    background: var(--brand-quiet);
  }

  .order-action-menu-panel {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    right: 0;
    display: grid;
    gap: 5px;
    min-width: 128px;
    padding: 7px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 11px;
    box-shadow: 0 14px 32px rgba(14, 42, 35, 0.17);
  }

  .order-action-menu-panel .action-btn {
    justify-content: flex-start;
    width: 100%;
    border-color: transparent;
  }

  .order-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 58px;
    padding: 10px 20px;
    color: var(--muted);
    border-top: 1px solid var(--line-soft);
    font-size: 12px;
  }

  .order-pagination > div {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .order-pagination strong {
    min-width: 52px;
    color: var(--text-soft);
    text-align: center;
  }

  /* Assignment and reporting */
  .operator-multi-picker {
    position: relative;
  }

  .operator-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: var(--control-h);
    padding: 0 12px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-control);
    text-align: left;
  }

  .operator-picker-trigger::after {
    margin-left: 10px;
    content: "⌄";
    color: var(--muted);
  }

  .operator-picker-panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 7px);
    right: 0;
    left: 0;
    display: none;
    max-height: 260px;
    padding: 9px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    box-shadow: var(--shadow-float);
    backdrop-filter: blur(16px);
  }

  .operator-multi-picker.open .operator-picker-panel {
    display: block;
  }

  .operator-check-list {
    display: grid;
    gap: 6px;
    max-height: 220px;
    padding-right: 3px;
    overflow-y: scroll;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .operator-check-row,
  .check-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    padding: 8px 9px;
    color: var(--text-soft);
    background: var(--surface-soft);
    border: 1px solid #e2e8e5;
    border-radius: 9px;
    font-size: 13px;
  }

  .operator-check-row:hover,
  .check-row:hover {
    background: var(--brand-quiet);
    border-color: #cce3dc;
  }

  .operator-check-row input,
  .check-row input {
    width: 17px;
    min-height: 17px;
    accent-color: var(--brand);
  }

  .operator-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
    gap: 14px;
  }

  .operator-extra-panel {
    margin-top: 14px;
    padding: 13px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .operator-extra-panel summary {
    color: var(--brand-strong);
    cursor: pointer;
    font-weight: 720;
  }

  .operator-extra-panel .form-grid {
    margin-top: 13px;
  }

  .operator-task-panel {
    padding: 14px;
    background: var(--brand-quiet);
    border: 1px solid #d3e8e1;
    border-radius: 12px;
  }

  .team-strip,
  .work-context {
    margin-bottom: 12px;
    padding: 11px 13px;
    color: var(--brand-strong);
    background: var(--brand-quiet);
    border: 1px solid #d0e6df;
    border-radius: 11px;
    font-size: 13px;
    line-height: 1.55;
  }

  .operator-task-main,
  .operator-task-stats {
    display: grid;
    gap: 9px;
  }

  .operator-task-main strong {
    font-size: 18px;
  }

  .operator-task-main span,
  .operator-task-main small,
  .operator-task-stats span {
    color: var(--muted);
    font-size: 12px;
  }

  .operator-task-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 10px;
  }

  .operator-task-stats > div {
    padding: 10px;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 9px;
  }

  .operator-task-stats strong {
    display: block;
    font-size: 18px;
  }

  .operator-correction-panel {
    margin-top: 14px;
  }

  .defect-panel {
    padding: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 13px;
  }

  .defect-panel-head {
    margin-bottom: 12px;
  }

  .defect-panel-head span,
  .defect-counter-label,
  .defect-other-note {
    color: var(--muted);
    font-size: 12px;
  }

  .defect-total {
    color: var(--success);
    font-size: 13px;
    font-weight: 750;
  }

  .defect-total.warn {
    color: var(--warning);
  }

  .defect-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
  }

  .defect-counter {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 6px;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
  }

  .defect-counter-label {
    grid-column: 1 / -1;
    min-height: 34px;
  }

  .defect-step {
    width: 34px;
    min-height: 34px;
    padding: 0;
    color: var(--brand);
    background: var(--brand-soft);
    border: 0;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 750;
  }

  .defect-counter input {
    min-height: 34px;
    padding: 0 5px;
    text-align: center;
  }

  .defect-input {
    font-variant-numeric: tabular-nums;
  }

  .inspect-balance {
    margin-top: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    font-size: 13px;
  }

  .inspect-balance.is-ok {
    color: var(--success);
    background: var(--success-soft);
    border: 1px solid #c7e7d3;
  }

  .inspect-balance.is-warn {
    color: var(--warning);
    background: var(--warning-soft);
    border: 1px solid #ead6b2;
  }

  /* Expandable results and progress */
  .result-summary-row.is-expanded td,
  .progress-summary-row.is-expanded td {
    background: var(--brand-quiet);
  }

  .result-order-cell,
  .progress-order-cell {
    display: grid;
    gap: 4px;
  }

  .result-mini-line,
  .progress-mini-line {
    color: var(--muted);
    font-size: 11px;
  }

  .result-issue-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }

  .result-issue {
    padding: 3px 7px;
    color: var(--info);
    background: var(--info-soft);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
  }

  .result-issue.green { color: var(--success); background: var(--success-soft); }
  .result-issue.orange { color: var(--warning); background: var(--warning-soft); }
  .result-issue.red { color: var(--danger); background: var(--danger-soft); }

  .result-detail-row td,
  .progress-detail-row td {
    padding: 0 !important;
    background: #f7f9f7;
  }

  .progress-status-cell {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
  }

  .result-detail-panel,
  .progress-detail-panel {
    padding: 15px 18px 18px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .result-detail-head,
  .progress-detail-head {
    margin-bottom: 10px;
  }

  .result-detail-head span,
  .progress-detail-head span {
    color: var(--muted);
    font-size: 12px;
  }

  .result-detail-scroll,
  .progress-detail-scroll {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
  }

  .result-detail-table,
  .progress-detail-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    background: #fff;
    font-size: 12px;
  }

  .result-detail-table th,
  .result-detail-table td,
  .progress-detail-table th,
  .progress-detail-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #e7ece9;
    text-align: left;
  }

  .result-expand-btn,
  .progress-expand-btn {
    width: 30px;
    min-height: 30px;
    padding: 0;
    color: var(--brand);
    background: var(--brand-soft);
    border: 0;
    border-radius: 8px;
  }

  /* Timeline */
  .result-operation-panel .result-evidence-note {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
    margin: 0 0 14px;
  }
  .result-operation-panel .result-detail-table td {
    padding: 12px 14px !important;
    vertical-align: top;
    background: #fff;
  }
  .result-operation-panel .result-detail-table th {
    padding: 12px 14px;
  }
  .result-operation-table { min-width: 1020px; }
  .result-operation-panel .result-operation-summary.is-expanded > td {
    background: var(--brand-soft);
  }
  .result-operation-panel .result-piece-detail-row > td {
    padding: 0 !important;
    background: #f1f7f4;
  }
  .result-piece-panel { padding: 18px; }
  .result-piece-table { min-width: 980px; }
  .result-piece-table small, .result-operation-table small {
    display: block;
    color: var(--muted);
    margin-top: 5px;
    line-height: 1.5;
  }
  .result-piece-table td:last-child { max-width: 280px; white-space: normal; overflow-wrap: anywhere; }
  .result-operation-panel .result-evidence-sample > td { background: #f0faf5; }
  .result-operation-panel .result-evidence-not_reported > td { color: var(--muted); }
  .result-piece-pagination { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 14px; }

  .timeline-list {
    display: grid;
    gap: 0;
  }

  .timeline-item {
    display: grid;
    grid-template-columns: 110px 18px minmax(0, 1fr);
    gap: 11px;
    min-height: 62px;
  }

  .timeline-time,
  .timeline-meta,
  .timeline-detail {
    color: var(--muted);
    font-size: 12px;
  }

  .timeline-dot {
    position: relative;
    width: 10px;
    height: 10px;
    margin-top: 6px;
    background: var(--brand);
    border: 2px solid #d5eee7;
    border-radius: 50%;
  }

  .timeline-dot::after {
    position: absolute;
    top: 12px;
    left: 2px;
    width: 2px;
    height: 43px;
    background: #dce5e1;
    content: "";
  }

  .timeline-item:last-child .timeline-dot::after {
    display: none;
  }

  .timeline-title {
    color: var(--text);
    font-weight: 720;
  }

  .timeline-content {
    min-width: 0;
    padding-bottom: 14px;
  }

  /* Statistics */
  .stats-sticky-header {
    position: sticky;
    z-index: 9;
    top: -24px;
    padding-bottom: 1px;
    background: var(--bg);
  }

  .operator-trace-panel {
    margin-top: 14px;
    padding: 16px;
    background: #f3faf7;
    border: 1px solid #b9ded2;
    border-left: 4px solid var(--brand);
    border-radius: 12px;
  }

  .operator-trace-heading,
  .operator-trace-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 14px;
  }

  .operator-trace-heading > div {
    display: grid;
    gap: 5px;
  }

  .operator-trace-heading span,
  .operator-trace-note,
  .operator-trace-count {
    color: var(--muted);
    font-size: 12px;
  }

  .operator-trace-heading strong {
    font-size: 17px;
  }

  .operator-trace-actions {
    margin-top: 14px;
  }

  .operator-trace-actions label {
    display: grid;
    gap: 7px;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
  }

  .operator-trace-note {
    margin: 9px 0 0;
  }

  .operator-trace-feedback,
  .operator-marking-result {
    margin-top: 13px;
    padding: 12px 14px;
    border-radius: 10px;
  }

  .operator-trace-feedback {
    color: var(--brand-strong);
    background: #e6f5ef;
  }

  .operator-marking-result {
    display: grid;
    gap: 5px;
    color: #6c3c00;
    background: #fff0cf;
    border: 1px solid #e7b553;
  }

  .operator-marking-result strong {
    font-size: 24px;
    letter-spacing: 0.04em;
  }

  .operator-marking-result p {
    margin: 0;
  }

  .operator-marking-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
  }

  .stats-topline,
  .stats-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
  }

  .stats-kpi-grid,
  .person-kpi-grid,
  .integrity-summary-grid,
  .drill-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
  }

  .person-kpi-grid {
    grid-template-columns: repeat(5, minmax(150px, 1fr));
  }

  .stats-kpi {
    min-height: 105px;
    padding: 15px;
    overflow: hidden;
  }

  .stat-drill-card {
    width: 100%;
    cursor: pointer;
  }

  .stat-drill-card::before {
    position: absolute;
    top: 12px;
    right: 13px;
    color: #93a09b;
    content: "›";
    font-size: 20px;
  }

  .stats-rank-grid,
  .person-rank-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
  }

  .stats-rank-card {
    min-width: 0;
    padding: 18px;
    transition: transform var(--ease), border-color var(--ease);
  }

  .stats-rank-card h2 {
    margin: 0 0 14px;
    font-size: 18px;
  }

  .rank-list {
    display: grid;
    gap: 7px;
    margin: 0;
    padding: 0;
  }

  .rank-item,
  .rank-action {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    min-height: 58px;
    padding: 8px;
    color: var(--text);
    background: transparent;
    border: 0;
    border-radius: 10px;
    text-align: left;
  }

  .rank-action:hover {
    background: var(--surface-soft);
  }

  .rank-index {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: var(--brand-strong);
    background: var(--brand-soft);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 800;
  }

  .rank-main {
    min-width: 0;
  }

  .rank-title,
  .rank-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rank-title {
    font-weight: 720;
  }

  .rank-subtitle {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
  }

  .rank-value {
    color: var(--brand);
    font-weight: 760;
    font-variant-numeric: tabular-nums;
  }

  .rank-bar {
    grid-column: 2 / -1;
    height: 5px;
    overflow: hidden;
    background: #e6ebe8;
    border-radius: 999px;
  }

  .rank-bar span {
    display: block;
    height: 100%;
    background: var(--brand);
    border-radius: inherit;
  }

  .stats-detail-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .stats-filter-bar {
    display: grid;
    grid-template-columns: repeat(7, minmax(125px, 1fr));
    width: 100%;
  }

  /* Drilldown */
  .drill-hero {
    display: grid;
    grid-template-columns: minmax(280px, 0.72fr) minmax(0, 2.28fr);
    align-items: center;
    gap: 10px 18px;
    margin-bottom: 10px;
    padding: 13px 18px;
    color: #ecfaf6;
    background: linear-gradient(135deg, #174c40, #13231f);
    border-radius: 17px;
  }

  .drill-hero-main {
    min-width: 0;
  }

  .drill-sep {
    color: rgba(236, 250, 246, 0.38);
  }

  .drill-breadcrumb {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 13px;
    color: rgba(236, 250, 246, 0.66);
    font-size: 12px;
  }

  .drill-breadcrumb-link {
    color: #bdece1;
  }

  .drill-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
  }

  .drill-title-block h1 {
    margin: 0;
    color: #fff;
    font-size: 25px;
  }

  .drill-title-block p {
    margin: 5px 0 0;
    color: rgba(236, 250, 246, 0.68);
  }

  .drill-filter-bar .input {
    background: rgba(255, 255, 255, 0.95);
  }

  .drill-filter-bar {
    grid-column: 1 / -1;
    min-height: 38px;
  }

  .drill-breadcrumb {
    margin-bottom: 7px;
  }

  .drill-summary-strip {
    display: grid;
    grid-auto-columns: minmax(112px, 1fr);
    grid-auto-flow: column;
    gap: 7px;
    min-width: 0;
    margin: 0;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .drill-summary-strip:empty {
    display: none;
  }

  .drill-hero:has(.drill-summary-strip:empty) .drill-hero-main {
    grid-column: 1 / -1;
  }

  .drill-summary-strip .stats-kpi {
    min-height: 62px;
    padding: 8px 10px;
    color: #ecfaf6;
    background: rgba(255, 255, 255, 0.075);
    border-color: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: none;
  }

  .drill-summary-strip .stats-kpi:hover {
    background: rgba(255, 255, 255, 0.11);
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
  }

  .drill-summary-strip .stats-kpi span,
  .drill-summary-strip .stats-kpi small {
    color: rgba(236, 250, 246, 0.64);
    font-size: 10px;
  }

  .drill-summary-strip .stats-kpi strong {
    margin-top: 4px;
    color: #fff;
    font-size: 21px;
  }

  .drill-summary-strip .stats-kpi small {
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .drill-insights {
    flex: 0 0 auto;
    margin-bottom: 10px;
    padding: 13px 15px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-panel);
  }

  .drill-insight-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 10px;
  }

  .drill-insight-head h2,
  .drill-insight-head p {
    margin: 0;
  }

  .drill-insight-head h2 {
    margin-top: 2px;
    font-size: 17px;
  }

  .drill-insight-head p {
    color: var(--muted);
    font-size: 11px;
  }

  .operation-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
    gap: 7px;
  }

  .operation-health-card {
    min-width: 0;
    padding: 9px 10px;
    background: #f5f7f6;
    border: 1px solid var(--line);
    border-radius: 10px;
  }

  .operation-health-card.stable {
    background: #edf8f3;
    border-color: #b7ddcf;
  }

  .operation-health-card.warning {
    background: #fff8e9;
    border-color: #ead6a4;
  }

  .operation-health-card.danger {
    background: #fff1ef;
    border-color: #edc3bd;
  }

  .operation-health-head,
  .operation-health-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
  }

  .operation-health-head {
    color: var(--muted);
    font-size: 10px;
  }

  .operation-health-head b {
    color: var(--text-soft);
    font-size: 10px;
  }

  .operation-health-card.stable .operation-health-head b { color: var(--success); }
  .operation-health-card.warning .operation-health-head b { color: var(--warning); }
  .operation-health-card.danger .operation-health-head b { color: var(--danger); }

  .operation-health-card > strong {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .operation-health-rate {
    margin: 5px 0 4px;
    color: var(--brand-strong);
    font-size: 20px;
    font-weight: 820;
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }

  .operation-health-card.danger .operation-health-rate {
    color: var(--danger);
  }

  .operation-health-meta {
    justify-content: flex-start;
    color: var(--muted);
    font-size: 9px;
    flex-wrap: wrap;
  }

  .batch-participant-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 9px;
    overflow-x: auto;
    color: var(--muted);
    font-size: 10px;
    white-space: nowrap;
    scrollbar-width: thin;
  }

  .batch-participant-strip b {
    color: var(--text);
  }

  .batch-participant-strip span {
    padding: 4px 7px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
  }

  .piece-summary-row.is-qualified {
    box-shadow: inset 3px 0 0 var(--success);
  }

  .piece-summary-row.is-open {
    box-shadow: inset 3px 0 0 var(--warning);
  }

  .trace-outcome {
    display: inline-flex;
    padding: 4px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 760;
    white-space: nowrap;
  }

  .trace-outcome.qualified {
    color: #0a704f;
    background: #e5f7ef;
  }

  .trace-outcome.open {
    color: #8a5600;
    background: #fff3d8;
  }

  .piece-trace-expanded > td {
    padding: 0 !important;
    background: #f5f8f6;
  }

  .piece-trace-panel {
    padding: 12px 14px 14px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .piece-trace-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
    color: var(--muted);
    font-size: 10px;
  }

  .piece-trace-panel-head span,
  .piece-trace-panel-head strong {
    display: block;
  }

  .piece-trace-panel-head strong {
    margin-top: 2px;
    color: var(--text);
    font-size: 14px;
  }

  .piece-trace-table-wrap {
    max-width: 100%;
    overflow-x: auto;
  }

  .piece-trace-table {
    width: 100%;
    min-width: 1050px;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
  }

  .piece-trace-table th,
  .piece-trace-table td {
    padding: 7px 9px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 10px;
    text-align: left;
    vertical-align: top;
  }

  .piece-trace-table th {
    color: var(--muted);
    background: #f3f6f4;
  }

  .piece-trace-table td:first-child b,
  .piece-trace-table td:first-child strong,
  .piece-trace-table td:last-child small {
    display: block;
  }

  .piece-trace-table td:first-child b {
    color: var(--brand);
    font-size: 9px;
  }

  .piece-trace-table td:last-child small {
    max-width: 240px;
    margin-top: 2px;
    color: var(--muted);
  }

  .piece-trace-table tr.has-problem td {
    background: #fff1ef;
  }

  .piece-trace-empty {
    padding: 18px;
    color: var(--muted);
    text-align: center;
  }

  /* Desktop profile workspace */
  .profile-desktop-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    flex: 1 1 0;
    width: 100%;
    min-height: 0;
    gap: 14px;
  }

  .profile-desktop-hero {
    display: grid;
    grid-template-columns: minmax(360px, 1.15fr) minmax(300px, 0.85fr);
    gap: 18px 26px;
    padding: 22px 24px;
    overflow: hidden;
    color: #effbf7;
    background:
      radial-gradient(circle at 92% 12%, rgba(119, 204, 177, 0.18), transparent 27%),
      linear-gradient(135deg, #0d6f62, #17322d);
    border: 1px solid rgba(15, 118, 110, 0.28);
    border-radius: 16px;
    box-shadow: 0 14px 30px rgba(24, 51, 45, 0.14);
  }

  .profile-title-block {
    align-self: center;
  }

  .profile-title-block .panel-eyebrow {
    color: #a9e8d5;
  }

  .profile-title-block h1 {
    margin: 4px 0 7px;
    color: #fff;
    font-size: 32px;
    letter-spacing: -0.035em;
  }

  .profile-title-block > p:last-child {
    margin: 0;
    color: rgba(239, 251, 247, 0.7);
  }

  .profile-identity-block {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
    gap: 13px;
    min-width: 0;
    padding: 10px 13px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
  }

  .profile-avatar {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    color: #0c5e54;
    background: #d7f4ea;
    border: 4px solid rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    font-size: 23px;
    font-weight: 820;
  }

  .profile-identity-block > div:last-child {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  .profile-identity-block span,
  .profile-identity-block small {
    color: rgba(239, 251, 247, 0.66);
    font-size: 11px;
  }

  .profile-identity-block strong {
    overflow: hidden;
    color: #fff;
    font-size: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .profile-meta-strip {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
  }

  .profile-meta-strip article {
    min-width: 0;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.065);
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 10px;
    transition: transform var(--ease), background-color var(--ease);
  }

  .profile-meta-strip article:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
  }

  .profile-meta-strip span {
    display: block;
    color: rgba(239, 251, 247, 0.58);
    font-size: 10px;
  }

  .profile-meta-strip strong {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: #fff;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .profile-desktop-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    min-height: 0;
    gap: 14px;
  }

  .profile-performance-card,
  .profile-security-card {
    min-height: 0;
    margin: 0;
  }

  .profile-performance-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .profile-panel-head {
    flex: 0 0 auto;
    margin-bottom: 12px;
  }

  .profile-panel-head h2,
  .profile-security-head h2 {
    margin: 2px 0 4px;
    color: var(--text);
    font-size: 21px;
  }

  .profile-panel-head > div > p:last-child,
  .profile-security-head > p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
  }

  .profile-filter-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(145px, 0.85fr)) repeat(2, minmax(155px, 1fr)) auto auto;
    align-items: end;
    flex: 0 0 auto;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .profile-filter-bar label {
    display: grid;
    gap: 5px;
    min-width: 0;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 720;
  }

  .profile-filter-bar .input {
    width: 100%;
    min-width: 0;
  }

  .profile-filter-bar > button {
    min-width: 82px;
  }

  #viewProfile .person-kpi-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    flex: 0 0 auto;
    margin-bottom: 12px;
  }

  #viewProfile .stats-kpi {
    min-height: 88px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #fff, #f9fbfa);
    box-shadow: none;
  }

  #viewProfile .stats-kpi strong {
    margin-top: 7px;
    font-size: 25px;
  }

  #viewProfile .stats-kpi small {
    margin-top: 6px;
  }

  .profile-performance-card > .table-scroll {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
  }

  .profile-security-card {
    display: flex;
    flex-direction: column;
    padding: 22px;
    overflow: auto;
  }

  .profile-security-head {
    margin-bottom: 16px;
  }

  .profile-security-status {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 11px 12px;
    background: #eef8f4;
    border: 1px solid #cce9df;
    border-radius: 11px;
  }

  .profile-security-status > span {
    width: 9px;
    height: 9px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(24, 155, 111, 0.12);
  }

  .profile-security-status div {
    display: grid;
    gap: 2px;
  }

  .profile-security-status strong {
    color: #17634f;
    font-size: 12px;
  }

  .profile-security-status small {
    color: #668078;
    font-size: 10px;
  }

  .password-form {
    display: grid;
    gap: 12px;
  }

  .password-form label {
    display: grid;
    gap: 6px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 720;
  }

  .profile-security-note {
    margin-top: auto;
    padding-top: 18px;
    color: var(--muted);
    border-top: 1px solid var(--line-soft);
  }

  .profile-security-note strong {
    color: var(--text-soft);
    font-size: 12px;
  }

  .profile-security-note p {
    margin: 5px 0 0;
    font-size: 11px;
    line-height: 1.65;
  }

  /* Integrity */
  .integrity-summary-grid {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
  }

  .integrity-panel-description {
    max-width: 760px;
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
  }

  .integrity-record-list {
    display: grid;
    gap: 18px;
    margin-top: 18px;
  }

  .integrity-record-card {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 22px rgba(23, 47, 39, 0.05);
  }

  .integrity-record-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
    padding: 20px 22px;
    background: #f8faf9;
    border-bottom: 1px solid var(--line);
  }

  .integrity-record-identity {
    display: grid;
    gap: 4px;
    min-width: 0;
  }

  .integrity-record-identity > span {
    color: var(--danger);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
  }

  .integrity-record-identity h3 {
    margin: 0;
    color: var(--text);
    font-size: clamp(22px, 2vw, 30px);
    line-height: 1.15;
  }

  .integrity-record-identity p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 14px;
  }

  .integrity-record-head-side {
    display: grid;
    justify-items: end;
    gap: 12px;
  }

  .integrity-record-state,
  .integrity-record-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
  }

  .integrity-issue-count {
    padding: 5px 10px;
    color: #8a2c27;
    background: var(--danger-soft);
    border: 1px solid #efc7c2;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
  }

  .integrity-record-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border-bottom: 1px solid var(--line);
  }

  .integrity-record-metrics > article {
    display: grid;
    align-content: start;
    gap: 7px;
    min-height: 128px;
    padding: 20px 22px;
    background: var(--surface);
  }

  .integrity-record-metrics > article > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
  }

  .integrity-record-metrics > article > strong {
    color: var(--text);
    font-size: 20px;
    line-height: 1.3;
  }

  .integrity-record-metrics > article > small {
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.55;
  }

  .integrity-report-metrics {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .integrity-record-metrics > article.is-alert {
    background: var(--warning-soft);
  }

  .integrity-record-metrics > article.is-alert > strong {
    color: var(--warning);
  }

  .integrity-record-problems {
    padding: 22px;
  }

  .integrity-record-section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
  }

  .integrity-record-section-title strong {
    color: var(--text);
    font-size: 17px;
  }

  .integrity-record-section-title span {
    color: var(--muted);
    font-size: 12px;
  }

  .integrity-reason-list {
    display: grid;
    gap: 12px;
    min-width: 0;
    max-width: none;
  }

  .integrity-reason-card {
    overflow: hidden;
    background: #fffaf9;
    border: 1px solid #efcec9;
    border-left: 6px solid var(--danger);
    border-radius: 13px;
  }

  .integrity-reason-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 16px;
    color: #812d28;
    background: var(--danger-soft);
  }

  .integrity-reason-title > span {
    padding: 3px 8px;
    color: #fff;
    background: var(--danger);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
  }

  .integrity-reason-title > strong {
    font-size: 16px;
  }

  .integrity-reason-body {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 14px 16px 16px;
  }

  .integrity-explain-block {
    min-height: 112px;
    padding: 13px 14px;
    color: #4f5d58;
    background: #fff;
    border: 1px solid #eadfdd;
    border-radius: 11px;
  }

  .integrity-explain-block > span {
    display: block;
    margin-bottom: 7px;
    color: #8a514b;
    font-size: 12px;
    font-weight: 800;
  }

  .integrity-explain-block > p {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
  }

  .integrity-next-step {
    color: #215d50;
    background: var(--brand-quiet);
    border: 1px solid #c9e1da;
  }

  .integrity-next-step > span {
    color: var(--brand);
  }

  .integrity-empty-state {
    display: grid;
    place-items: center;
    min-height: 250px;
    padding: 34px 20px;
    text-align: center;
    background: #f8faf9;
    border: 1px dashed #bfd0c9;
    border-radius: 15px;
  }

  .integrity-empty-mark {
    position: relative;
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
    background: var(--success-soft);
    border: 1px solid #b9dfc8;
    border-radius: 50%;
  }

  .integrity-empty-mark::before,
  .integrity-empty-mark::after,
  .integrity-empty-mark i {
    position: absolute;
    display: block;
    height: 3px;
    background: var(--success);
    border-radius: 999px;
    content: "";
  }

  .integrity-empty-mark::before {
    width: 15px;
    transform: translate(-8px, 4px) rotate(45deg);
  }

  .integrity-empty-mark::after {
    width: 29px;
    transform: translate(8px, -2px) rotate(-45deg);
  }

  .integrity-empty-mark i {
    display: none;
  }

  .integrity-empty-state > strong {
    color: var(--text);
    font-size: 24px;
  }

  .integrity-empty-state > p {
    max-width: 650px;
    margin: 9px 0 0;
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.65;
  }

  .integrity-empty-state > small {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
  }
}

/* 2026-08 desktop dashboard: operational hierarchy and cross-trace drill-down */
.dashboard-head {
  align-items: end;
  margin-bottom: 14px;
  padding: 2px 2px 0;
}

.dashboard-head h1 {
  font-size: clamp(30px, 2.2vw, 42px);
  letter-spacing: -0.045em;
}

.dashboard-command {
  padding: 14px;
  background: #123c35;
  border: 1px solid #2d5b52;
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(22, 60, 52, 0.15);
}

.dashboard-command::before,
.dashboard-command::after {
  content: none;
}

.dashboard-wip-panel {
  padding: 18px 20px 16px;
  background: #19483f;
  border-color: rgba(255, 255, 255, 0.13);
  border-radius: 12px;
}

.dashboard-wip-head h2 {
  font-size: 24px;
  letter-spacing: -0.025em;
}

.dashboard-wip-head-actions button,
.dashboard-wip-kpis > span {
  min-height: 44px;
}

.dashboard-wip-kpis > span {
  padding: 10px 13px;
  background: rgba(255, 255, 255, 0.075);
  border-radius: 10px;
}

.dashboard-wip-chart {
  height: 192px;
  padding-top: 18px;
}

.dashboard-wip-bar {
  min-height: 44px;
  transition: background-color 140ms ease, transform 140ms ease;
}

.dashboard-wip-bar:hover,
.dashboard-wip-bar:focus-visible {
  transform: translateY(-2px);
}

.dashboard-wip-bar > strong {
  position: absolute;
  top: 1px;
  left: 50%;
  display: block;
  color: #f4fffc;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  transform: translateX(-50%);
}

.dashboard-wip-stack {
  width: min(58px, 66%);
  border-radius: 8px 8px 3px 3px;
}

.dashboard-wip-segment.high { background: #f06d67; }
.dashboard-wip-segment.attention { background: #e8a64a; }
.dashboard-wip-segment.normal { background: #56cbb8; }

.dashboard-wip-kpis {
  grid-template-columns: repeat(6, minmax(110px, 1fr));
}

.dashboard-wip-kpis strong {
  display: inline-flex;
  gap: 4px;
  align-items: baseline;
}

.dashboard-wip-kpis strong em {
  color: rgba(238, 252, 248, 0.62);
  font-size: 11px;
  font-style: normal;
  font-weight: 750;
}

.dashboard-wip-kpis .busiest strong em {
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-wip-density {
  display: grid;
  grid-template-columns: minmax(620px, 1.55fr) minmax(450px, 1fr);
  gap: 12px;
  min-height: 278px;
}

.dashboard-wip-stage-board,
.dashboard-wip-insight-card {
  min-width: 0;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 10px;
}

.dashboard-wip-stage-board {
  padding: 10px;
}

.dashboard-wip-section-head,
.dashboard-wip-insight-title,
.dashboard-wip-stage-row,
.dashboard-wip-stage-columns,
.dashboard-wip-risk-content,
.dashboard-wip-risk-values,
.dashboard-wip-department-list > span,
.dashboard-wip-example-list button {
  display: flex;
  align-items: center;
}

.dashboard-wip-section-head,
.dashboard-wip-insight-title {
  justify-content: space-between;
  gap: 12px;
}

.dashboard-wip-section-head {
  min-height: 30px;
  padding: 0 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dashboard-wip-section-head > span:first-child {
  display: flex;
  gap: 9px;
  align-items: baseline;
}

.dashboard-wip-section-head strong,
.dashboard-wip-insight-title strong {
  color: #f4fffc;
  font-size: 13px;
}

.dashboard-wip-section-head small,
.dashboard-wip-insight-title small,
.dashboard-wip-stage-name small,
.dashboard-wip-stage-total small,
.dashboard-wip-stage-percent small,
.dashboard-wip-example-list small,
.dashboard-wip-quiet {
  color: rgba(238, 252, 248, 0.58);
  font-size: 10px;
}

.dashboard-wip-stage-columns {
  gap: 17px;
  padding-right: 10px;
  color: rgba(238, 252, 248, 0.46);
  font-size: 10px;
}

.dashboard-wip-stage-columns b {
  min-width: 34px;
  font-weight: 650;
  text-align: center;
}

.dashboard-wip-stage-columns b:last-child {
  min-width: 104px;
}

.dashboard-wip-stage-list {
  display: grid;
  gap: 5px;
  padding-top: 6px;
}

.dashboard-wip-stage-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(160px, 1.15fr) 54px 54px minmax(240px, 1.45fr);
  gap: 10px;
  width: 100%;
  min-height: 43px;
  padding: 5px 8px;
  color: #ecfffb;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.dashboard-wip-stage-row:hover,
.dashboard-wip-stage-row:focus-visible {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(255, 255, 255, 0.13);
  transform: translateX(2px);
}

.dashboard-wip-stage-name {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.dashboard-wip-stage-name strong,
.dashboard-wip-stage-name small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-wip-stage-name strong {
  font-size: 12px;
}

.dashboard-wip-stage-total,
.dashboard-wip-stage-percent {
  display: flex;
  gap: 2px;
  align-items: baseline;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.dashboard-wip-stage-total strong,
.dashboard-wip-stage-percent strong {
  color: #fff;
  font-size: 17px;
}

.dashboard-wip-stage-risk {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.dashboard-wip-stage-track {
  display: flex;
  width: 100%;
  height: 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.dashboard-wip-stage-track i {
  display: block;
  height: 100%;
  min-width: 0;
}

.dashboard-wip-stage-track .high { background: #f06d67; }
.dashboard-wip-stage-track .attention { background: #e8a64a; }
.dashboard-wip-stage-track .normal { background: #56cbb8; }

.dashboard-wip-stage-risk > small {
  display: flex;
  gap: 12px;
  color: rgba(238, 252, 248, 0.55);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.dashboard-wip-stage-risk b,
.dashboard-wip-example-list b {
  font-weight: 750;
}

.dashboard-wip-stage-risk .high,
.dashboard-wip-example-list .high { color: #fecaca; }
.dashboard-wip-stage-risk .attention,
.dashboard-wip-example-list .attention { color: #fed7aa; }
.dashboard-wip-stage-risk .normal,
.dashboard-wip-example-list .normal { color: #99f6e4; }

.dashboard-wip-stage-row > .dashboard-wip-tooltip {
  display: none;
}

.dashboard-wip-insights {
  display: grid;
  grid-template-columns: minmax(190px, 0.82fr) minmax(230px, 1.18fr);
  grid-template-rows: auto minmax(116px, 1fr);
  gap: 8px;
  min-width: 0;
}

.dashboard-wip-insight-card {
  padding: 9px 10px;
}

.dashboard-wip-insight-title {
  min-height: 22px;
  margin-bottom: 7px;
}

.dashboard-wip-risk-content {
  justify-content: space-between;
  gap: 10px;
}

.dashboard-wip-risk-ring {
  --high-deg: 0deg;
  --attention-deg: 0deg;
  position: relative;
  display: grid;
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  place-content: center;
  background: conic-gradient(
    #f06d67 0 var(--high-deg),
    #e8a64a var(--high-deg) calc(var(--high-deg) + var(--attention-deg)),
    #56cbb8 calc(var(--high-deg) + var(--attention-deg)) 360deg
  );
  border-radius: 50%;
  isolation: isolate;
  text-align: center;
}

.dashboard-wip-risk-ring::after {
  position: absolute;
  z-index: -1;
  inset: 8px;
  background: #19483f;
  border-radius: 50%;
  content: "";
}

.dashboard-wip-risk-ring strong,
.dashboard-wip-risk-ring small {
  display: block;
}

.dashboard-wip-risk-ring strong {
  color: #fff;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.dashboard-wip-risk-ring small {
  color: rgba(238, 252, 248, 0.58);
  font-size: 9px;
}

.dashboard-wip-risk-values {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(3, minmax(42px, 1fr));
  gap: 5px;
}

.dashboard-wip-risk-values b {
  display: grid;
  gap: 2px;
  color: #fff;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.dashboard-wip-risk-values small {
  color: rgba(238, 252, 248, 0.52);
  font-size: 8px;
  font-weight: 650;
  white-space: nowrap;
}

.dashboard-wip-department-list {
  display: grid;
  gap: 5px;
}

.dashboard-wip-department-list > span {
  display: grid;
  grid-template-columns: minmax(72px, 0.8fr) minmax(70px, 1.5fr) 24px;
  gap: 7px;
  min-width: 0;
  color: rgba(238, 252, 248, 0.75);
  font-size: 10px;
}

.dashboard-wip-department-list b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-wip-department-list i {
  display: block;
  height: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.dashboard-wip-department-list em {
  display: block;
  height: 100%;
  background: #56cbb8;
  border-radius: inherit;
}

.dashboard-wip-department-list strong {
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.dashboard-wip-example-card {
  grid-column: 1 / -1;
}

.dashboard-wip-example-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.dashboard-wip-example-list button {
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  padding: 5px 7px;
  color: #ecfffb;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  text-align: left;
  transition: background-color 140ms ease, transform 140ms ease;
}

.dashboard-wip-example-list button:hover,
.dashboard-wip-example-list button:focus-visible {
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-1px);
}

.dashboard-wip-example-list button > span {
  display: grid;
  min-width: 0;
}

.dashboard-wip-example-list button > span:first-child {
  flex: 1;
}

.dashboard-wip-example-list button > span:last-child {
  justify-items: end;
  text-align: right;
}

.dashboard-wip-example-list strong,
.dashboard-wip-example-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-wip-example-list strong {
  color: #fff;
  font-size: 10px;
}

.dashboard-trace-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(440px, 1.35fr);
  gap: 14px 24px;
  align-items: center;
  margin-top: 14px;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-panel);
}

.dashboard-trace-copy h2 {
  margin: 2px 0 5px;
  color: var(--text);
  font-size: 21px;
  letter-spacing: -0.025em;
}

.dashboard-trace-copy p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-trace-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  padding: 6px;
  background: #f1f6f4;
  border: 1px solid #d9e4df;
  border-radius: 13px;
}

.dashboard-trace-search .input {
  min-height: 44px;
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 14px;
}

.dashboard-trace-search .primary-button {
  min-width: 112px;
  min-height: 44px;
  border-radius: 10px;
}

.dashboard-trace-results {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  max-height: 520px;
  padding-top: 13px;
  overflow: auto;
  border-top: 1px solid var(--line-soft);
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
}

.dashboard-trace-results[hidden] {
  display: none;
}

.dashboard-trace-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 4px;
}

.dashboard-trace-results-head strong {
  color: var(--text);
  font-size: 14px;
}

.dashboard-trace-results-head span,
.dashboard-trace-loading,
.dashboard-trace-empty {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-trace-result {
  overflow: hidden;
  background: #fbfdfc;
  border: 1px solid #dce7e2;
  border-radius: 12px;
}

.dashboard-trace-result[open] {
  background: #fff;
  border-color: #a9d1c6;
  box-shadow: 0 8px 22px rgba(20, 64, 54, 0.07);
}

.dashboard-trace-result summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  min-height: 56px;
  padding: 9px 12px;
  cursor: pointer;
  list-style: none;
}

.dashboard-trace-result summary::-webkit-details-marker { display: none; }

.dashboard-trace-result summary > span:nth-child(2) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.dashboard-trace-result summary strong,
.dashboard-trace-result summary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-trace-result summary strong {
  color: var(--text);
  font-size: 14px;
}

.dashboard-trace-result summary small {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-trace-kind {
  display: inline-grid;
  place-items: center;
  min-width: 62px;
  min-height: 30px;
  padding: 0 9px;
  color: #0f766e;
  background: #e8f5f1;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.dashboard-trace-chain {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 12px;
  background: #f3f8f6;
  border-top: 1px solid #e0ebe6;
}

.dashboard-trace-chain > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.dashboard-trace-chain small,
.dashboard-trace-chain em {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-trace-chain strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-trace-chain > i {
  color: #7fa69c;
  font-size: 22px;
  font-style: normal;
}

.dashboard-trace-events {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 12px;
  list-style: none;
}

.dashboard-trace-mark-audit {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 12px 0;
}

.dashboard-trace-mark-audit > span {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  padding: 6px 9px;
  color: #0d6658;
  background: #e8f5f1;
  border-radius: 999px;
  font-size: 11px;
}

.dashboard-trace-mark-audit em {
  color: #55736b;
  font-style: normal;
}

.dashboard-trace-events li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 9px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
}

.dashboard-trace-step {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #0f766e;
  background: #e6f4f0;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 850;
}

.dashboard-trace-events li > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.dashboard-trace-events strong { color: var(--text); font-size: 13px; }
.dashboard-trace-events span,
.dashboard-trace-events small { color: var(--muted); font-size: 11px; }

.dashboard-trace-empty,
.dashboard-trace-loading {
  display: grid;
  gap: 4px;
  place-items: center;
  min-height: 72px;
  padding: 14px;
}

.dashboard-trace-empty strong { color: var(--text); font-size: 14px; }

@media (max-width: 1050px) {
  .dashboard-trace-panel { grid-template-columns: 1fr; }
  .dashboard-trace-results { grid-column: 1; }
}

.trace-code-preview {
  display: grid;
  gap: 9px;
  padding: 12px 14px;
  background: #f3f8f6;
  border: 1px solid #dbe8e3;
  border-radius: 12px;
}

.trace-code-preview > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
  justify-content: space-between;
}

.trace-code-preview strong { color: var(--text); font-size: 13px; }
.trace-code-preview span,
.trace-code-preview small { color: var(--muted); font-size: 11px; }
.trace-code-preview ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.trace-code-preview li {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px 9px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
}
.trace-code-preview code {
  overflow: hidden;
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trace-code-preview.invalid {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #efc6c1;
}

@media (max-width: 720px) {
  @layer pages {
    .role-switcher-body {
      padding: 10px;
    }

    .role-switcher-body .login-card {
      padding: 18px;
      border-radius: 18px;
    }

    .test-role-grid {
      grid-template-columns: 1fr;
    }

    .test-role-card {
      min-height: 78px;
      padding: 11px 12px;
    }

    .test-role-copy small {
      white-space: normal;
    }
  }
}

@layer overlays {
  .modal-open {
    overflow: hidden;
  }

  .modal-backdrop {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(18, 31, 27, 0.38);
    backdrop-filter: blur(10px);
  }

  .modal {
    width: min(920px, calc(100vw - 40px));
    max-height: calc(100vh - 40px);
    padding: 22px;
    overflow: auto;
    background: var(--surface-raised);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--radius-float);
    box-shadow: var(--shadow-float);
  }

  .modal.narrow,
  .confirm-modal {
    width: min(520px, calc(100vw - 40px));
  }

  .detail-modal {
    width: min(1160px, calc(100vw - 40px));
  }

  .modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
  }

  .modal-head h2 {
    margin: 0;
    font-size: 23px;
    letter-spacing: -0.025em;
  }

  .order-plan-source {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: -4px 0 16px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
    border-radius: 10px;
    background: var(--brand-quiet);
    color: var(--text-soft);
    font-size: 12px;
  }

  .order-plan-source[hidden] {
    display: none;
  }

  .order-plan-source span {
    flex: 0 0 auto;
    padding: 3px 7px;
    border-radius: 7px;
    background: var(--brand);
    color: #fff;
    font-size: 10px;
    font-weight: 750;
  }

  .modal-actions {
    position: sticky;
    bottom: -22px;
    z-index: 5;
    margin: 20px -22px -22px;
    padding: 14px 22px 18px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
  }

  .bom-import-target {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
  }

  .bom-import-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
  }

  .bom-import-steps span {
    padding: 9px 12px;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    text-align: center;
    font-size: 12px;
    font-weight: 680;
  }

  .bom-import-steps span.active {
    color: var(--brand-strong);
    background: var(--brand-soft);
    border-color: rgba(8, 123, 103, 0.28);
  }

  .bom-import-department {
    display: grid;
    grid-template-columns: minmax(100px, 0.35fr) minmax(180px, 0.65fr);
    align-items: center;
    gap: 6px 14px;
    margin: 0 0 14px;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
  }

  .bom-import-department small {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
  }

  .bom-import-dropzone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    background: var(--surface-soft);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-panel);
    transition: border-color var(--ease), background var(--ease), transform var(--ease);
  }

  .bom-import-dropzone.is-dragging {
    background: var(--brand-soft);
    border-color: var(--brand);
    transform: scale(0.995);
  }

  .bom-import-dropzone strong,
  .bom-import-dropzone p {
    display: block;
    margin: 0;
  }

  .bom-import-dropzone p {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
  }

  .bom-import-loading {
    margin-top: 14px;
    padding: 16px;
    color: var(--brand-strong);
    background: var(--brand-soft);
    border-radius: var(--radius-control);
    text-align: center;
    font-weight: 680;
  }

  .bom-import-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0 12px;
  }

  .bom-import-summary article {
    min-width: 0;
    padding: 13px 14px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
  }

  .bom-import-summary span,
  .bom-import-summary small,
  .bom-import-summary strong {
    display: block;
  }

  .bom-import-summary span,
  .bom-import-summary small {
    color: var(--muted);
    font-size: 11px;
  }

  .bom-import-summary strong {
    margin: 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 20px;
  }

  .bom-import-messages {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
  }

  .bom-import-message {
    display: flex;
    gap: 10px;
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--radius-control);
    font-size: 12px;
    line-height: 1.55;
  }

  .bom-import-message.warning {
    color: var(--warning);
    background: var(--warning-soft);
  }

  .bom-import-message.danger {
    color: var(--danger);
    background: var(--danger-soft);
  }

  .bom-import-table-scroll {
    max-height: 46vh;
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
  }

  .bom-import-table {
    min-width: 1720px;
    table-layout: fixed;
  }

  .bom-import-table th:nth-child(1),
  .bom-import-table th:nth-child(3) { width: 19%; }

  .bom-import-table th:nth-child(2),
  .bom-import-table th:nth-child(4) { width: 12%; }

  .bom-import-table th:nth-child(5),
  .bom-import-table th:nth-child(6) { width: 14%; }

  .bom-import-table th:nth-child(7) { width: 10%; }

  .bom-import-table th:nth-child(8),
  .bom-import-table th:nth-child(9),
  .bom-import-table th:nth-child(10) { width: 9%; }

  .bom-import-table td {
    white-space: normal;
    word-break: break-word;
  }

  .bom-import-code,
  .bom-u9-code {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
  }

  .bom-import-code {
    color: var(--text);
    font-size: 12px;
  }

  .bom-u9-code {
    color: var(--brand-strong);
    font-size: 12px;
    font-weight: 700;
  }

  .bom-level,
  .bom-import-action {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 720;
    white-space: nowrap;
  }

  .bom-level {
    color: var(--brand-strong);
    background: var(--brand-soft);
  }

  .bom-import-action.new {
    color: var(--info);
    background: var(--info-soft);
  }

  .bom-import-action.reuse {
    color: var(--success);
    background: var(--success-soft);
  }

  .bom-import-action.blocked {
    color: var(--danger);
    background: var(--danger-soft);
  }

  .confirm-message {
    margin: 0 0 16px;
    padding: 13px 14px;
    color: var(--text-soft);
    background: var(--surface-soft);
    border-left: 4px solid var(--brand);
    border-radius: 0 10px 10px 0;
    line-height: 1.65;
  }

  .detail-section-title {
    margin: 20px 0 10px;
    color: var(--text);
    font-size: 15px;
  }

  .operation-trace-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
  }

  .operation-trace-heading .detail-section-title {
    margin: 0 0 4px;
  }

  .operation-trace-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
  }

  .operation-trace-count {
    flex: 0 0 auto;
    padding: 5px 9px;
    color: var(--brand-strong);
    background: var(--brand-soft);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
  }

  .operation-participants {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
    margin: 10px 0;
  }

  .operation-participant-card {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 10px 11px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .operation-participant-avatar {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: var(--brand-strong);
    background: var(--brand-soft);
    border-radius: 50%;
    font-weight: 760;
  }

  .operation-participant-card strong,
  .operation-participant-card span {
    display: block;
  }

  .operation-participant-card span,
  .operation-participant-card small,
  .operation-participants-empty {
    color: var(--muted);
    font-size: 12px;
  }

  .operation-participant-card span {
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .operation-participant-card small {
    white-space: nowrap;
  }

  .operation-holder-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
  }

  .operation-holder-search {
    display: flex;
    flex: 1 1 240px;
    align-items: center;
    gap: 8px;
    max-width: 380px;
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
  }

  .operation-holder-search span {
    white-space: nowrap;
  }

  .operation-holder-search .input {
    min-width: 0;
    min-height: 34px;
    padding: 6px 9px;
  }

  .operation-holder-toggle {
    min-height: 32px;
    padding: 5px 9px;
    font-size: 12px;
  }

  .operation-holder-panel {
    max-height: 144px;
    margin: 8px 0 10px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .operation-holder-panel.is-expanded {
    max-height: 240px;
  }

  .operation-holder-panel:focus-visible {
    outline: 2px solid var(--brand-strong);
    outline-offset: 2px;
  }

  .operation-holder-list {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 6px;
    min-width: 0;
  }

  .operation-holder-tag {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 6px;
    min-width: 0;
    max-width: 100%;
    min-height: 32px;
    padding: 5px 8px;
    background: var(--brand-soft);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    font-size: 12px;
  }

  .operation-holder-name {
    max-width: 9em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .operation-holder-state {
    padding: 1px 5px;
    color: var(--brand-strong);
    background: var(--surface);
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
  }

  .operation-holder-quantity {
    color: var(--brand-strong);
    font-weight: 700;
    white-space: nowrap;
  }

  .operation-holder-date {
    display: none;
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
  }

  .operation-holder-panel.is-expanded .operation-holder-tag {
    flex: 1 1 230px;
  }

  .operation-holder-panel.is-expanded .operation-holder-date {
    display: block;
    flex-basis: 100%;
  }

  .operation-holder-search-result {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 12px;
  }

  .operation-history-participants {
    max-height: 160px;
    overflow: auto;
    align-content: start;
    overscroll-behavior: contain;
  }

  .operation-participants-empty {
    padding: 12px;
    background: var(--surface-soft);
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
  }

  .operation-trace-scroll {
    max-height: 360px;
    overflow: auto;
  }

  .operation-trace-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-soft);
  }

  .trace-code-header {
    font-size: 14px;
    font-weight: 800;
  }

  .trace-code-cell {
    font-family: Consolas, "SFMono-Regular", monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: nowrap;
  }

  .trace-code-cell small {
    font: inherit;
  }

  .operation-detail-modal {
    width: min(1080px, calc(100vw - 40px));
  }

  .operation-detail-head {
    margin-bottom: 14px;
  }

  .operation-detail-kicker {
    margin: 0 0 4px;
    color: var(--brand);
    font-size: 12px;
    font-weight: 760;
  }

  .operation-detail-hero {
    display: grid;
    grid-template-columns: 126px minmax(0, 1fr);
    align-items: center;
    gap: 22px;
    padding: 18px;
    background: linear-gradient(135deg, var(--brand-quiet), #fff 70%);
    border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--line));
    border-radius: 16px;
  }

  .operation-detail-ring {
    --operation-detail-color: var(--line-strong);
    position: relative;
    display: grid;
    width: 112px;
    height: 112px;
    place-content: center;
    justify-items: center;
    background: conic-gradient(
      var(--operation-detail-color) calc(var(--operation-progress) * 1%),
      #dfe7e3 0
    );
    border-radius: 50%;
  }

  .operation-detail-ring.is-complete { --operation-detail-color: var(--success); }
  .operation-detail-ring.is-active { --operation-detail-color: var(--info); }
  .operation-detail-ring.is-inspection { --operation-detail-color: var(--warning); }

  .operation-detail-ring::before {
    position: absolute;
    inset: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: inherit;
    content: '';
  }

  .operation-detail-ring strong,
  .operation-detail-ring span {
    position: relative;
  }

  .operation-detail-ring strong {
    color: var(--text);
    font-size: 25px;
    line-height: 1;
  }

  .operation-detail-ring span {
    margin-top: 6px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
  }

  .operation-detail-overview {
    min-width: 0;
  }

  .operation-detail-state {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 12px;
  }

  .operation-detail-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(92px, 1fr));
    gap: 8px;
  }

  .operation-detail-metrics > div,
  .operation-detail-config > div {
    padding: 10px 11px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    border-radius: 10px;
  }

  .operation-detail-metrics span,
  .operation-detail-config span {
    display: block;
    color: var(--muted);
    font-size: 10px;
  }

  .operation-detail-metrics strong,
  .operation-detail-config strong {
    display: block;
    margin-top: 3px;
    color: var(--text);
    font-size: 13px;
  }

  .operation-detail-config {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .operation-detail-event-scroll {
    max-height: 380px;
  }

  .operation-detail-event-table {
    min-width: 980px;
  }

  .detail-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  .meta-box,
  .card-meta {
    padding: 10px 11px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
  }

  .meta-box span,
  .card-meta span {
    display: block;
    color: var(--muted);
    font-size: 11px;
  }

  .meta-box strong,
  .card-meta strong {
    display: block;
    margin-top: 3px;
  }

  .date-wheel-modal {
    width: min(500px, calc(100vw - 28px));
    padding: 0;
    overflow: hidden;
    background: rgba(250, 250, 250, 0.98);
    border-radius: 24px;
  }

  .date-wheel-head {
    padding: 20px 20px 10px;
    margin: 0;
  }

  .date-wheel-preview {
    margin: 0;
    padding: 0 20px 13px;
    color: var(--brand);
    font-size: 20px;
    font-weight: 750;
  }

  .date-wheel-stage {
    position: relative;
    display: grid;
    grid-template-columns: 1.25fr 1fr 1fr;
    height: 220px;
    margin: 0 14px;
    overflow: hidden;
    background: #f2f3f2;
    border-block: 1px solid rgba(80, 91, 87, 0.12);
  }

  .date-wheel-stage::before,
  .date-wheel-stage::after {
    position: absolute;
    z-index: 3;
    right: 0;
    left: 0;
    height: 78px;
    pointer-events: none;
    content: "";
  }

  .date-wheel-stage::before {
    top: 0;
    background: linear-gradient(#f2f3f2 10%, rgba(242, 243, 242, 0));
  }

  .date-wheel-stage::after {
    bottom: 0;
    background: linear-gradient(rgba(242, 243, 242, 0), #f2f3f2 90%);
  }

  .date-wheel-selection {
    position: absolute;
    z-index: 0;
    top: 88px;
    right: 7px;
    left: 7px;
    height: 44px;
    background: rgba(118, 118, 128, 0.12);
    border-radius: 10px;
    pointer-events: none;
  }

  .date-wheel-column {
    position: relative;
    z-index: 1;
    height: 220px;
    padding-block: 88px;
    scroll-padding-block: 88px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
  }

  .date-wheel-column::-webkit-scrollbar {
    display: none;
  }

  .date-wheel-option {
    display: block;
    width: 100%;
    height: 44px;
    padding: 0 6px;
    color: #707975;
    background: transparent;
    border: 0;
    scroll-snap-align: start;
    font-size: 18px;
    font-weight: 500;
    line-height: 44px;
    text-align: center;
  }

  .date-wheel-option.selected {
    color: var(--text);
    font-weight: 760;
  }

  .date-wheel-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1.35fr;
    gap: 9px;
    padding: 15px 18px 18px;
  }

  .date-wheel-quick-actions.required-date {
    grid-template-columns: 1fr 1.35fr;
  }

  .date-wheel-quick-actions button {
    min-height: 44px;
    border-radius: 11px;
  }

  .toast {
    position: fixed;
    z-index: 2200;
    right: 22px;
    bottom: 22px;
    max-width: min(480px, calc(100vw - 32px));
    padding: 12px 15px;
    color: #fff;
    background: #173b33;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 13px;
    box-shadow: 0 16px 44px rgba(12, 31, 25, 0.24);
    line-height: 1.5;
  }

  .toast.error {
    background: #782b27;
  }

  button[data-loading="1"] {
    position: relative;
    color: transparent !important;
    pointer-events: none;
  }

  button[data-loading="1"]::after {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    content: "处理中…";
  }
}

@layer pages {
  @media (min-width: 761px) {
    /*
     * Desktop fixed workspaces:
     * keep each page's title, actions, filters and tabs in place while the
     * record collection scrolls inside its own panel. Mobile keeps the
     * original document flow to avoid nested touch scrolling.
     */
    .fixed-workspace-view.active {
      display: flex;
      flex-direction: column;
      height: calc(var(--desktop-canvas-height, 100dvh) - 72px);
      min-height: 0;
      overflow: hidden;
    }

    .fixed-workspace-view > .page-head {
      flex: 0 0 auto;
      margin-bottom: 16px;
    }

    #unitDispatchWorkspace {
      display: flex;
      flex: 1 1 0;
      flex-direction: column;
      min-height: 0;
      overflow: hidden;
    }

    #unitDispatchWorkspace > .page-head,
    #unitDispatchWorkspace > .task-center-tabs,
    #unitDispatchWorkspace > .unit-summary-strip {
      flex: 0 0 auto;
    }

    #unitDispatchWorkspace > .page-head {
      margin-bottom: 16px;
    }

    #unitDispatchWorkspace > .unit-plan-layout {
      flex: 1 1 0;
      min-height: 0;
      margin-bottom: 0;
      align-items: stretch;
      overflow: hidden;
    }

    #unitDispatchWorkspace .planning-master-pane {
      position: static;
      display: flex;
      flex-direction: column;
      min-height: 0;
      overflow: hidden;
    }

    #unitDispatchWorkspace .planning-list {
      flex: 1 1 0;
      min-height: 0;
      max-height: none;
      overflow: auto;
    }

    #unitDispatchWorkspace .planning-detail-pane {
      min-height: 0;
      overflow: auto;
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
    }

    .fixed-workspace-view .table-scroll,
    .fixed-workspace-view .planning-list,
    .fixed-workspace-view .procurement-task-list,
    .fixed-workspace-view .planning-detail-pane {
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
    }

    :is(
      #viewInProgress,
      #viewMyPending,
      #viewResults,
      #viewReview,
      #viewPersonnel,
      #viewDrilldown
    ) > .card-panel,
    #viewOrders > .order-worklist-panel,
    #viewAdjustments > .card-panel:not(#adjustmentFormPanel) {
      display: flex;
      flex: 1 1 0;
      flex-direction: column;
      min-height: 0;
      margin-bottom: 0;
      overflow: hidden;
    }

    :is(
      #viewInProgress,
      #viewMyPending,
      #viewResults,
      #viewPersonnel,
      #viewDrilldown
    ) > .card-panel > .table-scroll,
    #viewOrders > .order-worklist-panel > .table-scroll,
    #viewAdjustments > .card-panel:not(#adjustmentFormPanel) > .table-scroll {
      flex: 1 1 0;
      min-height: 0;
      max-height: none;
      overflow: auto;
    }

    #viewOrders > .order-config-panel {
      flex: 0 0 auto;
      max-height: 30%;
      overflow: auto;
    }

    #viewAdjustments > #adjustmentFormPanel {
      flex: 0 0 auto;
      max-height: 52%;
      overflow: auto;
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
    }

    #viewAssign > .form-panel {
      display: block;
      min-height: calc(var(--desktop-canvas-height, 100dvh) - 152px);
      max-height: none;
      overflow: visible;
    }

    #viewAssign > .form-panel > h2 {
      flex: 0 0 auto;
      margin-bottom: 12px;
    }

    #viewAssign #assignPageForm {
      display: grid;
      grid-template-rows: auto minmax(calc(var(--desktop-canvas-height, 100dvh) - 390px), auto) auto;
      min-height: 0;
      overflow: visible;
    }

    #viewAssign .assignment-route-preview {
      min-height: calc(var(--desktop-canvas-height, 100dvh) - 390px);
      overflow: visible;
    }

    #viewAssign > .card-panel:not(.form-panel) {
      margin-bottom: 0;
      overflow: visible;
    }

    #viewAssign > .card-panel:not(.form-panel) > .table-scroll {
      max-height: none;
      overflow-x: auto;
      overflow-y: visible;
    }

    #viewAssign .assignment-form-grid {
      grid-template-columns: minmax(320px, 1.35fr) minmax(230px, 0.9fr) minmax(180px, 0.7fr) minmax(180px, 0.7fr);
      gap: 12px;
    }

    #viewIntegrity > .integrity-summary-grid,
    #viewInspection > .page-head,
    #viewDrilldown > :is(.drill-hero, .drill-kpi-grid) {
      flex: 0 0 auto;
    }

    #viewIntegrity > .card-panel,
    #viewInspection > .card-panel {
      display: flex;
      flex: 1 1 0;
      flex-direction: column;
      min-height: 0;
      margin-bottom: 12px;
      overflow: hidden;
    }

    #viewIntegrity > .card-panel:last-child,
    #viewInspection > .card-panel:last-child {
      margin-bottom: 0;
    }

    #viewIntegrity > .card-panel > .table-scroll,
    #viewInspection > .card-panel > .table-scroll {
      flex: 1 1 0;
      min-height: 0;
      max-height: none;
      overflow: auto;
    }

    #viewIntegrity.integrity-scroll-view.active {
      display: block;
      height: auto;
      min-height: calc(var(--desktop-canvas-height, 100dvh) - 72px);
      overflow: visible;
    }

    #viewIntegrity.integrity-scroll-view > .card-panel {
      display: block;
      min-height: 0;
      margin-bottom: 18px;
      overflow: visible;
    }

    #viewIntegrity.integrity-scroll-view > .card-panel:last-child {
      margin-bottom: 0;
    }

    #viewIntegrity.integrity-scroll-view .integrity-record-list {
      overflow: visible;
      overscroll-behavior: auto;
      scrollbar-gutter: auto;
    }

    #viewReview > .card-panel > :is(#reviewOrderPanel, #reviewOveragePanel):not([hidden]) {
      display: flex;
      flex: 1 1 0;
      flex-direction: column;
      min-height: 0;
    }

    #viewReview > .card-panel > :is(#reviewOrderPanel, #reviewOveragePanel):not([hidden]) > .table-scroll {
      flex: 1 1 0;
      min-height: 0;
      max-height: none;
      overflow: auto;
    }

    #viewDrawings > #drawingLibraryPane {
      display: flex;
      flex: 1 1 0;
      flex-direction: column;
      min-height: 0;
    }

    #drawingLibraryPane > .page-head {
      flex: 0 0 auto;
      margin-bottom: 16px;
    }

    #drawingLibraryPane > .drawing-master-panel {
      display: flex;
      flex: 1 1 0;
      flex-direction: column;
      min-height: 0;
      margin-bottom: 0;
    }

    #drawingLibraryPane > .drawing-master-panel > .table-scroll {
      flex: 1 1 0;
      min-height: 0;
      max-height: none;
      overflow: auto;
    }

    #viewDrawings > .drawing-workspace:not([hidden]) {
      display: flex;
      flex: 1 1 0;
      flex-direction: column;
      min-height: 0;
      overflow: hidden;
    }

    #viewDrawings > .drawing-workspace:not([hidden]) > :is(.drawing-workspace-head, .drawing-tabs) {
      flex: 0 0 auto;
    }

    #viewDrawings > .drawing-workspace:not([hidden]) > .drawing-tab-panel.active {
      flex: 1 1 0;
      min-height: 0;
      overflow: auto;
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
    }

    #viewPlanning > .planning-create-panel,
    #viewUnitPlan > .unit-summary-strip,
    #viewProcurement > .procurement-summary {
      flex: 0 0 auto;
    }

    #viewPlanning > .planning-workspace,
    #viewUnitPlan > .unit-plan-layout,
    #viewProcurement > .procurement-board {
      flex: 1 1 0;
      min-height: 0;
      margin-bottom: 0;
    }

    #viewPlanning > .planning-workspace,
    #viewUnitPlan > .unit-plan-layout {
      align-items: stretch;
      overflow: hidden;
    }

    #viewPlanning .planning-master-pane,
    #viewUnitPlan .planning-master-pane {
      position: static;
      display: flex;
      flex-direction: column;
      min-height: 0;
      overflow: hidden;
    }

    #viewPlanning .planning-list,
    #viewUnitPlan .planning-list {
      flex: 1 1 0;
      min-height: 0;
      max-height: none;
      overflow: auto;
    }

    #viewPlanning .planning-detail-pane,
    #viewUnitPlan .planning-detail-pane {
      min-height: 0;
      overflow: auto;
    }

    #viewProcurement > .procurement-board {
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    #viewProcurement .procurement-task-list {
      flex: 1 1 0;
      min-height: 0;
      overflow: auto;
    }
  }
}

@layer pages {
  @media (min-width: 761px) {
    #viewProfile.active {
      display: flex;
      height: calc(var(--desktop-canvas-height, 100dvh) - 48px);
      min-height: 0;
      overflow: hidden;
    }

    #drawingLibraryPane[hidden] {
      display: none;
    }
  }
}

@layer responsive {
  @media (max-width: 1500px) {
    .dashboard-command {
      grid-template-columns: minmax(500px, 1fr) minmax(430px, 1fr);
    }

    .dashboard-wip-panel {
      grid-column: 1;
      grid-row: 1;
    }

    .dashboard-ai-panel {
      grid-column: 2;
      grid-row: 1;
    }

    .dashboard-command:not(.dashboard-command-with-ai) {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  @media (max-width: 760px) {
    html { --sidebar-w: 208px; }

    .dashboard-grid {
      grid-template-columns: repeat(3, minmax(160px, 1fr));
    }

    .dashboard-card {
      border-bottom: 1px solid var(--line-soft);
    }

    .dashboard-card:nth-child(3n) {
      border-right: 0;
    }

    .dashboard-card:nth-last-child(-n + 3) {
      border-bottom: 0;
    }

    .drawing-library-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats-kpi-grid,
    .drill-kpi-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .stats-filter-bar {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }
  }

  @media (max-width: 760px) {
    .dashboard-command {
      grid-template-columns: 1fr;
    }

    .dashboard-wip-panel,
    .dashboard-command-main,
    .dashboard-command-actions,
    .dashboard-ai-panel {
      grid-column: auto;
      grid-row: auto;
    }

    .dashboard-wip-head {
      flex-direction: column;
    }

    .dashboard-wip-head-actions {
      justify-content: flex-start;
    }

    #viewOrders .toolbar-row.filter-grid,
    .assignment-form-grid,
    .form-grid.four {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .order-filter-panel {
      grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .order-filter-panel .ghost-button {
      justify-self: start;
    }

    .profile-layout {
      grid-template-columns: 1fr;
    }

    .profile-side {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #viewProfile .stats-filter-bar {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }

  @media (max-width: 760px) {
    html { --sidebar-w: 188px; }

    .dashboard-wip-kpis {
      grid-template-columns: repeat(2, minmax(110px, 1fr));
    }

    .dashboard-wip-legend small {
      width: 100%;
      margin-left: 0;
    }

    .brand-block {
      padding-inline: 14px;
    }

    .brand-title {
      font-size: 17px;
    }

    .side-link {
      padding-inline: 10px;
      font-size: 13px;
    }

    .content {
      padding-inline: 18px;
    }

    .operator-main-grid {
      grid-template-columns: 1fr;
    }

    .operator-trace-heading,
    .operator-trace-actions {
      grid-template-columns: 1fr;
      align-items: stretch;
    }

    .person-kpi-grid,
    .integrity-summary-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .integrity-record-metrics,
    .integrity-report-metrics {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .integrity-reason-body {
      grid-template-columns: 1fr;
    }

    .detail-summary-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .operation-detail-metrics {
      grid-template-columns: repeat(3, minmax(92px, 1fr));
    }

    .operation-detail-config {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .order-worklist-head {
      align-items: stretch;
      flex-direction: column;
      gap: 12px;
    }

    .order-scope-tabs {
      width: 100%;
      overflow-x: auto;
    }

    .order-worklist-actions {
      align-items: stretch;
      flex-direction: column;
    }

    .order-worklist-actions .head-actions > button {
      flex: 1 1 0;
    }

    .order-scope-tabs button {
      flex: 1 0 auto;
    }
  }

  @media (max-width: 760px) {
    .stats-sticky-header {
      top: -18px;
    }

    .app-layout {
      width: 100%;
      min-width: 0;
      grid-template-columns: 1fr;
      overflow-x: hidden;
    }

    .sidebar {
      position: relative;
      width: 100%;
      min-width: 0;
      max-width: 100vw;
      height: auto;
      overflow: hidden;
    }

    .brand-block,
    .sidebar-footer {
      display: none;
    }

    .side-menu {
      display: flex;
      gap: 6px;
      width: 100%;
      min-width: 0;
      max-width: 100%;
      padding: 9px;
      overflow-x: auto;
      overflow-y: hidden;
    }

    .side-menu-group {
      display: contents;
    }

    .side-menu-heading {
      display: none;
    }

    .side-menu-group + .side-menu-group {
      padding: 0;
      border: 0;
    }

    .side-link {
      flex: 0 0 auto;
      width: auto;
      min-width: max-content;
      min-height: 38px;
    }

    .side-link.active {
      box-shadow: inset 0 -3px 0 #62d6bb;
    }

    .content {
      padding: 18px 12px 40px;
    }

    .page-head {
      align-items: flex-start;
      flex-direction: column;
      gap: 12px;
    }

    .page-head h1 {
      font-size: 28px;
    }

    .head-actions,
    .page-head > button {
      width: 100%;
    }

    .page-head > button,
    .head-actions > button {
      flex: 1;
    }

    .dashboard-grid,
    .stats-kpi-grid,
    .person-kpi-grid,
    .integrity-summary-grid,
    .drill-kpi-grid,
    .stats-rank-grid,
    .person-rank-grid,
    .drawing-library-grid,
    .profile-side,
    .profile-grid,
    .form-grid,
    .form-grid.two,
    .form-grid.three,
    .form-grid.four,
    .assignment-form-grid,
    #viewOrders .toolbar-row.filter-grid,
    .stats-filter-bar,
    #viewProfile .stats-filter-bar,
    .defect-grid {
      grid-template-columns: 1fr;
    }

    .dashboard-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-card:nth-child(3n) {
      border-right: 1px solid var(--line-soft);
    }

    .dashboard-card:nth-child(2n) {
      border-right: 0;
    }

    .dashboard-card:nth-last-child(-n + 3) {
      border-bottom: 1px solid var(--line-soft);
    }

    .dashboard-card:nth-last-child(-n + 2) {
      border-bottom: 0;
    }

    .span-2 {
      grid-column: auto;
    }

    .order-config-body,
    .order-prefix-form,
    .stats-topline,
    .stats-detail-head,
    .drill-header {
      align-items: stretch;
      flex-direction: column;
    }

    .order-prefix-form .input {
      width: 100%;
    }

    .order-config-panel > summary,
    .order-config-body,
    .order-search-row,
    .order-pagination {
      align-items: stretch;
      flex-direction: column;
    }

    .order-config-panel > summary {
      min-height: 0;
    }

    .order-search-field {
      width: 100%;
      max-width: none;
    }

    .order-filter-panel {
      grid-template-columns: 1fr;
      margin: 0 12px 10px;
      padding: 12px;
    }

    .order-filter-panel .ghost-button {
      justify-self: stretch;
    }

    .order-pagination > div {
      justify-content: space-between;
    }

    .timeline-item {
      grid-template-columns: 82px 16px minmax(0, 1fr);
    }

    .modal-backdrop {
      align-items: flex-end;
      padding: 0;
    }

    .modal,
    .modal.narrow,
    .detail-modal,
    .confirm-modal {
      width: 100%;
      max-height: 94vh;
      border-radius: 22px 22px 0 0;
    }

    .detail-summary-grid {
      grid-template-columns: 1fr;
    }

    .operation-detail-hero {
      grid-template-columns: 1fr;
      justify-items: center;
    }

    .operation-detail-overview {
      width: 100%;
    }

    .operation-detail-state {
      justify-content: center;
    }

    .operation-detail-metrics {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .operation-detail-config {
      grid-template-columns: 1fr;
    }

    .integrity-reason-list {
      min-width: 0;
    }

    .integrity-record-head,
    .integrity-record-section-title {
      align-items: stretch;
      flex-direction: column;
    }

    .integrity-record-head-side {
      justify-items: stretch;
    }

    .integrity-record-state,
    .integrity-record-actions {
      justify-content: flex-start;
    }

    .integrity-record-metrics,
    .integrity-report-metrics {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 520px) {
    .dashboard-grid {
      grid-template-columns: 1fr;
    }

    .dashboard-command,
    .card-panel,
    .profile-card,
    .form-panel {
      padding: 16px;
    }

    .dashboard-card {
      min-height: 106px;
      border-right: 0;
      border-bottom: 1px solid var(--line-soft);
    }

    .dashboard-card:nth-child(3n),
    .dashboard-card:nth-child(2n) {
      border-right: 0;
    }

    .dashboard-card:nth-last-child(-n + 2) {
      border-bottom: 1px solid var(--line-soft);
    }

    .dashboard-card:last-child {
      border-bottom: 0;
    }

    .login-body {
      padding: 12px;
    }

    .login-card {
      padding: 22px;
      border-radius: 20px;
    }

    #registerForm {
      grid-template-columns: 1fr;
    }

    #registerForm > label:first-child,
    #registerForm > label:last-of-type,
    #registerForm > .primary-button {
      grid-column: auto;
    }

    .input-action-row {
      grid-template-columns: 1fr;
    }
  }
}

@layer pages {
  .drawing-master-panel {
    padding: 0;
    overflow: hidden;
  }

  .drawing-master-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--line);
  }

  .drawing-master-summary-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
  }

  .drawing-scope-control button {
    gap: 7px;
  }

  .drawing-scope-control button small {
    display: inline-grid;
    place-items: center;
    min-width: 23px;
    min-height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    color: var(--muted);
    background: rgba(91, 111, 104, 0.1);
    font: 700 11px/1 var(--font-body);
  }

  .drawing-scope-control button.active small {
    color: var(--brand-strong);
    background: var(--brand-soft);
  }

  .drawing-master-summary h2,
  .workspace-section-head h2 {
    margin: 2px 0 0;
    font: 700 20px/1.25 var(--font-display);
    letter-spacing: -0.02em;
  }

  .drawing-master-table {
    min-width: 1380px;
  }

  .drawing-master-label-row th {
    top: 0;
    height: 42px;
    padding-bottom: 8px;
    border-bottom: 0;
  }

  .drawing-filter-row th {
    z-index: 3;
    top: 42px;
    padding: 0 8px 10px;
    background: #f5f7f5;
  }

  .drawing-master-table th:nth-child(1) { width: 20%; }
  .drawing-master-table th:nth-child(2) { width: 9%; }
  .drawing-master-table th:nth-child(3) { width: 10%; }
  .drawing-master-table th:nth-child(4) { width: 10%; }
  .drawing-master-table th:nth-child(5) { width: 11%; }
  .drawing-master-table th:nth-child(6) { width: 13%; }
  .drawing-master-table th:nth-child(7) { width: 13%; }
  .drawing-master-table th:nth-child(8) { width: 8%; }
  .drawing-master-table th:nth-child(9) { width: 6%; }

  .department-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    color: #205c50;
    background: #edf7f3;
    border: 1px solid #cfe7df;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
  }

  .department-pill.department-b { color: #275b84; background: #eef6fc; border-color: #d3e4f3; }
  .department-pill.department-c { color: #6b4c1e; background: #fbf5e9; border-color: #ecdcb9; }
  .department-pill.department-d { color: #674985; background: #f6f0fb; border-color: #e4d6f1; }
  .department-pill.department-e { color: #7a4646; background: #fbf0f0; border-color: #efd4d4; }

  .trace-mode-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
  }

  .trace-mode-pill.batch { color: #5b675f; background: #f0f3f1; border: 1px solid #dce4df; }
  .trace-mode-pill.exact { color: #0b6758; background: #e8f7f2; border: 1px solid #bfe5d9; }

  .table-filter-control {
    width: 100%;
    min-width: 0;
    min-height: 34px;
    padding: 6px 28px 6px 9px;
    color: var(--text-soft);
    background-color: rgba(255, 255, 255, 0.88);
    border: 1px solid #d8e0dc;
    border-radius: 9px;
    outline: 0;
    font: 650 12px/1.25 var(--font-body);
    letter-spacing: 0;
    transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
  }

  input.table-filter-control {
    padding-right: 9px;
  }

  .table-filter-control:hover {
    border-color: #bdcbc5;
    background: #fff;
  }

  .table-filter-control:focus {
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(8, 123, 103, 0.12);
  }

  .table-filter-control.is-active {
    color: var(--brand-strong);
    border-color: #9acabd;
    background: #edf8f4;
  }

  .table-filter-clear {
    width: 100%;
    min-height: 34px;
    padding: 5px 8px;
    color: var(--brand-strong);
    background: transparent;
    border: 1px solid #b9d8d0;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    transition: background var(--ease), border-color var(--ease), opacity var(--ease);
  }

  .table-filter-clear:not(:disabled):hover {
    background: var(--brand-quiet);
    border-color: var(--brand);
  }

  .table-filter-clear:disabled {
    cursor: default;
    opacity: 0.38;
  }

  .drawing-master-row {
    cursor: pointer;
    transition: background var(--ease);
  }

  .drawing-master-row:hover {
    background: var(--brand-quiet);
  }

  .master-title-button {
    display: grid;
    gap: 3px;
    width: 100%;
    padding: 0;
    border: 0;
    color: var(--text);
    background: transparent;
    text-align: left;
  }

  .master-title-button strong {
    font-size: 14px;
    letter-spacing: 0.01em;
  }

  .master-title-button span {
    color: var(--muted);
    font-size: 12px;
  }

  .source-type-pill,
  .master-completeness {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
  }

  .source-type-pill.make,
  .master-completeness.is-ready {
    color: var(--success);
    background: var(--success-soft);
  }

  .source-type-pill.buy {
    color: var(--info);
    background: var(--info-soft);
  }

  .source-type-pill.outsource,
  .master-completeness.is-missing {
    color: var(--warning);
    background: var(--warning-soft);
  }

  .drawing-workspace {
    min-width: 0;
    animation: workspace-in 220ms cubic-bezier(0.2, 0.75, 0.2, 1) both;
  }

  @keyframes workspace-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .drawing-workspace-head {
    display: grid;
    grid-template-columns: 44px minmax(240px, 1fr) auto auto;
    align-items: center;
    gap: 16px;
    min-height: 92px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    background: var(--surface);
    box-shadow: var(--shadow-panel);
  }

  .workspace-back {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--text);
    background: var(--surface-soft);
    font-size: 22px;
    transition: transform var(--ease), background var(--ease);
  }

  .workspace-back:hover {
    background: var(--brand-soft);
    transform: translateX(-2px);
  }

  .drawing-workspace-title h1 {
    margin: 1px 0 2px;
    font: 750 clamp(24px, 2vw, 30px)/1.15 var(--font-display);
    letter-spacing: -0.035em;
  }

  .drawing-workspace-title > p:last-child {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
  }

  .drawing-workspace-status,
  .drawing-workspace-actions,
  .inline-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .drawing-workspace-status > span:first-child {
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text-soft);
    background: var(--surface-soft);
    font-size: 12px;
    font-weight: 700;
  }

  .version-snapshot-pill {
    padding: 5px 9px;
    border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
    border-radius: 999px;
    color: var(--brand-strong);
    background: var(--brand-soft);
    font-size: 12px;
    font-weight: 700;
  }

  .master-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
  }

  .workspace-delete-drawing {
    min-height: 34px;
    padding-inline: 10px;
    border: 1px solid transparent;
  }

  .master-row-actions .link-danger-button:hover,
  .workspace-delete-drawing:hover {
    border-color: color-mix(in srgb, var(--danger) 26%, transparent);
    background: var(--danger-soft);
  }

  .drawing-tabs {
    position: sticky;
    top: 0;
    z-index: 12;
    display: flex;
    gap: 4px;
    margin: 14px 0;
    padding: 5px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(248, 250, 248, 0.94);
    box-shadow: 0 8px 22px rgba(19, 35, 31, 0.06);
    backdrop-filter: blur(16px);
  }

  .drawing-tabs button {
    min-width: max-content;
    min-height: 40px;
    padding: 0 15px;
    border: 0;
    border-radius: 10px;
    color: var(--text-soft);
    background: transparent;
    font-size: 13px;
    font-weight: 650;
    transition: color var(--ease), background var(--ease), box-shadow var(--ease);
  }

  .drawing-tabs button.active {
    color: var(--brand-strong);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(19, 35, 31, 0.08), 0 5px 14px rgba(19, 35, 31, 0.06);
  }

  .drawing-tab-panel {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    background: var(--surface);
    box-shadow: var(--shadow-panel);
  }

  .workspace-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
  }

  .workspace-section-head p:not(.panel-eyebrow) {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
  }

  .drawing-basic-grid .span-3 {
    grid-column: span 3;
  }

  .workspace-form.is-readonly .input:disabled,
  .routing-operation-card .input:disabled,
  .bom-editor-table .input:disabled {
    color: var(--text);
    border-color: transparent;
    background: var(--surface-soft);
    opacity: 1;
    -webkit-text-fill-color: var(--text);
  }

  .bom-editor-table {
    min-width: 1120px;
  }

  .bom-kind-cell {
    display: grid;
    justify-items: start;
    gap: 4px;
    min-width: 92px;
  }

  .bom-kind-cell strong {
    font-size: 12px;
  }

  .bom-editor-table .input {
    min-width: 84px;
  }

  .bom-editor-table select.input {
    min-width: 240px;
  }

  .row-sequence {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: var(--brand-strong);
    background: var(--brand-soft);
    font-size: 12px;
    font-weight: 750;
  }

  .routing-editor {
    display: grid;
    gap: 12px;
  }

  .routing-requirement-toggle {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 11px;
    color: var(--text);
    background: var(--surface-soft);
    cursor: pointer;
  }

  .routing-requirement-toggle input {
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    accent-color: var(--brand);
  }

  .routing-requirement-toggle span {
    display: grid;
    gap: 1px;
    min-width: 0;
  }

  .routing-requirement-toggle strong {
    font-size: 12px;
    line-height: 1.25;
  }

  .routing-requirement-toggle small {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.25;
    white-space: nowrap;
  }

  .routing-requirement-toggle:focus-within {
    border-color: var(--brand);
    box-shadow: var(--focus);
  }

  .routing-requirement-toggle.is-automatic {
    cursor: default;
    opacity: 0.78;
  }

  .routing-empty,
  .workspace-file-empty {
    display: grid;
    place-items: center;
    min-height: 128px;
    padding: 24px;
    border: 1px dashed var(--line-strong);
    border-radius: 14px;
    color: var(--muted);
    background: var(--surface-soft);
    text-align: center;
  }

  .routing-operation-card {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
  }

  .operation-rail {
    display: flex;
    justify-content: center;
    padding-top: 22px;
    background: linear-gradient(180deg, var(--brand-soft), var(--brand-quiet));
  }

  .operation-rail span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: #fff;
    background: var(--brand);
    font-size: 12px;
    font-weight: 800;
  }

  .operation-content {
    display: grid;
    gap: 14px;
    padding: 18px;
  }

  .operation-title-row {
    display: grid;
    grid-template-columns: 110px minmax(220px, 1fr) 130px auto;
    align-items: end;
    gap: 12px;
  }

  .operation-field-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }

  .operation-content label,
  .workspace-form label {
    display: grid;
    gap: 6px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 650;
  }

  .operation-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    padding: 11px 13px;
    border-radius: 11px;
    background: var(--surface-soft);
  }

  .operation-options label {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text);
    font-weight: 550;
  }

  .operation-options input {
    width: 17px;
    height: 17px;
    accent-color: var(--brand);
  }

  .operation-program-row {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto;
    align-items: end;
    gap: 12px;
  }

  .operation-instructions textarea {
    resize: vertical;
  }

  .workspace-file-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .workspace-file-section {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
  }

  .workspace-file-section h3 {
    margin: 0;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
    font-size: 14px;
  }

  .workspace-file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 64px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
  }

  .workspace-file-row:last-child {
    border-bottom: 0;
  }

  .workspace-file-row > div:first-child {
    display: grid;
    gap: 4px;
    min-width: 0;
  }

  .workspace-file-row strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
  }

  .workspace-file-row span {
    color: var(--muted);
    font-size: 11px;
  }

  .trace-level-callout {
    display: grid;
    gap: 4px;
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 12px;
  }

  .trace-level-callout.exact {
    color: var(--success);
    background: var(--success-soft);
  }

  .trace-level-callout.batch {
    color: var(--warning);
    background: var(--warning-soft);
  }

  .trace-level-callout span {
    color: var(--text-soft);
    font-size: 13px;
  }

  .version-timeline {
    position: relative;
    display: grid;
    gap: 0;
    padding-left: 14px;
  }

  .version-timeline::before {
    content: "";
    position: absolute;
    left: 20px;
    top: 14px;
    bottom: 14px;
    width: 1px;
    background: var(--line-strong);
  }

  .version-timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 16px;
    padding: 12px 0;
  }

  .version-dot {
    z-index: 1;
    width: 13px;
    height: 13px;
    margin-top: 5px;
    border: 3px solid var(--surface);
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 1px var(--brand);
  }

  .version-timeline-item.draft .version-dot {
    background: var(--warning);
    box-shadow: 0 0 0 1px var(--warning);
  }

  .version-main {
    display: grid;
    gap: 5px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
  }

  .operation-responsibility-note {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 13px;
    border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--line));
    border-radius: 11px;
    background: color-mix(in srgb, var(--brand-soft) 68%, var(--surface));
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.55;
  }

  .operation-responsibility-note strong {
    flex: 0 0 auto;
    color: var(--brand-strong, var(--brand));
  }

  .version-view-button {
    width: 100%;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
  }

  .version-view-button:hover,
  .version-view-button:focus-visible {
    border-color: var(--brand);
    background: var(--brand-soft);
    outline: none;
    transform: translateY(-1px);
  }

  .version-timeline-item.is-current-view .version-view-button {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 12%, transparent);
  }

  .version-main > div {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .version-main p {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
  }

  .version-main > span {
    color: var(--muted);
    font-size: 11px;
  }
}

@layer pages {
  .planning-page-head,
  .procurement-page-head {
    margin-bottom: 18px;
  }

  .planning-create-panel,
  .planning-master-pane,
  .planning-detail-pane,
  .procurement-board {
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    background: var(--surface);
    box-shadow: var(--shadow-panel);
  }

  .planning-create-panel {
    margin-bottom: 16px;
    padding: 18px;
  }

  .planning-section-head > div,
  .planning-pane-head,
  .planning-selected-head {
    display: flex;
    align-items: center;
  }

  .planning-section-head > div {
    gap: 12px;
  }

  .planning-section-head > div > span {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 750;
    font-size: 12px;
  }

  .planning-section-head h2,
  .planning-pane-head h2,
  .planning-selected-head h2,
  .procurement-task-main h2 {
    margin: 0;
  }

  .planning-section-head h2,
  .planning-pane-head h2 {
    font-size: 18px;
    letter-spacing: -0.01em;
  }

  .planning-section-head p,
  .planning-selected-head p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
  }

  .planning-section-head.compact {
    margin-bottom: 14px;
  }

  .planning-create-grid {
    display: grid;
    grid-template-columns: minmax(250px, 1.45fr) minmax(120px, 0.55fr) minmax(160px, 0.7fr) minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin-top: 16px;
  }

  .planning-field,
  .planning-dispatch-grid label,
  .unit-assignment-form label {
    display: grid;
    gap: 6px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 650;
  }

  .planning-create-button {
    min-width: 104px;
  }

  .planning-workspace,
  .unit-plan-layout {
    display: grid;
    grid-template-columns: minmax(280px, 0.82fr) minmax(620px, 2.18fr);
    gap: 16px;
    align-items: start;
  }

  .planning-master-pane {
    position: sticky;
    top: 20px;
    overflow: hidden;
  }

  .planning-pane-head {
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
  }

  .planning-pane-head .panel-eyebrow {
    margin-bottom: 4px;
  }

  .planning-plan-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    margin: 10px 10px 0;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
  }

  .planning-plan-tabs button {
    min-height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 720;
    transition: color var(--ease), background-color var(--ease), box-shadow var(--ease);
  }

  .planning-plan-tabs button:hover {
    background: var(--surface);
    color: var(--text);
  }

  .planning-plan-tabs button.active {
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(18, 44, 37, 0.1);
    color: var(--brand-strong);
  }

  .planning-list {
    display: grid;
    gap: 8px;
    max-height: calc(100vh - 300px);
    overflow: auto;
    padding: 10px;
  }

  #viewPlanning .planning-list {
    align-content: start;
  }

  .planning-list-card {
    display: grid;
    gap: 7px;
    width: 100%;
    padding: 13px 14px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--surface-soft);
    color: var(--text);
    text-align: left;
  }

  .planning-list-card:hover {
    border-color: var(--line-strong);
    background: var(--surface);
  }

  .planning-list-card.active {
    border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
    background: var(--brand-quiet);
    box-shadow: inset 3px 0 0 var(--brand);
  }

  .planning-list-top,
  .planning-list-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .planning-list-top strong {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .planning-list-top em {
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-soft);
    font-size: 10px;
    font-style: normal;
  }

  .planning-list-name,
  .planning-list-meta,
  .planning-due {
    color: var(--muted);
    font-size: 11px;
  }

  .planning-list-meta b {
    color: var(--text);
    font-size: 12px;
  }

  .planning-due {
    width: max-content;
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--surface-muted);
  }

  .planning-due.danger {
    background: var(--danger-soft);
    color: var(--danger);
  }

  .planning-due.warning {
    background: var(--warning-soft);
    color: var(--warning);
  }

  .planning-due.complete {
    background: var(--success-soft);
    color: var(--success);
  }

  .planning-detail-pane {
    min-height: 430px;
    overflow: hidden;
  }

  .planning-detail-empty,
  .procurement-empty {
    display: grid;
    min-height: 360px;
    place-content: center;
    justify-items: center;
    padding: 36px;
    color: var(--muted);
    text-align: center;
  }

  .planning-detail-empty > span,
  .procurement-empty > span {
    display: grid;
    width: 44px;
    height: 44px;
    margin-bottom: 12px;
    place-items: center;
    border-radius: 14px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 20px;
  }

  .planning-detail-empty strong,
  .procurement-empty strong {
    color: var(--text);
  }

  .planning-detail-empty p,
  .procurement-empty p {
    margin: 5px 0 0;
    font-size: 12px;
  }

  .planning-selected-head {
    justify-content: space-between;
    gap: 24px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(135deg, var(--brand-quiet), var(--surface));
  }

  .planning-selected-head h2 {
    font-size: 22px;
    letter-spacing: -0.02em;
  }

  .planning-selected-head .status-badge,
  .planning-dispatch-card .status-badge {
    width: max-content;
    padding: 5px 9px;
    border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--line));
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
  }

  .planning-selected-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    align-items: center;
  }

  .unit-assignment-form {
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
  }

  .unit-capability-heading,
  .unit-capability-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  .unit-capability-heading .planning-section-head {
    margin-bottom: 0;
  }

  .unit-coverage-state {
    flex: 0 0 auto;
    padding: 6px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: 11px;
    white-space: nowrap;
  }

  .unit-coverage-state.is-ready {
    border-color: color-mix(in srgb, var(--success) 34%, var(--line));
    background: var(--success-soft);
    color: var(--success);
  }

  .unit-coverage-state.is-blocked {
    border-color: color-mix(in srgb, var(--danger) 24%, var(--line));
    background: var(--danger-soft);
    color: var(--danger);
  }

  .unit-team-match-list,
  .unit-operation-match-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
  }

  .unit-team-match-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .unit-team-match-card {
    display: grid;
    grid-template-columns: 18px minmax(130px, 0.7fr) minmax(0, 1.3fr);
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
    cursor: pointer;
  }

  .unit-team-match-card:has(input:checked) {
    border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
    background: var(--brand-quiet);
    box-shadow: inset 3px 0 0 var(--brand);
  }

  .unit-team-match-card.is-unmatched {
    opacity: 0.58;
    cursor: not-allowed;
  }

  .unit-team-match-card > input,
  .unit-operator-choice > input {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
  }

  .unit-match-main,
  .unit-match-coverage,
  .unit-operator-choice > span {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  .unit-match-main strong,
  .unit-operation-match-card header strong,
  .unit-operator-choice strong {
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .unit-match-main small,
  .unit-match-coverage small,
  .unit-operation-match-card header small,
  .unit-operator-choice small {
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .unit-match-coverage {
    text-align: right;
  }

  .unit-match-coverage b {
    color: var(--brand-strong);
    font-size: 12px;
  }

  .unit-capability-actions {
    margin-top: 12px;
  }

  .unit-capability-actions p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
  }

  .unit-match-empty {
    display: grid;
    grid-column: 1 / -1;
    gap: 3px;
    min-height: 62px;
    place-content: center;
    padding: 12px;
    border: 1px dashed var(--line-strong);
    border-radius: 11px;
    color: var(--muted);
    text-align: center;
  }

  .unit-match-empty.is-blocked,
  .unit-operation-unmatched {
    color: var(--danger);
  }

  .unit-operation-match-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
  }

  .unit-operation-match-card.is-unmatched {
    border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  }

  .unit-operation-match-card.is-claimed-mine {
    border-color: color-mix(in srgb, var(--brand) 46%, var(--line));
    box-shadow: inset 3px 0 0 var(--brand);
  }

  .unit-operation-match-card.is-claimed-other {
    border-color: var(--line);
    background: var(--surface-muted);
    opacity: 0.82;
  }

  .unit-operation-match-card.is-returned {
    border-color: #e3b5ab;
    background: #fff8f5;
  }

  .operation-claim-state {
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
  }

  .operation-claim-state.is-mine {
    background: var(--brand-soft);
    color: var(--brand-strong);
  }

  .operation-claim-state.is-locked {
    background: color-mix(in srgb, var(--warning) 14%, var(--surface));
    color: var(--warning-strong, #9b5a00);
  }

  .operation-claim-state.is-returned {
    background: #fce8e3;
    color: #9b3f2f;
  }

  .operation-claim-release,
  .operation-return-to-planner {
    margin: 0 10px 10px auto;
  }

  .unit-operation-match-card > header {
    display: grid;
    grid-template-columns: 34px minmax(180px, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .unit-operation-match-card > header > span {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 11px;
    font-weight: 750;
  }

  .unit-operation-match-card > header > div {
    display: grid;
    gap: 2px;
  }

  .unit-operation-match-card > header > b {
    color: var(--text-soft);
    font-size: 11px;
  }

  .unit-operator-choice-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 8px;
    padding: 10px;
  }

  .unit-operator-choice {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    cursor: pointer;
  }

  .unit-operator-choice:has(input:checked) {
    border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
    background: var(--brand-quiet);
  }

  .unit-operator-choice em {
    padding: 3px 6px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 9px;
    font-style: normal;
    font-weight: 700;
  }

  .unit-operation-unmatched {
    grid-column: 1 / -1;
    padding: 10px;
    font-size: 11px;
    text-align: center;
  }

  .unit-assignment-fields {
    margin-top: 14px;
  }

  .planning-bom-panel {
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
    background: var(--brand-quiet);
  }

  .planning-bom-callout,
  .planning-bom-preview-head,
  .planning-bom-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
  }

  .planning-bom-callout .planning-section-head {
    margin: 0;
  }

  .planning-bom-preview {
    margin-top: 16px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--line));
    border-radius: 13px;
    background: var(--surface);
  }

  .planning-bom-table-wrap > .table-scroll {
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
  }

  .planning-bom-preview-head,
  .planning-bom-actions {
    padding: 13px 15px;
  }

  .planning-bom-preview-head {
    border-bottom: 1px solid var(--line);
  }

  .planning-bom-preview-head p,
  .planning-bom-actions p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 11px;
  }

  .planning-bom-preview-tools {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
  }

  .planning-bom-preview-tools > span {
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 11px;
    font-weight: 700;
  }

  .planning-bom-preview-toggle {
    min-height: 30px;
    padding: 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
    transition: color var(--ease), background-color var(--ease), border-color var(--ease);
  }

  .planning-bom-preview-toggle:hover {
    border-color: color-mix(in srgb, var(--brand) 36%, var(--line));
    background: var(--brand-quiet);
    color: var(--brand-strong);
  }

  .planning-bom-table-wrap[hidden] {
    display: none;
  }

  .planning-bom-table {
    min-width: 1060px;
  }

  .planning-bom-table th,
  .planning-bom-table td {
    padding: 9px 11px;
  }

  .planning-bom-table .input {
    min-height: 42px;
    height: 42px;
    font-size: 13px;
    line-height: 1.35;
  }

  .planning-bom-leader {
    min-width: 190px;
  }

  .planning-purchaser-multi {
    position: relative;
    min-width: 224px;
  }

  .planning-purchaser-multi > summary {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 7px 34px 7px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    list-style: none;
  }

  .planning-purchaser-multi > summary::-webkit-details-marker {
    display: none;
  }

  .planning-purchaser-multi > summary::after {
    content: '';
    position: absolute;
    right: 13px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid var(--text-soft);
    border-bottom: 1.5px solid var(--text-soft);
    transform: translateY(-70%) rotate(45deg);
    transition: transform var(--ease);
  }

  .planning-purchaser-multi[open] > summary::after {
    transform: translateY(-30%) rotate(225deg);
  }

  .planning-purchaser-multi > summary > span {
    color: var(--brand-strong);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
    white-space: nowrap;
  }

  .planning-purchaser-multi > summary > small {
    overflow: hidden;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .planning-purchaser-multi[open] > summary {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent);
  }

  .planning-purchaser-multi.is-invalid > summary {
    border-color: var(--danger);
  }

  .planning-purchaser-menu {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    min-width: 250px;
    padding: 10px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    background: var(--surface);
    box-shadow: 0 14px 32px rgb(21 48 43 / 16%);
  }

  .planning-purchaser-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 1px 2px 8px;
    border-bottom: 1px solid var(--line);
  }

  .planning-purchaser-menu-head strong {
    font-size: 13px;
    line-height: 1.35;
  }

  .planning-purchaser-menu-head span {
    display: flex;
    gap: 4px;
  }

  .planning-purchaser-menu-head button {
    padding: 4px 8px;
    border: 0;
    border-radius: 6px;
    background: var(--brand-quiet);
    color: var(--brand-strong);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.35;
  }

  .planning-purchaser-choice-list {
    display: grid;
    gap: 4px;
    max-height: 210px;
    margin: 8px 0;
    overflow-y: auto;
  }

  .planning-purchaser-choice {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 7px 8px;
    border-radius: 8px;
    cursor: pointer;
  }

  .planning-purchaser-choice:hover {
    background: var(--surface-soft);
  }

  .planning-purchaser-choice input {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
  }

  .planning-purchaser-choice span {
    display: grid;
    gap: 1px;
    min-width: 0;
  }

  .planning-purchaser-choice strong {
    font-size: 13px;
    line-height: 1.35;
  }

  .planning-purchaser-choice small,
  .planning-purchaser-menu > p {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
  }

  .planning-team-leader-menu .planning-purchaser-choice {
    align-items: flex-start;
    min-height: 54px;
  }

  .planning-team-leader-menu .planning-purchaser-choice input {
    flex: 0 0 auto;
    margin-top: 3px;
  }

  .planning-team-leader-operations {
    display: -webkit-box;
    overflow: hidden;
    color: var(--text-soft);
    font-size: 12px;
    font-style: normal;
    line-height: 1.4;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .planning-purchaser-menu > p {
    margin: 0;
    padding: 8px 2px 1px;
    border-top: 1px solid var(--line);
    line-height: 1.45;
  }

  .planning-bom-assignee {
    min-width: 180px;
  }

  .planning-shared-purchase {
    display: grid;
    min-width: 180px;
    gap: 3px;
  }

  .planning-shared-purchase strong {
    color: var(--brand-strong);
    font-size: 13px;
    line-height: 1.35;
  }

  .planning-shared-purchase span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
  }

  .planning-assignee-confirm {
    min-width: 180px;
    color: var(--brand-strong);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
  }

  .planning-bom-date {
    width: 130px;
  }

  .planning-source-pill {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--warning-soft);
    color: var(--warning);
    font-size: 10px;
    font-weight: 700;
  }

  .planning-source-pill.made {
    background: var(--success-soft);
    color: var(--success);
  }

  .planning-team-pill {
    display: inline-flex;
    margin-top: 5px;
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 10px;
    font-weight: 750;
  }

  .planning-team-pill.is-empty {
    background: var(--surface-soft);
    color: var(--muted);
    border: 1px dashed var(--line-strong);
  }

  .planning-bom-actions {
    border-top: 1px solid var(--line);
    background: var(--surface-soft);
  }

  .planning-dispatch-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    gap: 12px;
    align-items: end;
  }

  .planning-dispatch-grid .span-2 {
    grid-column: span 2;
  }

  .planning-dispatch-history {
    padding: 4px 0 12px;
  }

  .planning-dispatch-history .planning-pane-head {
    border-bottom: 0;
  }

  .planning-dispatch-list {
    display: grid;
    gap: 8px;
    padding: 0 14px 4px;
  }

  .planning-dispatch-card {
    display: grid;
    grid-template-columns: 100px minmax(220px, 1fr) 82px 120px auto;
    gap: 14px;
    align-items: center;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
  }

  .planning-dispatch-kind,
  .planning-dispatch-main,
  .planning-dispatch-qty,
  .planning-dispatch-due {
    display: grid;
    gap: 3px;
  }

  .planning-dispatch-kind > span {
    width: max-content;
    padding: 4px 8px;
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 11px;
    font-weight: 700;
  }

  .planning-dispatch-kind small,
  .planning-dispatch-main p,
  .planning-dispatch-qty span,
  .planning-dispatch-due span {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
  }

  .planning-dispatch-main strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .planning-order-links,
  .planning-task-orders {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  .planning-order-links {
    grid-column: 1 / -1;
    padding-top: 9px;
    border-top: 1px solid var(--line-soft);
  }

  .planning-person-task-chip {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 4px 7px;
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text-soft);
    font-size: 10px;
  }

  .planning-task-orders {
    min-width: 190px;
  }

  .planning-empty-card {
    padding: 28px 18px;
    color: var(--muted);
    text-align: center;
  }

  .planning-empty-card.compact {
    padding: 22px;
  }

  .planning-empty-card strong {
    color: var(--text);
  }

  .planning-empty-card p {
    margin: 5px 0 0;
    font-size: 11px;
  }

  .unit-summary-strip,
  .procurement-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
  }

  .unit-summary-card,
  .procurement-summary-card {
    display: grid;
    gap: 4px;
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--brand);
    border-radius: 12px;
    background: var(--surface);
  }

  .unit-summary-card span,
  .procurement-summary-card span,
  .unit-summary-card small,
  .procurement-summary-card small {
    color: var(--muted);
    font-size: 11px;
  }

  .unit-summary-card strong,
  .procurement-summary-card strong {
    font-size: 23px;
  }

  .unit-summary-card.tone-3,
  .procurement-summary-card.tone-2 {
    border-left-color: var(--danger);
  }

  .unit-detail-pane .planning-dispatch-grid {
    grid-template-columns: 1.2fr 0.65fr 0.85fr 1.2fr auto;
  }

  .procurement-board {
    overflow: hidden;
  }

  .procurement-task-list {
    display: grid;
    gap: 10px;
    padding: 14px;
  }

  .procurement-task-card {
    display: grid;
    grid-template-columns: 150px minmax(320px, 1fr) 150px 110px;
    gap: 18px;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: 13px;
    background: var(--surface-soft);
  }

  .procurement-task-card.warning { border-left-color: var(--warning); }
  .procurement-task-card.danger { border-left-color: var(--danger); background: var(--danger-soft); }
  .procurement-task-card.complete { border-left-color: var(--success); opacity: 0.76; }

  .procurement-task-date,
  .procurement-task-main,
  .procurement-task-state {
    display: grid;
    gap: 4px;
  }

  .procurement-task-date span,
  .procurement-task-main p,
  .procurement-task-state small {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
  }

  .procurement-task-date strong {
    font-size: 17px;
  }

  .procurement-task-date em {
    color: var(--text-soft);
    font-size: 11px;
    font-style: normal;
  }

  .procurement-task-main h2 {
    font-size: 18px;
    letter-spacing: -0.01em;
  }

  .procurement-task-main > strong {
    font-size: 12px;
  }

  .procurement-task-main > span {
    color: var(--text-soft);
    font-size: 12px;
  }

  @media (max-width: 760px) {
    .unit-capability-heading,
    .unit-capability-actions {
      align-items: stretch;
      flex-direction: column;
    }

    .unit-coverage-state {
      width: max-content;
    }

    .unit-team-match-list,
    .unit-operator-choice-list {
      grid-template-columns: 1fr;
    }

    .unit-team-match-card {
      grid-template-columns: 18px minmax(120px, 0.8fr) minmax(150px, 1.2fr);
    }

    .planning-create-grid {
      grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .planning-create-button {
      min-height: var(--control-h);
    }

    .planning-workspace,
    .unit-plan-layout {
      grid-template-columns: 1fr;
    }

    .planning-master-pane {
      position: static;
    }

    .planning-list {
      grid-template-columns: repeat(2, minmax(240px, 1fr));
      max-height: 360px;
    }

    .planning-dispatch-grid,
    .unit-detail-pane .planning-dispatch-grid {
      grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .procurement-task-card {
      grid-template-columns: 130px minmax(260px, 1fr) 130px auto;
    }

    .planning-bom-callout,
    .planning-bom-actions {
      align-items: stretch;
      flex-direction: column;
    }
  }
}

@layer pages {
  @media (min-width: 761px) {
    #viewPlanning > .planning-workspace,
    #viewUnitPlan > .unit-plan-layout {
      align-items: stretch;
      overflow: hidden;
    }

    #viewPlanning .planning-master-pane,
    #viewUnitPlan .planning-master-pane {
      position: static;
    }

    #viewPlanning .planning-list,
    #viewUnitPlan .planning-list {
      max-height: none;
    }
  }

  @media (max-width: 760px) {
    #viewPlanning > .planning-workspace,
    #viewUnitPlan > .unit-plan-layout {
      align-items: start;
      overflow: auto;
    }

    #viewPlanning .planning-master-pane,
    #viewUnitPlan .planning-master-pane {
      display: block;
      overflow: hidden;
    }

    #viewPlanning .planning-list,
    #viewUnitPlan .planning-list {
      max-height: 360px;
    }

    #viewPlanning .planning-detail-pane,
    #viewUnitPlan .planning-detail-pane {
      overflow: visible;
    }
  }
}

@layer responsive {
  @media (max-width: 760px) {
    .drawing-workspace-head {
      grid-template-columns: 44px minmax(220px, 1fr) auto;
    }

    .drawing-workspace-actions {
      grid-column: 2 / -1;
      justify-content: flex-end;
    }

    .operation-field-grid {
      grid-template-columns: repeat(2, minmax(160px, 1fr));
    }
  }

  @media (max-width: 760px) {
    .drawing-workspace-head {
      grid-template-columns: 44px minmax(0, 1fr);
    }

    .drawing-workspace-status,
    .drawing-workspace-actions {
      grid-column: 1 / -1;
      justify-content: flex-start;
    }

    .drawing-tab-panel {
      padding: 16px;
    }

    .workspace-section-head,
    .workspace-file-row {
      align-items: stretch;
      flex-direction: column;
    }

    .drawing-basic-grid,
    .workspace-file-grid,
    .operation-title-row,
    .operation-field-grid,
    .operation-program-row {
      grid-template-columns: 1fr;
    }

    .drawing-basic-grid .span-3 {
      grid-column: auto;
    }

    .routing-operation-card {
      grid-template-columns: 36px minmax(0, 1fr);
    }

    .operation-content {
      padding: 14px;
    }
  }
}

@layer components {
  .task-center-tabs {
    display: flex;
    gap: 6px;
    width: max-content;
    max-width: 100%;
    margin: 0 0 18px;
    padding: 6px;
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    scrollbar-width: thin;
  }

  .task-center-tabs button {
    display: grid;
    grid-template-columns: 34px minmax(132px, 1fr);
    grid-template-rows: auto auto;
    column-gap: 10px;
    min-width: 190px;
    min-height: 58px;
    padding: 9px 14px;
    color: var(--text-soft);
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 11px;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
  }

  .task-center-tabs button:hover {
    background: var(--surface-soft);
    border-color: var(--line);
    transform: translateY(-1px);
  }

  .task-center-tabs button > span {
    display: grid;
    grid-row: 1 / 3;
    place-items: center;
    align-self: stretch;
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
    background: var(--surface-muted);
    border-radius: 9px;
  }

  .task-center-tabs button > strong {
    align-self: end;
    font-size: 14px;
    line-height: 1.25;
  }

  .task-center-tabs button > small {
    align-self: start;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
  }

  .task-center-tabs button.active {
    color: var(--brand-strong);
    background: var(--brand-soft);
    border-color: #9ccfc0;
    box-shadow: inset 3px 0 0 var(--brand);
  }

  .task-center-tabs button.active > span {
    color: #ffffff;
    background: var(--brand);
  }

  @media (max-width: 760px) {
    .task-center-tabs {
      width: 100%;
    }

    .task-center-tabs button {
      min-width: 168px;
    }
  }
}

@layer accessibility {
  :where(button, a, input, select, textarea, summary):focus-visible {
    outline: 0;
    box-shadow: var(--focus);
  }

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

  @media (prefers-contrast: more) {
    html {
      --line: #adb9b4;
      --line-strong: #87958f;
      --text-soft: #34443f;
      --muted: #50605a;
    }
  }
}

@layer responsive {
  @media (max-width: 520px) {
    .role-switcher-body {
      display: block;
      width: 100%;
      padding: 10px;
      overflow-x: hidden;
    }

    .role-switcher-body .login-shell,
    .role-switcher-body .login-card {
      width: 100%;
      min-width: 0;
    }

    .role-switcher-body .login-card {
      padding: 18px;
    }

    .role-switcher-body .login-title {
      display: grid;
      grid-template-columns: 48px minmax(0, 1fr);
      gap: 12px;
    }

    .role-switcher-body .login-title img {
      width: 48px;
      height: 48px;
    }

    .role-switcher-body .login-title h1 {
      font-size: 21px;
      line-height: 1.25;
      word-break: keep-all;
    }

    .test-role-card {
      display: flex;
      width: 100%;
      min-width: 0;
    }

    .test-role-index,
    .test-role-arrow {
      flex: 0 0 auto;
    }

    .test-role-copy {
      flex: 1 1 auto;
      width: auto;
      min-width: 0;
    }

    .test-role-copy strong,
    .test-role-arrow {
      white-space: nowrap;
      word-break: keep-all;
    }

    .test-role-copy small {
      display: block;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
}

@media (max-width: 1180px) {
  .dashboard-wip-density {
    grid-template-columns: 1fr;
  }

  .dashboard-wip-insights {
    grid-template-columns: minmax(190px, 0.78fr) minmax(230px, 0.92fr) minmax(340px, 1.3fr);
    grid-template-rows: auto;
  }

  .dashboard-wip-example-card {
    grid-column: auto;
  }

  .dashboard-wip-example-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .dashboard-wip-kpis {
    grid-template-columns: repeat(3, minmax(110px, 1fr));
  }

  .dashboard-wip-insights {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-wip-example-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .dashboard-wip-stage-row {
    grid-template-columns: minmax(130px, 1fr) 46px 46px;
  }

  .dashboard-wip-stage-risk {
    grid-column: 1 / -1;
  }

  .dashboard-wip-stage-columns {
    display: none;
  }

  .dashboard-wip-insights {
    grid-template-columns: 1fr;
  }

  .dashboard-wip-example-card {
    grid-column: auto;
  }
}

.planning-return-panel {
  margin: 18px;
  padding: 18px;
  border: 1px solid #e3b5ab;
  border-radius: 18px;
  background: #fffaf8;
}

.planning-return-group + .planning-return-group {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #eaded9;
}

.planning-return-list,
.planning-recall-list {
  display: grid;
  gap: 12px;
}

.planning-return-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 390px);
  gap: 16px;
  padding: 16px;
  border: 1px solid #e4d4cf;
  border-radius: 14px;
  background: #fff;
}

.planning-return-card-main > div:first-child,
.planning-recall-row > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.planning-return-card-main > div:first-child strong,
.planning-recall-row strong {
  color: #0d7568;
  font-size: 16px;
}

.planning-return-card-main dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  margin: 12px 0;
}

.planning-return-card-main dl div {
  min-width: 0;
}

.planning-return-card-main dt {
  color: #788681;
  font-size: 12px;
}

.planning-return-card-main dd {
  margin: 2px 0 0;
  color: #23302c;
  font-weight: 700;
}

.planning-return-card-main p {
  margin: 0;
  color: #8e3f31;
}

.planning-return-operation {
  display: grid;
  grid-template-columns: auto minmax(120px, auto) minmax(0, 1fr);
  gap: 8px 12px;
  align-items: center;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f4f8f6;
}

.planning-return-operation b {
  padding: 4px 8px;
  border-radius: 999px;
  background: #dff1eb;
  color: #0d7568;
  font-size: 12px;
}

.planning-return-operation span {
  color: #6f7e79;
  font-size: 12px;
}

.planning-return-operation-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff5f1;
}

.planning-return-operation-list > b {
  color: #9b3f2f;
  font-size: 12px;
}

.planning-return-operation-list > span {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding-top: 6px;
  border-top: 1px solid #f0ddd6;
}

.planning-return-operation-list small {
  color: #6f7e79;
}

.planning-return-card-action {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.planning-return-card-action .planning-purchaser-multi {
  width: 100%;
}

.planning-return-operation-leader {
  display: grid;
  gap: 6px;
  color: #52625d;
  font-size: 12px;
  font-weight: 700;
}

.planning-recall-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid #dce7e2;
  border-radius: 12px;
  background: #fff;
}

@media (max-width: 760px) {
  .planning-return-card {
    grid-template-columns: 1fr;
  }
}

.dispatch-ai-trigger {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid #93c8ba;
  border-radius: 8px;
  background: #edf8f4;
  color: #075f50;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.dispatch-ai-trigger b {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 6px;
  background: #087b67;
  color: #fff;
  font-size: 9px;
  letter-spacing: .04em;
}

.dispatch-ai-trigger:hover {
  border-color: #087b67;
  background: #e4f4ef;
}

.dispatch-ai-panel {
  position: relative;
  padding: 13px 15px 14px 18px;
  border-bottom: 1px solid #d6e5df;
  background: #f5faf8;
}

.dispatch-ai-panel::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #087b67;
}

.dispatch-ai-panel-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
}

.dispatch-ai-panel-head > div {
  min-width: 0;
}

.dispatch-ai-panel-head strong {
  color: #11342d;
  font-size: 12px;
}

.dispatch-ai-panel-head p {
  overflow: hidden;
  margin: 2px 0 0;
  color: #5f706a;
  font-size: 10px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dispatch-ai-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: #0c6e5d;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
  box-shadow: 0 5px 14px rgba(8, 123, 103, .18);
}

.dispatch-ai-provider {
  padding: 4px 8px;
  border: 1px solid #d1ddd8;
  border-radius: 7px;
  background: #fff;
  color: #66756f;
  font-size: 9px;
  font-weight: 800;
}

.dispatch-ai-provider.is-deepseek {
  border-color: #91cbbd;
  color: #08725f;
}

.dispatch-ai-recommendation-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.dispatch-ai-recommendation {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 5px 12px;
  align-items: center;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 8px 10px;
  border: 1px solid #dbe7e2;
  border-radius: 9px;
  background: rgba(255,255,255,.88);
}

.dispatch-ai-recommendation > div {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.dispatch-ai-recommendation strong,
.dispatch-ai-recommendation span,
.dispatch-ai-recommendation p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dispatch-ai-recommendation strong {
  color: #153a32;
  font-size: 10px;
}

.dispatch-ai-recommendation span {
  color: #08725f;
  font-size: 10px;
  font-weight: 750;
}

.dispatch-ai-recommendation p {
  min-width: 0;
  margin: 0;
  color: #65736e;
  font-size: 9px;
}

.dispatch-ai-recommendation em {
  grid-column: 1 / -1;
  min-width: 0;
  overflow: hidden;
  color: #a55b0a;
  font-size: 9px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-dispatch-ai-panel {
  margin: 0 15px 12px;
  border: 1px solid #cfe2db;
  border-radius: 12px;
}

.unit-operator-ai-panel .dispatch-ai-operation {
  grid-template-columns: 30px minmax(180px, 1fr) minmax(150px, .8fr);
}

.dispatch-ai-operator-candidates {
  min-width: 0;
  overflow: hidden;
  color: #087b67;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dispatch-ai-operation-list {
  display: grid;
  gap: 7px;
  margin-top: 11px;
}

.dispatch-ai-operation {
  display: grid;
  grid-template-columns: 30px minmax(200px, 1fr) minmax(190px, .55fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid #dbe6e2;
  border-radius: 9px;
  background: #fff;
}

.dispatch-ai-operation > span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 7px;
  background: #e4f3ee;
  color: #076452;
  font-size: 10px;
  font-weight: 850;
}

.dispatch-ai-operation > div {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.dispatch-ai-operation strong {
  font-size: 11px;
}

.dispatch-ai-operation small,
.dispatch-ai-operation p {
  overflow: hidden;
  margin: 0;
  color: #6a7873;
  font-size: 9px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dispatch-ai-operation .input {
  min-height: 36px;
  height: 36px;
  font-size: 10px;
}

.dispatch-ai-panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 10px;
}

.dispatch-ai-panel-actions p {
  margin: 0 auto 0 0;
  color: #61716b;
  font-size: 10px;
}

.dispatch-ai-loading,
.dispatch-ai-empty {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #667670;
  font-size: 10px;
}

.dispatch-ai-loading i {
  width: 14px;
  height: 14px;
  border: 2px solid #b8d9d0;
  border-top-color: #087b67;
  border-radius: 50%;
  animation: dispatch-ai-spin .8s linear infinite;
}

.operation-claim-state.is-delegated {
  border-color: #8ec7b7;
  background: #e6f5ef;
  color: #076452;
}

.unit-operation-match-card.is-delegated {
  border-color: #b7d9cf;
  background: #f6fbf9;
}

@keyframes dispatch-ai-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  .dispatch-ai-panel-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .dispatch-ai-panel-head .ghost-button {
    grid-column: 2 / -1;
    justify-self: end;
  }

  .dispatch-ai-operation {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .unit-operator-ai-panel .dispatch-ai-operation {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .unit-operator-ai-panel .dispatch-ai-operator-candidates,
  .unit-operator-ai-panel .dispatch-ai-operation em {
    grid-column: 2;
  }

  .dispatch-ai-operation .input {
    grid-column: 2;
  }
}

/* --------------------------------------------------------------------------
   Shared desktop visual refinement 2026-08-15
   A restrained pastel accent system adds hierarchy without changing the
   business semantics of the existing status colours or layouts.
   -------------------------------------------------------------------------- */

body.production-body {
  background:
    radial-gradient(circle at 86% 8%, rgba(229, 242, 255, .68), transparent 24%),
    radial-gradient(circle at 7% 92%, rgba(216, 247, 233, .62), transparent 28%),
    var(--bg);
}

.production-body .app-layout {
  background: transparent;
}

.production-body .sidebar {
  background:
    radial-gradient(circle at 20% 0%, rgba(61, 160, 132, .18), transparent 26%),
    linear-gradient(180deg, #102a23 0%, #15352c 48%, #10231e 100%);
  box-shadow: 8px 0 26px rgba(12, 35, 28, .09);
}

.production-body .brand-block {
  background: linear-gradient(145deg, rgba(255,255,255,.035), rgba(50, 150, 123, .10));
}

.production-body .side-link {
  border-radius: 12px;
}

.production-body .side-link:hover {
  background: linear-gradient(90deg, rgba(216,247,233,.15), rgba(229,242,255,.08));
}

.production-body .side-link.active {
  background: linear-gradient(90deg, rgba(29,183,125,.24), rgba(67,139,209,.14));
  border-color: rgba(126, 225, 198, .22);
  box-shadow: inset 3px 0 0 #6ee0be, 0 8px 18px rgba(8, 58, 45, .12);
}

.production-body .content {
  background:
    radial-gradient(circle at 96% 3%, rgba(238,232,255,.42), transparent 22%),
    radial-gradient(circle at 0% 62%, rgba(229,242,255,.32), transparent 23%),
    transparent;
}

.production-body .page-head h1 {
  letter-spacing: -.045em;
}

.production-body .card-panel,
.production-body .profile-card,
.production-body .form-panel,
.production-body .stats-rank-card,
.production-body .drawing-library-card {
  border-color: rgba(24, 67, 53, .12);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(249,252,250,.96));
  box-shadow: 0 10px 28px rgba(18, 57, 45, .055);
}

.production-body .primary-button,
.production-body .small-primary {
  background: linear-gradient(135deg, #1db77d, #087652);
  border-color: #087652;
  box-shadow: 0 8px 18px rgba(8, 118, 82, .16);
}

.production-body .ghost-button,
.production-body .action-btn,
.production-body .small-ghost,
.production-body .icon-button {
  background: rgba(255,255,255,.86);
}

.production-body .table-scroll {
  border-color: rgba(24, 67, 53, .13);
  box-shadow: 0 8px 22px rgba(18, 57, 45, .035);
}

.production-body .data-table th {
  background: linear-gradient(180deg, #f0f7f4, #edf4f2);
  color: #4d675e;
}

.production-body .data-table tbody tr:nth-child(even) {
  background: rgba(247, 251, 249, .68);
}

.production-body .data-table tbody tr:hover {
  background: linear-gradient(90deg, rgba(216,247,233,.42), rgba(229,242,255,.24));
  box-shadow: inset 3px 0 0 rgba(29, 183, 125, .55);
}

.production-body .dashboard-command {
  background: linear-gradient(135deg, rgba(15,118,110,.98), #163b34 62%, #245e72 100%);
}

.production-body .dashboard-grid {
  gap: 1px;
  padding: 1px;
  background: rgba(24, 67, 53, .10);
  border-color: rgba(24, 67, 53, .12);
}

.production-body .dashboard-card {
  --ui-card-accent: var(--brand);
  background: linear-gradient(145deg, rgba(216,247,233,.72), rgba(255,255,255,.96));
  box-shadow: inset 0 3px 0 var(--ui-card-accent);
}

.production-body .dashboard-card:nth-child(6n + 2) {
  --ui-card-accent: var(--ui-sky);
  background: linear-gradient(145deg, rgba(229,242,255,.82), rgba(255,255,255,.96));
}

.production-body .dashboard-card:nth-child(6n + 3) {
  --ui-card-accent: var(--ui-amber);
  background: linear-gradient(145deg, rgba(255,243,217,.88), rgba(255,255,255,.96));
}

.production-body .dashboard-card:nth-child(6n + 4) {
  --ui-card-accent: var(--ui-violet);
  background: linear-gradient(145deg, rgba(240,235,255,.82), rgba(255,255,255,.96));
}

.production-body .dashboard-card:nth-child(6n + 5) {
  --ui-card-accent: var(--ui-coral);
  background: linear-gradient(145deg, rgba(253,235,237,.82), rgba(255,255,255,.96));
}

.production-body .dashboard-card:nth-child(6n) {
  --ui-card-accent: var(--ui-teal);
  background: linear-gradient(145deg, rgba(226,246,242,.84), rgba(255,255,255,.96));
}

.production-body .dashboard-card:not(:disabled):hover {
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(229,242,255,.42));
}

.production-body .stats-kpi {
  --ui-card-accent: var(--brand);
  background: linear-gradient(145deg, rgba(216,247,233,.72), rgba(255,255,255,.98));
  box-shadow: inset 0 3px 0 var(--ui-card-accent), 0 10px 25px rgba(18,57,45,.05);
}

.production-body .stats-kpi:nth-child(5n + 2) {
  --ui-card-accent: var(--ui-sky);
  background: linear-gradient(145deg, rgba(229,242,255,.82), rgba(255,255,255,.98));
}

.production-body .stats-kpi:nth-child(5n + 3) {
  --ui-card-accent: var(--ui-amber);
  background: linear-gradient(145deg, rgba(255,243,217,.88), rgba(255,255,255,.98));
}

.production-body .stats-kpi:nth-child(5n + 4) {
  --ui-card-accent: var(--ui-violet);
  background: linear-gradient(145deg, rgba(240,235,255,.82), rgba(255,255,255,.98));
}

.production-body .stats-kpi:nth-child(5n) {
  --ui-card-accent: var(--ui-coral);
  background: linear-gradient(145deg, rgba(253,235,237,.82), rgba(255,255,255,.98));
}

.production-body .stats-rank-card:nth-child(2n) {
  background: linear-gradient(145deg, rgba(229,242,255,.44), rgba(255,255,255,.98));
}

.production-body .stats-rank-card:nth-child(3n) {
  background: linear-gradient(145deg, rgba(240,235,255,.44), rgba(255,255,255,.98));
}

.production-body .planning-create-panel,
.production-body .procurement-board {
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(229,242,255,.32));
}

.production-body .planning-section-head > div > span {
  background: linear-gradient(145deg, var(--ui-sky-soft), #fff);
  color: var(--ui-sky-dark, #245f9b);
}

.production-body .planning-list-card {
  background: linear-gradient(145deg, rgba(216,247,233,.52), rgba(255,255,255,.9));
}

.production-body .planning-list-card:nth-child(4n + 2) {
  background: linear-gradient(145deg, rgba(229,242,255,.62), rgba(255,255,255,.9));
}

.production-body .planning-list-card:nth-child(4n + 3) {
  background: linear-gradient(145deg, rgba(255,243,217,.68), rgba(255,255,255,.9));
}

.production-body .planning-list-card:nth-child(4n) {
  background: linear-gradient(145deg, rgba(240,235,255,.62), rgba(255,255,255,.9));
}

.production-body .planning-list-card.active {
  background: linear-gradient(145deg, var(--brand-soft), #fff);
}

.production-body .planning-dispatch-card:nth-child(4n + 2),
.production-body .operation-dispatch-row:nth-child(4n + 2) {
  border-color: rgba(67,139,209,.22);
  background: linear-gradient(145deg, rgba(229,242,255,.44), rgba(255,255,255,.96));
}

.production-body .planning-dispatch-card:nth-child(4n + 3),
.production-body .operation-dispatch-row:nth-child(4n + 3) {
  border-color: rgba(212,148,39,.22);
  background: linear-gradient(145deg, rgba(255,243,217,.5), rgba(255,255,255,.96));
}

.production-body .planning-dispatch-card:nth-child(4n),
.production-body .operation-dispatch-row:nth-child(4n) {
  border-color: rgba(128,101,200,.22);
  background: linear-gradient(145deg, rgba(240,235,255,.48), rgba(255,255,255,.96));
}

.production-body .drawing-library-card:nth-child(4n + 2) {
  background: linear-gradient(145deg, rgba(229,242,255,.52), rgba(255,255,255,.98));
}

.production-body .drawing-library-card:nth-child(4n + 3) {
  background: linear-gradient(145deg, rgba(255,243,217,.56), rgba(255,255,255,.98));
}

.production-body .drawing-library-card:nth-child(4n) {
  background: linear-gradient(145deg, rgba(240,235,255,.52), rgba(255,255,255,.98));
}

.production-body .segmented-control button.active,
.production-body .stats-switch-row button.active {
  color: var(--brand-strong);
  background: linear-gradient(145deg, var(--brand-soft), #fff);
  box-shadow: 0 2px 7px rgba(18, 57, 45, .1);
}

/* Bundled material-readiness.css for formal release 2026-08-17 */
.material-page-head {
  align-items: flex-end;
}

.material-evidence-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  padding: 2px;
  overflow: auto;
  overscroll-behavior: contain;
}

.material-evidence-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 10px;
  align-items: center;
  min-height: 62px;
  padding: 10px 12px;
  color: var(--text);
  background: #f6faf8;
  border: 1px solid var(--line);
  border-radius: 11px;
  text-decoration: none;
}

.material-evidence-item:hover,
.material-evidence-item:focus-visible {
  border-color: #9ecbbf;
  box-shadow: var(--focus);
}

.material-evidence-item > span {
  grid-row: 1 / span 3;
  align-self: start;
  padding: 4px 8px;
  color: #0f766e;
  background: #e4f3ef;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.material-evidence-item strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-evidence-item small,
.material-evidence-item em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.material-evidence-upload {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.material-evidence-upload > label {
  display: grid;
  gap: 6px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.material-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.material-summary-strip {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(4, minmax(120px, 1fr));
  margin-bottom: 16px;
  border: 1px solid #d5dfdb;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(22, 45, 38, .06);
  overflow: hidden;
}

.material-summary-strip article {
  min-width: 0;
  padding: 17px 20px;
  border-left: 1px solid #e5ebe8;
}

.material-summary-strip article:first-child {
  border-left: 0;
  background: #eef7f4;
}

.material-summary-strip span,
.material-summary-strip small {
  display: block;
  color: #64736e;
}

.material-summary-strip strong {
  display: block;
  margin: 4px 0 2px;
  color: #15231f;
  font-size: 26px;
  line-height: 1.1;
}

.material-summary-strip small {
  font-size: 12px;
}

.material-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  min-height: 610px;
  border: 1px solid #d4dfdb;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(22, 45, 38, .06);
  overflow: hidden;
}

.material-plan-pane {
  min-width: 0;
  padding: 18px 14px;
  border-right: 1px solid #dde6e2;
  background: #f7faf8;
}

.material-pane-head,
.material-detail-head,
.incoming-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.material-pane-head {
  padding: 0 5px 13px;
}

.material-pane-head h2 {
  margin: 2px 0 0;
  font-size: 19px;
}

.material-plan-list {
  display: grid;
  gap: 8px;
  max-height: 650px;
  padding-right: 4px;
  overflow: auto;
}

.material-plan-card {
  width: 100%;
  padding: 14px;
  border: 1px solid #dbe4e0;
  border-radius: 13px;
  background: #fff;
  color: #172520;
  text-align: left;
  cursor: pointer;
}

.material-plan-card:hover,
.material-plan-card:focus-visible {
  border-color: #6cae9f;
  outline: none;
  box-shadow: 0 0 0 3px rgba(30, 133, 110, .11);
}

.material-plan-card.active {
  border-color: #16856c;
  background: #edf8f4;
}

.material-plan-card-head,
.material-plan-card-meta,
.material-plan-card-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.material-plan-card-head strong {
  font-size: 15px;
}

.material-plan-card-head em {
  color: #687873;
  font-size: 12px;
  font-style: normal;
}

.material-plan-card > span {
  display: block;
  margin-top: 5px;
  color: #53635e;
  font-size: 13px;
}

.material-plan-card-meta {
  margin-top: 12px;
  color: #50605b;
  font-size: 12px;
}

.material-plan-card-meta b {
  color: #172520;
  font-size: 14px;
}

.material-plan-card-progress {
  margin-top: 10px;
}

.material-progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: #e3ebe8;
  overflow: hidden;
}

.material-progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #16856c;
}

.material-plan-card-progress small {
  min-width: 44px;
  color: #61716c;
  text-align: right;
}

.material-detail-pane {
  min-width: 0;
  padding: 22px;
}

.material-detail-empty {
  display: grid;
  place-content: center;
  min-height: 520px;
  color: #667670;
  text-align: center;
}

.material-detail-empty strong {
  color: #22322d;
  font-size: 20px;
}

.material-detail-empty p {
  max-width: 420px;
  margin: 8px auto 0;
}

.material-detail-head {
  align-items: flex-start;
  padding-bottom: 16px;
}

.material-detail-head h2 {
  margin: 4px 0;
  font-size: 24px;
}

.material-detail-head p {
  margin: 0;
  color: #61716c;
}

.material-detail-actions {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.material-view-toggle {
  display: grid;
  grid-template-columns: repeat(2, auto);
  align-self: flex-start;
  padding: 4px;
  border: 1px solid #cedbd6;
  border-radius: 11px;
  background: #f4f7f6;
}

.material-view-toggle button {
  min-height: 36px;
  padding: 7px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #5b6c66;
  cursor: pointer;
  font-weight: 700;
}

.material-view-toggle button:hover,
.material-view-toggle button:focus-visible {
  color: #0e765f;
  outline: none;
}

.material-view-toggle button.active {
  background: #fff;
  color: #0c725a;
  box-shadow: 0 2px 7px rgba(25, 61, 50, .12);
}

.material-buildable {
  min-width: 150px;
  padding: 12px 16px;
  border: 1px solid #b9d8cf;
  border-radius: 13px;
  background: #eef8f5;
  text-align: right;
}

.material-buildable span,
.material-buildable small {
  display: block;
  color: #56706a;
}

.material-buildable strong {
  display: block;
  color: #0d725c;
  font-size: 30px;
  line-height: 1.1;
}

.material-flow-note {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  padding: 11px 14px;
  border-left: 4px solid #16856c;
  border-radius: 0 10px 10px 0;
  background: #f1f7f5;
  color: #51635d;
  font-size: 13px;
}

.material-flow-note strong {
  flex: 0 0 auto;
  color: #1a332c;
}

.material-graph-view {
  display: grid;
  grid-template-columns: minmax(280px, .82fr) minmax(360px, 1.18fr);
  gap: 14px;
}

.material-graph-view[hidden] {
  display: none;
}

.material-chart-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid #d9e3df;
  border-radius: 15px;
  background: #fff;
}

.material-chart-card-primary.material-assembly-gauge {
  display: flex;
  align-items: center;
  gap: 24px;
  background: #f1f8f5;
}

.material-gauge-ring {
  position: relative;
  flex: 0 0 150px;
  width: 150px;
  height: 150px;
}

.material-gauge-ring svg {
  display: block;
  width: 100%;
  height: 100%;
}

.material-gauge-ring circle {
  fill: none;
  stroke-width: 11;
}

.material-gauge-ring .track {
  stroke: #dce8e4;
}

.material-gauge-ring .value {
  stroke: #16856c;
  stroke-linecap: round;
}

.material-gauge-ring > div {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.material-gauge-ring strong,
.material-gauge-ring span {
  display: block;
}

.material-gauge-ring strong {
  color: #0c725a;
  font-size: 30px;
  line-height: 1;
}

.material-gauge-ring span {
  margin-top: 6px;
  color: #657670;
  font-size: 12px;
}

.material-gauge-copy {
  min-width: 0;
}

.material-gauge-copy > span {
  color: #5e716a;
  font-size: 13px;
  font-weight: 700;
}

.material-gauge-copy > strong {
  display: block;
  margin-top: 5px;
  color: #17251f;
  font-size: 34px;
}

.material-gauge-copy > strong small {
  color: #7a8984;
  font-size: 18px;
  font-weight: 600;
}

.material-gauge-copy p {
  max-width: 260px;
  margin: 8px 0 0;
  color: #5b6c66;
  font-size: 13px;
  line-height: 1.55;
}

.material-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.material-chart-head span,
.material-chart-head strong,
.material-chart-head small {
  display: block;
}

.material-chart-head span,
.material-chart-head small {
  color: #697973;
  font-size: 12px;
}

.material-chart-head strong {
  margin-top: 3px;
  color: #1c2c26;
  font-size: 18px;
}

.material-status-total {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 11px;
}

.material-status-total strong {
  color: #182720;
  font-size: 30px;
}

.material-status-total span {
  color: #64756f;
  font-size: 13px;
}

.material-status-segments {
  display: flex;
  height: 18px;
  border-radius: 5px;
  background: #edf1ef;
  overflow: hidden;
}

.material-status-segments > i {
  display: block;
  min-width: 3px;
  height: 100%;
}

.material-status-segments .ready,
.material-chart-legend i.ready {
  background: #16856c;
}

.material-status-segments .pending,
.material-chart-legend i.pending {
  background: #d4992e;
}

.material-status-segments .quality,
.material-chart-legend i.quality {
  background: #8b62aa;
}

.material-status-segments .shortage,
.material-chart-legend i.shortage {
  background: #ca5149;
}

.material-chart-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px 18px;
  margin-top: 18px;
}

.material-chart-legend > span {
  display: grid;
  grid-template-columns: 9px 1fr auto;
  align-items: center;
  gap: 8px;
  color: #566861;
  font-size: 13px;
}

.material-chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.material-chart-legend b {
  font-weight: 600;
}

.material-chart-legend strong {
  color: #1c2c26;
  font-size: 15px;
}

.material-source-chart-card {
  grid-column: 1 / -1;
}

.material-source-chart {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 18px;
}

.material-source-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.material-source-row > div > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.material-source-row > div strong {
  color: #1c2b26;
  font-size: 15px;
}

.material-source-row > div small {
  color: #6d7d78;
  font-size: 12px;
}

.material-source-track {
  display: block;
  height: 8px;
  border-radius: 3px;
  background: #e6ece9;
  overflow: hidden;
}

.material-source-track > i {
  display: block;
  height: 100%;
}

.material-source-track > i.made {
  background: #16856c;
}

.material-source-track > i.buy {
  background: #4d79aa;
}

.material-source-track > i.outsource {
  background: #8359a8;
}

.material-chart-empty {
  display: grid;
  place-content: center;
  min-height: 110px;
  color: #73837d;
  font-size: 13px;
}

.material-table-scroll {
  max-height: 520px;
}

.material-table {
  min-width: 980px;
}

.material-part-cell strong,
.material-part-cell span,
.material-part-cell small {
  display: block;
}

.material-part-cell span {
  margin-top: 3px;
  color: #65756f;
  font-size: 12px;
}

.material-part-cell small {
  margin-top: 5px;
}

.material-source-pill,
.material-status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.material-source-pill.made {
  background: #e7f5f0;
  color: #0c725a;
}

.material-source-pill.buy {
  background: #edf2fa;
  color: #355b91;
}

.material-source-pill.outsource {
  background: #f4ecfb;
  color: #74489c;
}

.material-status-pill.ready {
  background: #e5f5ec;
  color: #167149;
}

.material-status-pill.partial,
.material-status-pill.pending {
  background: #fff3d9;
  color: #8b5b08;
}

.material-status-pill.short {
  background: #fdebea;
  color: #b23c35;
}

.material-shortage {
  color: #b33b34;
  font-weight: 750;
}

.material-zero {
  color: #80908b;
}

.incoming-toolbar {
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid #d5dfdb;
  border-radius: 13px;
  background: #fff;
}

.incoming-status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.incoming-status-tabs button {
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #51625d;
  cursor: pointer;
}

.incoming-status-tabs button:hover,
.incoming-status-tabs button:focus-visible {
  border-color: #b7ccc5;
  outline: none;
}

.incoming-status-tabs button.active {
  border-color: #9bc9bc;
  background: #eaf6f2;
  color: #0f735b;
  font-weight: 700;
}

.incoming-list {
  display: grid;
  gap: 11px;
}

.incoming-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(150px, .8fr) minmax(290px, 1.3fr) auto;
  align-items: center;
  gap: 18px;
  padding: 17px 18px;
  border: 1px solid #d8e1de;
  border-left: 5px solid #82938d;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(24, 48, 41, .045);
}

.incoming-card.waiting {
  border-left-color: #d4931b;
}

.incoming-card.review {
  border-left-color: #487cb5;
}

.incoming-card.returned {
  border-left-color: #c1463f;
}

.incoming-card.approved {
  border-left-color: #188061;
}

.incoming-card-main p,
.incoming-card-main h2,
.incoming-card-main strong,
.incoming-card-main span {
  margin: 0;
}

.incoming-card-main p {
  color: #65756f;
  font-size: 12px;
}

.incoming-card-main h2 {
  margin-top: 5px;
  font-size: 19px;
}

.incoming-card-main strong {
  display: block;
  margin-top: 2px;
}

.incoming-card-main span {
  display: block;
  margin-top: 6px;
  color: #596a64;
  font-size: 13px;
}

.incoming-card-arrival,
.incoming-card-result {
  display: grid;
  gap: 3px;
  color: #566761;
  font-size: 12px;
}

.incoming-card-arrival strong,
.incoming-card-result strong {
  color: #172620;
  font-size: 16px;
}

.incoming-card-result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(54px, 1fr));
  gap: 7px;
}

.incoming-card-result-grid span {
  padding: 8px;
  border-radius: 9px;
  background: #f5f8f7;
  text-align: center;
}

.incoming-card-result-grid b,
.incoming-card-result-grid small {
  display: block;
}

.incoming-card-result-grid b {
  color: #1f312b;
}

.incoming-card-actions {
  display: grid;
  justify-items: end;
  gap: 9px;
  min-width: 136px;
}

.incoming-card-actions .primary-button,
.incoming-card-actions .ghost-button {
  width: 100%;
  white-space: nowrap;
}

.incoming-empty {
  padding: 70px 20px;
  border: 1px dashed #bdcbc6;
  border-radius: 16px;
  background: #fbfcfb;
  color: #667771;
  text-align: center;
}

.incoming-empty strong {
  display: block;
  color: #25352f;
  font-size: 19px;
}

.material-form-modal {
  width: min(640px, calc(100vw - 32px));
}

.material-modal-context {
  margin: 5px 0 0;
  color: #61716c;
}

.material-quantity-balance {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #eef5f2;
  color: #315249;
  font-weight: 700;
}

.material-quantity-balance.invalid {
  background: #fdeeed;
  color: #a63731;
}

.material-review-numbers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.material-review-numbers article {
  padding: 11px;
  border: 1px solid #dce5e1;
  border-radius: 10px;
  background: #f7faf9;
}

.material-review-numbers span,
.material-review-numbers strong {
  display: block;
}

.material-review-numbers span {
  color: #66766f;
  font-size: 12px;
}

.material-review-numbers strong {
  margin-top: 3px;
  font-size: 18px;
}

.material-review-actions {
  justify-content: space-between;
}

@media (max-width: 1180px) {
  .material-summary-strip {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .material-summary-strip article:first-child {
    grid-column: span 2;
  }

  .incoming-card {
    grid-template-columns: minmax(220px, 1fr) minmax(150px, .7fr) minmax(260px, 1fr);
  }

  .incoming-card-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
  }

  .incoming-card-actions .primary-button,
  .incoming-card-actions .ghost-button {
    width: auto;
  }
}

@media (max-width: 850px) {
  .material-page-head {
    align-items: stretch;
  }

  .material-head-actions {
    width: 100%;
  }

  .material-head-actions button {
    flex: 1;
  }

  .material-summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .material-summary-strip article:first-child {
    grid-column: 1 / -1;
  }

  .material-workspace {
    grid-template-columns: 1fr;
  }

  .material-plan-pane {
    border-right: 0;
    border-bottom: 1px solid #dde6e2;
  }

  .material-plan-list {
    max-height: 320px;
  }

  .material-detail-head {
    flex-direction: column;
  }

  .material-detail-actions {
    width: 100%;
    justify-content: space-between;
  }

  .material-buildable {
    text-align: left;
  }

  .material-graph-view {
    grid-template-columns: 1fr;
  }

  .material-source-chart-card {
    grid-column: auto;
  }

  .material-source-chart {
    grid-template-columns: 1fr;
  }

  .incoming-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .incoming-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .incoming-card-actions {
    grid-column: auto;
    display: grid;
    justify-items: stretch;
  }

  .incoming-card-actions .primary-button,
  .incoming-card-actions .ghost-button {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .material-detail-actions,
  .material-chart-card-primary {
    align-items: stretch;
    flex-direction: column;
  }

  .material-view-toggle {
    align-self: stretch;
  }

  .material-view-toggle button {
    width: 100%;
  }

  .material-buildable {
    width: auto;
  }

  .material-gauge-ring {
    align-self: center;
  }
}

/* Shared pastel hierarchy for the desktop readiness workspace. */

.material-summary-strip article:nth-child(2) {
  background: linear-gradient(145deg, #e5f2ff, #fff);
}

.material-summary-strip article:nth-child(3) {
  background: linear-gradient(145deg, #fff1d3, #fff);
}

.material-summary-strip article:nth-child(4) {
  background: linear-gradient(145deg, #eee8ff, #fff);
}

.material-summary-strip article:nth-child(5) {
  background: linear-gradient(145deg, #fde8eb, #fff);
}

.material-plan-pane {
  background:
    radial-gradient(circle at 20% 0%, rgba(216,247,233,.74), transparent 28%),
    linear-gradient(180deg, #f7fbfa, #f1f7f4);
}

.material-plan-card {
  box-shadow: 0 5px 14px rgba(18,57,45,.035);
}

.material-plan-card:nth-child(4n + 1) {
  background: linear-gradient(145deg, #d8f7e9, #fff 68%);
}

.material-plan-card:nth-child(4n + 2) {
  background: linear-gradient(145deg, #e5f2ff, #fff 68%);
}

.material-plan-card:nth-child(4n + 3) {
  background: linear-gradient(145deg, #fff1d3, #fff 68%);
}

.material-plan-card:nth-child(4n) {
  background: linear-gradient(145deg, #eee8ff, #fff 68%);
}

.material-plan-card.active {
  border-color: #1db77d;
  background: linear-gradient(145deg, #d8f7e9, #fff 76%);
  box-shadow: inset 3px 0 0 #1db77d, 0 8px 18px rgba(18,57,45,.07);
}

.material-plan-card:nth-child(4n + 2).active {
  border-color: #438bd1;
  background: linear-gradient(145deg, #e5f2ff, #fff 76%);
  box-shadow: inset 3px 0 0 #438bd1, 0 8px 18px rgba(18,57,45,.07);
}

.material-plan-card:nth-child(4n + 3).active {
  border-color: #d49327;
  background: linear-gradient(145deg, #fff1d3, #fff 76%);
  box-shadow: inset 3px 0 0 #d49327, 0 8px 18px rgba(18,57,45,.07);
}

.material-plan-card:nth-child(4n).active {
  border-color: #8065c8;
  background: linear-gradient(145deg, #eee8ff, #fff 76%);
  box-shadow: inset 3px 0 0 #8065c8, 0 8px 18px rgba(18,57,45,.07);
}

.material-detail-pane {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,251,249,.92));
}

.material-buildable {
  background: linear-gradient(145deg, #d8f7e9, #e5f2ff);
  border-color: rgba(29,183,125,.18);
}

.material-chart-card:nth-child(2n) {
  background: linear-gradient(145deg, rgba(229,242,255,.48), #fff);
}

.material-source-chart-card {
  background: linear-gradient(145deg, rgba(240,235,255,.42), #fff);
}

.incoming-card:nth-child(4n + 1) {
  background: linear-gradient(145deg, rgba(216,247,233,.62), #fff 68%);
}

.incoming-card:nth-child(4n + 2) {
  background: linear-gradient(145deg, rgba(229,242,255,.66), #fff 68%);
}

.incoming-card:nth-child(4n + 3) {
  background: linear-gradient(145deg, rgba(255,243,217,.68), #fff 68%);
}

.incoming-card:nth-child(4n) {
  background: linear-gradient(145deg, rgba(240,235,255,.64), #fff 68%);
}

.incoming-card-result-grid span:nth-child(4n + 1) { background: #d8f7e9; }
.incoming-card-result-grid span:nth-child(4n + 2) { background: #e5f2ff; }
.incoming-card-result-grid span:nth-child(4n + 3) { background: #fff1d3; }
.incoming-card-result-grid span:nth-child(4n) { background: #eee8ff; }

/* Drill summary contrast fix 2026-08-19 */
.production-body .drill-summary-strip .stats-kpi {
  color: #173b31;
}

.production-body .drill-summary-strip .stats-kpi span {
  color: #315b4f;
  font-weight: 720;
}

.production-body .drill-summary-strip .stats-kpi strong {
  color: #102e26;
}

.production-body .drill-summary-strip .stats-kpi small {
  color: #526f66;
  font-weight: 620;
}
/* Codex 2026-08-19: planning-list name matches drawing number size. */
.planning-list-name {
  color: #000;
  font-size: 16px;
  font-weight: 700;
}
/* Codex 2026-08-19: show selected first operation in planning list. */
.planning-list-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.planning-list-name-row .planning-list-name {
  min-width: 0;
}

.planning-list-operation {
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
  gap: 5px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.planning-list-operation b {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  color: var(--brand-strong);
  background: var(--brand-soft);
  border-radius: 7px;
  font-size: 11px;
}

.planning-list-operation strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Piece-rate payroll: keep the calculation visible, auditable, and consistent
   with the existing restrained production-management visual language. */
.piece-wage-view {
  gap: 16px;
}

.piece-wage-rule {
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
  gap: 12px 18px;
  padding: 15px 18px;
  border: 1px solid rgba(8, 123, 103, .26);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-panel);
  background: linear-gradient(90deg, rgba(231, 244, 240, .96), rgba(255, 255, 255, .96));
}

.piece-wage-rule > span {
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
}

.piece-wage-rule strong {
  color: var(--text);
  font-size: 16px;
}

.piece-wage-rule small {
  color: var(--muted);
  text-align: right;
}

.piece-wage-filter-panel {
  padding: 16px;
}

.piece-wage-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}

.piece-wage-filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr)) auto;
  align-items: end;
  gap: 12px;
}

.piece-wage-filter-grid label,
.piece-wage-filter-field {
  display: grid;
  gap: 6px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.piece-wage-operator-picker {
  position: relative;
  min-width: 0;
}

.piece-wage-operator-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: var(--control-h);
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  font-weight: 600;
  text-align: left;
}

.piece-wage-operator-trigger:hover,
.piece-wage-operator-trigger.has-selection {
  color: var(--brand-strong);
  border-color: #79b7a6;
  background: var(--brand-quiet);
}

.piece-wage-operator-trigger[aria-expanded="true"] {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(8, 118, 82, .12);
}

.piece-wage-operator-chevron {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.piece-wage-operator-menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 7px);
  left: 0;
  width: min(340px, calc(100vw - 56px));
  color: var(--text);
  background: #fff;
  border: 1px solid rgba(24, 67, 53, .2);
  border-radius: var(--radius-panel);
  box-shadow: 0 18px 42px rgba(18, 57, 45, .18);
}

.piece-wage-operator-menu[hidden] {
  display: none;
}

.piece-wage-operator-menu-head,
.piece-wage-operator-menu-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
}

.piece-wage-operator-menu-head {
  border-bottom: 1px solid var(--line);
}

.piece-wage-operator-menu-head > button {
  min-height: 30px;
  padding: 0;
  color: var(--brand-strong);
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 750;
}

.piece-wage-operator-options {
  display: grid;
  height: 240px;
  padding: 6px;
  overflow-y: auto;
}

.piece-wage-operator-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 7px 8px;
  color: var(--text);
  border-radius: 7px;
  cursor: pointer;
}

.piece-wage-operator-option:hover,
.piece-wage-operator-option.selected {
  background: var(--brand-quiet);
}

.piece-wage-operator-option input {
  width: 17px;
  min-height: 17px;
  padding: 0;
  accent-color: var(--brand);
}

.piece-wage-operator-option > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.piece-wage-operator-option strong,
.piece-wage-operator-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.piece-wage-operator-option small,
.piece-wage-operator-menu-foot,
.piece-wage-operator-empty {
  color: var(--muted);
  font-size: 12px;
}

.piece-wage-operator-menu-foot {
  border-top: 1px solid var(--line);
}

.piece-wage-operator-menu-foot .primary-button {
  min-height: 34px;
  padding-inline: 12px;
  font-size: 13px;
}

.piece-wage-operator-empty {
  margin: 0;
  padding: 22px 14px;
  text-align: center;
}

.piece-wage-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
}

.piece-wage-kpi {
  display: grid;
  width: 100%;
  min-height: 112px;
  padding: 17px 18px;
  border: 1px solid rgba(24, 67, 53, .12);
  border-top: 3px solid var(--brand);
  border-radius: var(--radius-panel);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 9px 24px rgba(18, 57, 45, .05);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.piece-wage-kpi:hover,
.piece-wage-kpi[aria-pressed="true"] {
  border-color: rgba(24, 67, 53, .32);
  box-shadow: 0 12px 28px rgba(18, 57, 45, .11);
}

.piece-wage-kpi:focus-visible {
  outline: 3px solid var(--ui-sky);
  outline-offset: 2px;
}

.piece-wage-kpi.blue { border-top-color: var(--ui-sky); }
.piece-wage-kpi.purple { border-top-color: var(--ui-violet); }
.piece-wage-kpi.orange { border-top-color: var(--ui-amber); }
.piece-wage-kpi.green { border-top-color: var(--brand); }

.piece-wage-kpi span,
.piece-wage-kpi small {
  color: var(--muted);
}

.piece-wage-kpi strong {
  align-self: center;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(24px, 2vw, 32px);
  letter-spacing: -.035em;
}

.piece-wage-kpi small {
  align-self: end;
}

.piece-wage-warning {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid rgba(184, 104, 8, .24);
  border-radius: var(--radius-panel);
  color: #7f4b08;
  background: var(--warning-soft);
}

.piece-wage-warning[hidden] {
  display: none;
}

.piece-wage-warning span {
  color: #8e692f;
}

.piece-wage-panel {
  padding: 0;
  border-radius: var(--radius-panel);
  overflow: hidden;
}

.piece-wage-panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.piece-wage-panel-head h2,
.piece-wage-panel-head p {
  margin: 0;
}

.piece-wage-panel-head > span {
  color: var(--muted);
  font-size: 12px;
}

.piece-wage-panel .table-scroll {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.piece-wage-panel {
  scroll-margin-top: 110px;
}

.piece-wage-detail-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--warning-soft);
  color: #7f4b08;
}

.piece-wage-detail-filter[hidden] {
  display: none;
}

.piece-wage-detail-filter button {
  border: 0;
  background: transparent;
  color: var(--brand-strong);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.piece-wage-focus-total th:nth-child(9),
.piece-wage-focus-total td:nth-child(9),
.piece-wage-focus-operators th:first-child,
.piece-wage-focus-operators td:first-child,
.piece-wage-focus-quantity th:nth-child(5),
.piece-wage-focus-quantity td:nth-child(5) {
  background: rgba(20, 132, 112, .08);
}

.piece-wage-table {
  min-width: 1040px;
}

.piece-wage-detail-table {
  min-width: 1120px;
}

.piece-wage-money {
  color: var(--brand-strong);
  font-variant-numeric: tabular-nums;
}

.piece-wage-unpriced-row {
  background: rgba(255, 244, 223, .55);
}

@media (max-width: 1180px) {
  .piece-wage-filter-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .piece-wage-kpi-grid {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }

  .piece-wage-rule {
    grid-template-columns: auto 1fr;
  }

  .piece-wage-rule small {
    grid-column: 2;
    text-align: left;
  }
}

@media (max-width: 760px) {
  .piece-wage-filter-grid,
  .piece-wage-kpi-grid {
    grid-template-columns: 1fr;
  }

  .piece-wage-rule {
    grid-template-columns: 1fr;
  }

  .piece-wage-rule small {
    grid-column: 1;
  }

  .piece-wage-warning,
  .piece-wage-panel-head,
  .piece-wage-head-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .piece-wage-head-actions,
  .piece-wage-head-actions > button {
    width: 100%;
  }
}

/* Statistics: BOM navigation keeps aggregate counts distinct from piece quantities. */
.stat-bom-panel { margin: 18px 0; border-top: 3px solid var(--primary, #00856c); }
#viewStatDrawing.bom-navigation-active #statDrawingCards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-bom-heading, .stat-bom-tools, .stat-bom-orders-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.stat-bom-heading h2 { margin: 6px 0 0; font-size: 25px; overflow-wrap: anywhere; }
.stat-bom-eyebrow, .stat-bom-node-label { color: #277b6c; font-size: 12px; font-weight: 650; letter-spacing: .04em; }
.stat-bom-node-label { margin-bottom: 5px; }
.stat-bom-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px 0; }
.stat-bom-breadcrumb button { border: 0; padding: 5px 0; background: transparent; color: #007d66; cursor: pointer; font: inherit; }
.stat-bom-breadcrumb strong { font-size: 13px; overflow-wrap: anywhere; }
.stat-bom-hint { margin: 12px 0 18px; padding: 12px 14px; border-left: 3px solid #9bcbbb; background: #f0f8f5; color: #4c6760; font-size: 13px; line-height: 1.7; }
.stat-bom-tools { margin-bottom: 14px; }
.stat-bom-tools > label:first-child { flex: 1 1 280px; max-width: 440px; }
.stat-bom-tools .input { width: 100%; }
.stat-bom-table { min-width: 740px; }
.stat-bom-table th:first-child { width: 43%; }
.stat-bom-table td { padding-top: 16px; padding-bottom: 16px; }
.stat-bom-table .stat-link { font-size: 16px; text-align: left; }
.stat-bom-table .subtext { margin-top: 5px; }
.stat-bom-table tbody tr:hover { background: #f1faf6; }
.stat-bom-empty { padding: 25px 16px; color: #607972; background: #f5f9f7; border: 1px dashed #c8dbd4; border-radius: 12px; line-height: 1.7; }
.stat-bom-orders-head { margin: 24px 0 12px; }
.stat-bom-orders-head h3 { margin: 0; font-size: 18px; }
.stat-bom-orders-head span { color: #607972; font-size: 12px; }
.stat-bom-orders-table { min-width: 860px; }
#statBomTitle:focus-visible, .stat-bom-panel button:focus-visible { outline: 2px solid #00856c; outline-offset: 3px; }
@media (max-width: 760px) {
  #viewStatDrawing.bom-navigation-active #statDrawingCards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-bom-heading h2 { font-size: 21px; }
  .stat-bom-tools > label:first-child { max-width: none; }
  .stat-bom-tools .inline-control { font-size: 12px; }
}

/* Procurement record browsing shares one page scroll with current task actions. */
.material-part-detail-link { display: block; padding: 3px 0; border: 0; background: transparent; color: #087f6c; font: inherit; font-weight: 700; text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.material-part-detail-link:hover { color: #045c4e; }
.material-part-detail-link:focus-visible { outline: 2px solid #087f6c; outline-offset: 3px; border-radius: 3px; }
#viewProcurement > [hidden] { display: none !important; }
.procurement-record-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 14px; }
.procurement-record-warning { color: #a84419; font-weight: 600; }
.procurement-record-detail { width: min(1000px, 94vw); }
.procurement-record-section { padding: 14px 0; border-bottom: 1px solid #e4eae7; }
.procurement-record-fields { margin: 10px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.procurement-record-fields > div { min-width: 0; }
.procurement-record-fields dt { color: #61706b; font-size: 12px; }
.procurement-record-fields dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.procurement-record-item { padding: 12px; margin: 8px 0; background: #f5f8f6; border-radius: 8px; }
@media (max-width: 760px) { .procurement-record-fields { grid-template-columns: 1fr; } .procurement-record-pagination { justify-content: center; } }

/* Wage filters: direct children only; keep checkbox rows horizontal. */
.piece-wage-filter-grid { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
.piece-wage-filter-grid > [hidden] { display: none; }
.piece-wage-filter-grid .piece-wage-operator-option { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: center; font-weight: 400; }
.piece-wage-operator-menu { width: min(380px, calc(100vw - 56px)); }
.piece-wage-operator-search { margin: 10px 12px; width: calc(100% - 24px); }
.piece-wage-operator-options { height: auto; max-height: 280px; min-height: 64px; align-content: start; }
.piece-wage-operator-option strong { font-size: 14px; color: var(--text); }
.piece-wage-operator-option small { font-size: 12px; font-weight: 400; }
@media (max-width: 900px) { .piece-wage-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .piece-wage-filter-grid { grid-template-columns: minmax(0, 1fr); } }

@media (min-width: 901px) { .piece-wage-filter-grid .piece-wage-operator-picker { grid-column: span 2; } }

.planning-list-tools { display: flex; gap: 8px; padding: 12px 16px; }
.planning-list-tools input { min-width: 0; flex: 1; }
#planningPagination { flex: 0 0 auto; padding: 12px 16px; }

/* Person statistics: four compact vertical charts and one shared people filter. */
#viewStatPerson .person-rank-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
#viewStatPerson .person-rank-grid .stats-rank-card {
  --rank-accent: #07816d;
  min-width: 0;
  min-height: 282px;
  padding: 14px 13px 12px;
  border-top: 3px solid var(--rank-accent);
}
#viewStatPerson .person-rank-grid .stats-rank-card:nth-child(2) { --rank-accent: #337dc7; }
#viewStatPerson .person-rank-grid .stats-rank-card:nth-child(3) { --rank-accent: #c47519; }
#viewStatPerson .person-rank-grid .stats-rank-card:nth-child(4) { --rank-accent: #8063c8; }
#viewStatPerson .person-rank-grid .stats-rank-card h2 {
  margin-bottom: 3px;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.person-rank-scale { margin: 0 0 5px; color: var(--muted); font-size: 11px; }
.person-rank-chart {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.person-rank-column {
  display: grid;
  grid-template-rows: 151px 35px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.person-rank-column:disabled { cursor: default; }
.person-rank-column:focus-visible { outline: 2px solid var(--rank-accent); outline-offset: 2px; border-radius: 5px; }
.person-rank-plot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  height: 151px;
  border-bottom: 1px solid #dce9e6;
  background: repeating-linear-gradient(to top, transparent 0, transparent 47px, #edf4f2 48px);
}
.person-rank-value {
  margin-bottom: 5px;
  color: var(--rank-accent);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.person-rank-bar {
  display: block;
  flex: none;
  width: min(72%, 34px);
  min-height: 5px;
  border-radius: 6px 6px 0 0;
  background: var(--rank-accent);
  opacity: .9;
}
.person-rank-column:hover:not(:disabled) .person-rank-bar,
.person-rank-column:focus-visible .person-rank-bar { opacity: 1; }
.person-rank-name {
  display: -webkit-box;
  overflow: hidden;
  padding-top: 7px;
  color: var(--text);
  font-size: 11px;
  line-height: 1.3;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.person-rank-foot {
  margin: 7px 0 0;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}
#viewStatPerson .person-rank-filter {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 12px 16px;
}
.person-rank-filter h2 { margin: 0 0 3px; font-size: 16px; }
.person-rank-filter p { margin: 0; color: var(--muted); font-size: 12px; }
.person-rank-filter-controls {
  display: grid;
  grid-template-columns: minmax(170px, 260px) minmax(145px, 190px) auto;
  align-items: end;
  gap: 10px;
}
.person-rank-filter-controls > label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.person-rank-filter-controls .input { width: 100%; min-height: 38px; }
.person-rank-filter-controls .ghost-button { min-height: 38px; white-space: nowrap; }
#viewStatPerson .stats-filter-bar { grid-template-columns: repeat(5, minmax(125px, 1fr)); }
@media (max-width: 1250px) {
  #viewStatPerson .person-rank-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #viewStatPerson .person-rank-filter { align-items: stretch; flex-direction: column; }
}
@media (max-width: 760px) {
  #viewStatPerson .person-rank-grid { grid-template-columns: minmax(0, 1fr); }
  .person-rank-filter-controls { grid-template-columns: minmax(0, 1fr); }
  #viewStatPerson .stats-filter-bar { grid-template-columns: minmax(0, 1fr); }
}

/* Drawing rankings appear in both BOM navigation and the flat drawing view. */
#viewStatDrawing .drawing-rank-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 12px;
}
#viewStatDrawing .drawing-rank-grid .stats-rank-card {
  --rank-accent: #07816d;
  min-width: 0;
  min-height: 282px;
  padding: 14px 13px 12px;
  border-top: 3px solid var(--rank-accent);
}
#viewStatDrawing .drawing-rank-grid .stats-rank-card:nth-child(2) { --rank-accent: #337dc7; }
#viewStatDrawing .drawing-rank-grid .stats-rank-card:nth-child(3) { --rank-accent: #c47519; }
#viewStatDrawing .drawing-rank-grid .stats-rank-card:nth-child(4) { --rank-accent: #8063c8; }
#viewStatDrawing .drawing-rank-grid .stats-rank-card h2 {
  margin-bottom: 3px;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#viewStatDrawing .drawing-rank-grid .person-rank-name { overflow-wrap: anywhere; }
@media (max-width: 1250px) {
  #viewStatDrawing .drawing-rank-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  #viewStatDrawing .drawing-rank-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Keep titles and business context; omit decorative and instructional copy. */
.production-body .page-kicker,
.production-body .panel-eyebrow:not([id]),
.production-body #unitDispatchListEyebrow,
.production-body .stat-bom-eyebrow,
.production-body .ib-kicker,
.production-body .page-head > div:first-child > p:not([role]):not([aria-live]),
.production-body .ib-heading > div:first-child > p:not([role]):not([aria-live]),
.production-body .supply-workbench-head > div:first-child > p:not([role]):not([aria-live]),
.production-body .dashboard-trace-copy > p,
.production-body .dashboard-panel-note,
.production-body .dashboard-progress-metric-hint,
.production-body .dashboard-wip-legend > small,
.production-body .dashboard-progress-overdue small,
.production-body .integrity-panel-description,
.production-body .integrity-record-section-title > span,
.production-body .workspace-section-head > div > p:not([id]):not([role]):not([aria-live]),
.production-body .planning-section-head > div > p:not([role]):not([aria-live]),
.production-body .planning-section-head > div > div > p:not([role]):not([aria-live]),
.production-body .planning-bom-actions > p:not([role]):not([aria-live]),
.production-body .dispatch-ai-panel-actions > p:not([role]):not([aria-live]),
.production-body .supply-overview-note,
.production-body .person-rank-filter > p:not([id]):not([role]):not([aria-live]),
.production-body .stat-bom-hint:empty,
.login-body:not(.role-switcher-body) .login-title p {
  display: none !important;
}

/* Omit remaining fixed captions without hiding record values or live feedback. */
.production-body .dashboard-wip-subtitle,
.production-body .dashboard-wip-insight-title > small,
.production-body .dashboard-card-hint,
.production-body .dashboard-bom-child-note,
.production-body .result-evidence-note,
.production-body .integrity-empty-state > small,
.production-body .inventory-flow,
.production-body #supplyWorkCaption,
.production-body .ip-batch-note,
.production-body .piece-wage-rule > small,
.production-body .field-help:not([id]):not([role]):not([aria-live]),
.production-body .planning-detail-empty > p:not([role]):not([aria-live]),
.production-body #ibPolicy,
.production-body #ibRiskNote,
.production-body #ibAiText:empty,
.production-body #ibBreadcrumb:empty,
.production-body #ibBomHint:empty,
.production-body #materialBuildableHint:empty,
.production-body #materialDetailEmptyHint:empty {
  display: none !important;
}
