:root {
      color-scheme: light;
      --accent: #0078d4;
      --accent-hover: #106ebe;
      --accent-soft: #eff6fc;
      --ink: #242424;
      --muted: #616161;
      --subtle: #8a8886;
      --line: #d1d1d1;
      --line-soft: #e5e5e5;
      --surface: #ffffff;
      --surface-alt: #faf9f8;
      --surface-rail: #f3f2f1;
      --completed: #107c10;
      --completed-bg: #eff8ef;
      --pending: #0078d4;
      --pending-bg: #eff6fc;
      --partial: #f7630c;
      --partial-bg: #fff4ce;
      --erp-ligu-bg: #f5fbff;
      --erp-ligu-rail: #e5f2ff;
      --erp-xclr-bg: #fffaf1;
      --erp-xclr-rail: #fff1d6;
      --danger: #a4262c;
      --danger-bg: #fde7e9;
      --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      background: var(--surface-alt);
      color: var(--ink);
      font: 14px/1.5 "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    }

    button,
    input,
    select {
      font: inherit;
    }

    a {
      color: inherit;
    }

    .shell {
      min-height: 100vh;
    }

    .topbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      min-height: 72px;
      padding: 14px 28px;
      background: var(--surface);
      border-bottom: 1px solid var(--line-soft);
    }

    .topnav {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      flex-wrap: wrap;
    }

    .brand {
      display: flex;
      align-items: center;
      min-width: 0;
      gap: 12px;
    }

    .brand-mark {
      display: grid;
      place-items: center;
      width: 42px;
      height: 42px;
      border-radius: 6px;
      background: var(--accent);
      color: #fff;
      font-size: 17px;
      font-weight: 700;
    }

    .brand-copy {
      min-width: 0;
    }

    h1,
    h2,
    h3,
    p {
      margin: 0;
    }

    h1 {
      font-size: 20px;
      font-weight: 650;
      line-height: 1.2;
      letter-spacing: 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

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

    main {
      width: min(1440px, calc(100% - 32px));
      margin: 0 auto;
      padding: 18px 0 28px;
    }

    .command-band,
    .filter-band,
    .flow-band,
    .detail-band {
      background: var(--surface);
      border: 1px solid var(--line-soft);
      border-radius: 8px;
    }

    .command-band {
      display: grid;
      grid-template-columns: minmax(250px, auto) minmax(0, 1fr);
      align-items: stretch;
      gap: 14px;
      padding: 14px;
    }

    .command-actions,
    .meta-strip,
    .filter-row,
    .section-head {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    .command-actions {
      align-content: center;
    }

    .audit-upload-actions {
      align-items: center;
    }

    .file-picker {
      display: inline-flex;
      align-items: center;
      margin: 0;
      cursor: pointer;
    }

    .file-picker input {
      position: absolute;
      width: 1px;
      height: 1px;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
    }

    .meta-strip {
      justify-content: flex-end;
    }

    .button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 34px;
      gap: 7px;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 0 13px;
      background: var(--surface);
      color: var(--ink);
      text-decoration: none;
      cursor: pointer;
      white-space: nowrap;
    }

    .button:hover {
      border-color: var(--accent);
      color: var(--accent);
    }

    .button:disabled {
      cursor: wait;
      opacity: 0.68;
    }

    .primary-button {
      border-color: var(--accent);
      background: var(--accent);
      color: #fff;
    }

    .primary-button:hover {
      border-color: var(--accent-hover);
      background: var(--accent-hover);
      color: #fff;
    }

    .subtle-button {
      min-height: 30px;
      padding: 0 10px;
      color: var(--muted);
      background: transparent;
    }

    .meta-item {
      min-width: 170px;
      padding: 5px 0;
    }

    .meta-label {
      display: block;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.2;
    }

    .meta-value {
      display: block;
      margin-top: 2px;
      color: var(--ink);
      font-weight: 600;
      overflow-wrap: anywhere;
    }

    .filter-band {
      margin-top: 12px;
      padding: 14px;
    }

    .filter-row {
      align-items: flex-end;
    }

    .field {
      display: grid;
      gap: 5px;
      min-width: 190px;
    }

    .field.material-field {
      position: relative;
      min-width: min(420px, 100%);
      flex: 1 1 320px;
    }

    label,
    .field-label {
      color: var(--muted);
      font-size: 12px;
      font-weight: 600;
    }

    select,
    input[type="text"] {
      width: 100%;
      height: 36px;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 0 10px;
      background: var(--surface);
      color: var(--ink);
      outline: none;
    }

    select:focus,
    input[type="text"]:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.18);
    }

    .option-list {
      position: absolute;
      z-index: 20;
      top: calc(100% + 4px);
      left: 0;
      right: 0;
      max-height: 260px;
      overflow: auto;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: var(--surface);
      box-shadow: var(--shadow);
    }

    .option-item {
      display: block;
      width: 100%;
      min-height: 38px;
      padding: 8px 10px;
      border: 0;
      border-bottom: 1px solid var(--line-soft);
      background: transparent;
      color: var(--ink);
      text-align: left;
      cursor: pointer;
    }

    .option-item:hover,
    .option-item:focus {
      background: var(--accent-soft);
      outline: none;
    }

    .option-code {
      display: block;
      font-weight: 650;
      overflow-wrap: anywhere;
    }

    .option-name {
      display: block;
      margin-top: 1px;
      color: var(--muted);
      font-size: 12px;
      overflow-wrap: anywhere;
    }

    .segmented {
      display: inline-grid;
      grid-template-columns: 1fr 1fr;
      border: 1px solid var(--line);
      border-radius: 6px;
      overflow: hidden;
      background: var(--surface);
    }

    .segment {
      min-width: 74px;
      min-height: 34px;
      border: 0;
      border-right: 1px solid var(--line);
      background: transparent;
      color: var(--ink);
      cursor: pointer;
    }

    .segment:last-child {
      border-right: 0;
    }

    .segment.active {
      background: var(--accent);
      color: #fff;
      font-weight: 650;
    }

    .message {
      display: none;
      margin-top: 12px;
      border-radius: 6px;
      padding: 9px 11px;
      border: 1px solid var(--line);
      background: var(--surface);
      color: var(--ink);
    }

    .message.visible {
      display: block;
    }

    .message.error {
      border-color: #f1aeb5;
      background: var(--danger-bg);
      color: var(--danger);
    }

    .message.success {
      border-color: #a7d7a7;
      background: var(--completed-bg);
      color: #0b5a0b;
    }

    .message.info {
      border-color: #b8d6f3;
      background: var(--pending-bg);
      color: #004578;
    }

    .flow-band,
    .detail-band,
    .audit-summary-band,
    .audit-results-band {
      margin-top: 12px;
      padding: 16px;
    }

    .audit-summary-band,
    .audit-results-band {
      background: var(--surface);
      border: 1px solid var(--line-soft);
      border-radius: 8px;
    }

    .audit-summary-grid {
      display: grid;
      grid-template-columns: minmax(280px, 1.15fr) repeat(2, minmax(240px, 1fr));
      gap: 12px;
      align-items: start;
    }

    .summary-panel {
      border: 1px solid var(--line-soft);
      border-radius: 8px;
      padding: 12px;
      background: var(--surface-alt);
      min-width: 0;
    }

    .summary-panel h3 {
      margin: 0;
      color: var(--ink);
      font-size: 13px;
      line-height: 1.25;
    }

    .summary-panel-heading,
    .summary-panel-toggle {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .summary-panel-heading span,
    .summary-compact {
      color: var(--muted);
      font-size: 12px;
      font-weight: 650;
    }

    .summary-panel-toggle {
      width: 100%;
      border: 0;
      padding: 0;
      background: transparent;
      color: var(--ink);
      text-align: left;
      cursor: pointer;
    }

    .summary-panel-toggle:focus-visible,
    .summary-filter-button:focus-visible {
      outline: 2px solid rgba(0, 120, 212, 0.28);
      outline-offset: 2px;
    }

    .summary-panel-title {
      flex: 0 0 auto;
      font-weight: 750;
    }

    .summary-compact {
      flex: 1 1 auto;
      min-width: 0;
      overflow-wrap: anywhere;
    }

    .summary-toggle-icon {
      flex: 0 0 auto;
      color: var(--muted);
      font-weight: 850;
    }

    .summary-panel-body {
      margin-top: 12px;
    }

    .source-info-body {
      display: grid;
      grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
      gap: 14px;
    }

    .summary-column h3 {
      margin-bottom: 8px;
    }

    .summary-stat-list {
      display: grid;
      gap: 5px;
      margin: 0;
    }

    .summary-stat-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) max-content;
      gap: 12px;
      align-items: baseline;
    }

    .summary-stat-row dt {
      color: var(--muted);
      font-size: 12px;
    }

    .summary-stat-row dd {
      margin: 0;
      color: var(--ink);
      font-variant-numeric: tabular-nums;
      font-weight: 700;
      text-align: right;
      overflow-wrap: anywhere;
    }

    .summary-empty-line {
      color: var(--muted);
      font-size: 12px;
    }

    .summary-filter-list {
      display: grid;
      gap: 7px;
      margin-top: 10px;
    }

    .summary-filter-button {
      display: grid;
      grid-template-columns: minmax(0, 1fr) max-content;
      gap: 12px;
      align-items: center;
      min-height: 34px;
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 0 10px;
      background: #fff;
      color: var(--text);
      cursor: pointer;
      text-align: left;
    }

    .summary-filter-button:hover {
      border-color: var(--accent);
      color: var(--accent);
    }

    .summary-filter-button.active {
      border-color: var(--accent);
      background: rgba(0, 120, 212, 0.1);
      color: var(--accent);
      box-shadow: inset 0 0 0 1px rgba(0, 120, 212, 0.24);
    }

    .summary-filter-button:disabled {
      cursor: default;
      opacity: 0.6;
    }

    .summary-filter-button span {
      min-width: 0;
      overflow-wrap: anywhere;
    }

    .summary-filter-button strong {
      font-variant-numeric: tabular-nums;
      font-size: 14px;
      text-align: right;
    }

    .audit-table-wrap {
      overflow: auto;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface);
    }

    .audit-table {
      width: 100%;
      min-width: 1400px;
      border-collapse: collapse;
      font-size: 12px;
    }

    .audit-table th,
    .audit-table td {
      vertical-align: top;
      border-bottom: 1px solid var(--line-soft);
      padding: 9px 10px;
      text-align: left;
      overflow-wrap: anywhere;
    }

    .audit-table th {
      position: sticky;
      top: 0;
      z-index: 2;
      background: var(--surface-rail);
      color: var(--muted);
      font-weight: 700;
      white-space: nowrap;
    }

    .header-subline {
      display: block;
      margin-top: 2px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 650;
    }

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

    .expand-cell {
      width: 36px;
      min-width: 36px;
      text-align: center;
    }

    .expand-toggle {
      width: 26px;
      height: 26px;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: #ffffff;
      color: var(--text);
      font-weight: 800;
      line-height: 1;
      cursor: pointer;
    }

    .expand-toggle:hover {
      border-color: var(--accent);
      color: var(--accent);
    }

    .audit-row-child td {
      background: rgba(96, 94, 92, 0.04);
    }

    .group-summary {
      margin-bottom: 6px;
      color: var(--muted);
      font-weight: 650;
    }

    .audit-row.status-mismatch {
      background: rgba(164, 38, 44, 0.05);
    }

    .audit-row.status-not_found,
    .audit-row.status-ambiguous {
      background: rgba(247, 99, 12, 0.06);
    }

    .audit-row.status-ok {
      background: rgba(16, 124, 16, 0.04);
    }

    .status-pill {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      border-radius: 6px;
      padding: 0 8px;
      border: 1px solid var(--line);
      font-size: 11px;
      font-weight: 750;
      white-space: nowrap;
    }

    .status-pill.status-ok {
      border-color: #a7d7a7;
      background: var(--completed-bg);
      color: #0b5a0b;
    }

    .status-pill.status-mismatch,
    .status-pill.status-not_found {
      border-color: #f1aeb5;
      background: var(--danger-bg);
      color: var(--danger);
    }

    .status-pill.status-ambiguous {
      border-color: #ffd89c;
      background: var(--partial-bg);
      color: #8a4b00;
    }

    .subline {
      display: block;
      margin-top: 2px;
      color: var(--muted);
      font-size: 11px;
    }

    .issue-list {
      margin: 0;
      padding-left: 16px;
    }

    .issue-list li + li {
      margin-top: 5px;
    }

    .issue-values {
      display: block;
      margin-top: 2px;
      color: var(--muted);
    }

    .issue-values-stacked {
      display: grid;
      grid-template-columns: max-content minmax(0, 1fr);
      column-gap: 6px;
      row-gap: 2px;
    }

    .issue-value-row {
      display: contents;
    }

    .issue-value-label {
      font-weight: 650;
      white-space: nowrap;
    }

    .issue-value-text {
      overflow-wrap: anywhere;
    }

    .source-result {
      min-width: 150px;
    }

    .source-ref {
      margin-bottom: 5px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 650;
    }

    .source-ref-empty {
      font-weight: 500;
    }

    .source-result .ok-text {
      display: block;
    }

    .audit-note {
      margin-top: 7px;
      color: #004578;
      font-weight: 650;
    }

    .ok-text {
      color: #0b5a0b;
      font-weight: 650;
    }

    .muted-text {
      color: var(--muted);
    }

    .section-head {
      justify-content: space-between;
      margin-bottom: 12px;
    }

    .detail-section-head {
      align-items: center;
    }

    .section-title-line,
    .detail-actions {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
      flex-wrap: wrap;
    }

    .section-title-line {
      flex: 1 1 auto;
    }

    .detail-actions {
      justify-content: flex-end;
    }

    .switch-control {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      min-height: 34px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 650;
      cursor: pointer;
      user-select: none;
      white-space: nowrap;
    }

    .switch-control input {
      position: absolute;
      width: 1px;
      height: 1px;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
    }

    .switch-track {
      position: relative;
      width: 38px;
      height: 20px;
      border-radius: 999px;
      background: #c8c6c4;
      transition: background 140ms ease;
    }

    .switch-thumb {
      position: absolute;
      top: 3px;
      left: 3px;
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: #fff;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.24);
      transition: transform 140ms ease;
    }

    .switch-control input:checked + .switch-track {
      background: var(--accent);
    }

    .switch-control input:checked + .switch-track .switch-thumb {
      transform: translateX(18px);
    }

    .switch-control input:focus-visible + .switch-track {
      box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.24);
    }

    h2 {
      font-size: 16px;
      font-weight: 650;
      letter-spacing: 0;
    }

    .section-meta {
      color: var(--muted);
      font-size: 12px;
    }

    .empty-state {
      min-height: 128px;
      display: grid;
      place-items: center;
      border: 1px dashed var(--line);
      border-radius: 8px;
      color: var(--muted);
      background: var(--surface-alt);
      text-align: center;
      padding: 22px;
    }

    .empty-state.compact {
      min-height: 54px;
      padding: 12px;
    }

    .flow-chain {
      display: grid;
      gap: 12px;
      overflow: visible;
    }

    .flow-chain.penetrated {
      grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr);
      align-items: stretch;
    }

    .company-flow {
      min-width: 0;
      border: 1px solid var(--line-soft);
      border-radius: 8px;
      padding: 12px;
      background: var(--surface);
      overflow: hidden;
    }

    .flow-chain.penetrated .company-flow {
      min-width: 0;
    }

    .company-flow.selected-company {
      border-color: var(--accent);
      box-shadow: inset 0 0 0 1px rgba(0, 120, 212, 0.42);
    }

    .company-title {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 10px;
      color: var(--ink);
      font-size: 13px;
    }

    .company-title span {
      color: var(--accent);
      font-size: 12px;
      font-weight: 650;
    }

    .company-materials {
      display: grid;
      gap: 6px;
      margin: -2px 0 12px;
    }

    .company-material {
      display: grid;
      gap: 2px;
      min-width: 0;
      border: 1px solid var(--line-soft);
      border-radius: 6px;
      padding: 8px 10px;
      background: rgba(255, 255, 255, 0.58);
    }

    .company-material-label {
      color: var(--muted);
      font-size: 10px;
      font-weight: 650;
    }

    .company-material strong {
      font-size: 14px;
      line-height: 1.25;
      overflow-wrap: anywhere;
    }

    .company-material-name {
      color: var(--muted);
      font-size: 12px;
      line-height: 1.35;
      overflow-wrap: anywhere;
    }

    .erp-theme-ligu {
      background: var(--erp-ligu-bg);
    }

    .erp-theme-xclr {
      background: var(--erp-xclr-bg);
    }

    .flow-connector {
      display: grid;
      place-items: center;
      align-self: start;
      min-height: 0;
      padding-top: 128px;
      color: var(--accent);
      text-align: center;
    }

    .flow-connector span {
      display: block;
      color: var(--muted);
      font-size: 11px;
      font-weight: 650;
    }

    .flow-connector strong {
      display: block;
      font-size: 22px;
    }

    .flow {
      display: grid;
      grid-template-columns: minmax(150px, 1fr) 26px minmax(140px, 0.78fr) 26px minmax(150px, 1fr);
      gap: 10px;
      align-items: stretch;
    }

    .flow-arrow {
      display: grid;
      place-items: center;
      color: var(--accent);
      font-size: 22px;
      font-weight: 650;
    }

    .flow-node {
      min-height: 150px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.74);
      padding: 14px;
      min-width: 0;
    }

    .node-title {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 12px;
    }

    .node-title h3 {
      font-size: 14px;
      font-weight: 650;
      letter-spacing: 0;
    }

    .node-type {
      color: var(--muted);
      font-size: 12px;
    }

    .mini-panel {
      min-height: 94px;
      border: 1px solid var(--line-soft);
      border-radius: 6px;
      background: rgba(255, 255, 255, 0.62);
      padding: 10px;
    }

    .mini-title {
      color: var(--muted);
      font-size: 12px;
      font-weight: 650;
    }

    .metric-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
      margin-top: 8px;
    }

    .metric {
      min-width: 0;
    }

    .metric-label {
      display: block;
      color: var(--muted);
      font-size: 11px;
    }

    .metric-value {
      display: block;
      margin-top: 1px;
      font-size: 18px;
      font-weight: 700;
      white-space: nowrap;
      word-break: keep-all;
    }

    .stock-metrics {
      display: grid;
      gap: 12px;
      margin-top: 18px;
    }

    .stock-row {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      border-bottom: 1px solid var(--line-soft);
      padding-bottom: 9px;
    }

    .stock-row:last-child {
      border-bottom: 0;
      padding-bottom: 0;
    }

    .stock-label {
      color: var(--muted);
    }

    .stock-value {
      font-size: 20px;
      font-weight: 700;
      text-align: right;
      white-space: nowrap;
      word-break: keep-all;
    }

    .bom-panel {
      margin-top: 14px;
      border-top: 1px solid var(--line-soft);
      padding-top: 14px;
    }

    .company-bom {
      margin-top: 12px;
    }

    .bom-head h3 {
      font-size: 15px;
      font-weight: 650;
    }

    .bom-group {
      margin-top: 12px;
    }

    .bom-group-title {
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 650;
    }

    .bom-group-title span {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 22px;
      height: 20px;
      border-radius: 10px;
      background: var(--surface-rail);
      color: var(--ink);
      font-size: 11px;
    }

    .bom-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
      gap: 10px;
      margin-top: 8px;
    }

    .company-bom .bom-grid {
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .bom-card {
      display: grid;
      gap: 7px;
      min-width: 0;
      border: 1px solid var(--line-soft);
      border-radius: 8px;
      padding: 11px;
      background: var(--surface);
      color: var(--ink);
      text-align: left;
      cursor: pointer;
    }

    .bom-card:hover {
      border-color: var(--accent);
      box-shadow: 0 0 0 1px rgba(0, 120, 212, 0.12);
    }

    .bom-card.erp-theme-ligu {
      background: var(--erp-ligu-bg);
    }

    .bom-card.erp-theme-xclr {
      background: var(--erp-xclr-bg);
    }

    .bom-card-top,
    .bom-relation {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      min-width: 0;
      color: var(--muted);
      font-size: 12px;
    }

    .bom-material {
      font-size: 14px;
      font-weight: 700;
      overflow-wrap: anywhere;
    }

    .bom-name,
    .bom-empty {
      color: var(--muted);
      font-size: 12px;
      overflow-wrap: anywhere;
    }

    .bom-relation strong {
      color: var(--ink);
      white-space: nowrap;
    }

    .bom-metrics {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 7px;
    }

    .bom-metrics span span {
      display: block;
      color: var(--muted);
      font-size: 10px;
    }

    .bom-metrics strong {
      display: block;
      font-size: 13px;
      white-space: nowrap;
      word-break: keep-all;
    }

    .detail-focus-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 10px;
      border: 1px solid var(--line-soft);
      border-radius: 8px;
      padding: 8px 10px;
      background: var(--accent-soft);
    }

    .detail-focus-bar span {
      font-weight: 650;
      overflow-wrap: anywhere;
    }

    .timeline-wrap {
      border: 1px solid var(--line);
      border-radius: 8px;
      max-height: 680px;
      overflow: auto;
      background: var(--surface);
    }

    .timeline-grid {
      display: grid;
      grid-template-columns: 128px repeat(var(--erp-count, 1), minmax(190px, 1fr) minmax(190px, 1fr) minmax(96px, 0.52fr));
      min-width: 100%;
      overflow: visible;
    }

    .timeline-grid.penetrated {
      min-width: 1160px;
    }

    .timeline-head-cell {
      position: sticky;
      top: 0;
      z-index: 5;
      min-height: 38px;
      padding: 10px;
      border-bottom: 1px solid var(--line);
      border-right: 1px solid var(--line);
      background: var(--surface-rail);
      color: var(--muted);
      font-size: 12px;
      font-weight: 650;
    }

    .timeline-head-cell.lane-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }

    .timeline-head-cell.lane-head.erp-theme-ligu {
      background: var(--erp-ligu-rail);
    }

    .timeline-head-cell.lane-head.erp-theme-xclr {
      background: var(--erp-xclr-rail);
    }

    .timeline-head-cell.lane-head span {
      color: var(--muted);
      font-weight: 600;
    }

    .timeline-head-cell.stock-head {
      text-align: right;
    }

    .head-title,
    .head-current {
      display: grid;
      gap: 1px;
      min-width: 0;
    }

    .head-title {
      text-align: left;
    }

    .head-current {
      justify-items: end;
      text-align: right;
    }

    .head-current span {
      color: var(--muted);
      font-size: 10px;
      font-weight: 600;
    }

    .head-current strong {
      color: var(--ink);
      font-size: 13px;
      line-height: 1.15;
      white-space: nowrap;
      word-break: keep-all;
    }

    .timeline-head-cell.selected-company {
      color: var(--ink);
      box-shadow: inset 0 3px 0 var(--accent);
    }

    .timeline-head-cell:last-child {
      border-right: 0;
    }

    .date-head {
      left: 0;
      z-index: 9;
    }

    .date-cell,
    .lane-cell,
    .stock-cell {
      min-height: 64px;
      border-bottom: 1px solid var(--line-soft);
      border-right: 1px solid var(--line-soft);
      padding: 9px 10px;
      background: var(--surface);
    }

    .date-cell {
      position: sticky;
      left: 0;
      z-index: 4;
      background: var(--surface-alt);
      color: var(--muted);
      font-size: 13px;
    }

    .date-cell.today {
      color: var(--ink);
      font-weight: 800;
      background: #f5fbff;
    }

    .date-main {
      display: block;
      color: var(--ink);
      font-size: 15px;
      font-weight: 650;
      line-height: 1.25;
      white-space: nowrap;
    }

    .date-weekday {
      display: block;
      margin-top: 2px;
      color: var(--muted);
      font-weight: 400;
    }

    .lane-cell {
      min-width: 0;
    }

    .lane-cell.erp-theme-ligu {
      background: var(--erp-ligu-bg);
    }

    .lane-cell.erp-theme-xclr {
      background: var(--erp-xclr-bg);
    }

    .lane-cell.selected-company {
      box-shadow: inset 3px 0 0 rgba(0, 120, 212, 0.35);
    }

    .date-cell.negative-row {
      box-shadow: inset 4px 0 0 var(--danger);
    }

    .date-cell.negative-row,
    .lane-cell.negative-row,
    .stock-cell.negative-row {
      background: linear-gradient(0deg, rgba(164, 38, 44, 0.1), rgba(164, 38, 44, 0.1)), var(--surface);
    }

    .lane-cell.erp-theme-ligu.negative-row,
    .stock-cell.erp-theme-ligu.negative-row {
      background: linear-gradient(0deg, rgba(164, 38, 44, 0.1), rgba(164, 38, 44, 0.1)), var(--erp-ligu-bg);
    }

    .lane-cell.erp-theme-xclr.negative-row,
    .stock-cell.erp-theme-xclr.negative-row {
      background: linear-gradient(0deg, rgba(164, 38, 44, 0.1), rgba(164, 38, 44, 0.1)), var(--erp-xclr-bg);
    }

    .stock-cell {
      border-right: 1px solid var(--line-soft);
      background: var(--surface-alt);
      color: var(--muted);
      font-size: 12px;
      text-align: right;
    }

    .stock-cell.erp-theme-ligu {
      background: var(--erp-ligu-bg);
    }

    .stock-cell.erp-theme-xclr {
      background: var(--erp-xclr-bg);
    }

    .stock-cell.selected-company {
      box-shadow: inset 3px 0 0 rgba(0, 120, 212, 0.35);
    }

    .stock-cell strong {
      display: block;
      color: var(--ink);
      font-size: 13px;
      white-space: nowrap;
      word-break: keep-all;
    }

    .negative-number {
      color: var(--danger);
    }

    .current-stock {
      margin-bottom: 6px;
      font-weight: 800;
    }

    .event-card {
      border: 1px solid var(--line-soft);
      border-left: 4px solid var(--pending);
      border-radius: 6px;
      background: var(--pending-bg);
      padding: 8px;
    }

    .event-card.status-completed {
      border-left-color: var(--completed);
      background: var(--completed-bg);
    }

    .event-card.status-partial {
      border-left-color: var(--partial);
      background: var(--partial-bg);
    }

    .event-card.status-pending {
      border-left-color: var(--pending);
      background: var(--pending-bg);
    }

    .event-card + .event-card {
      margin-top: 8px;
    }

    .doc-button {
      display: inline;
      border: 0;
      padding: 0;
      background: transparent;
      color: #004578;
      font-weight: 700;
      text-align: left;
      text-decoration: underline;
      cursor: pointer;
      overflow-wrap: anywhere;
    }

    .event-line {
      display: flex;
      justify-content: space-between;
      gap: 8px;
      margin-top: 5px;
      color: var(--muted);
      font-size: 12px;
    }

    .event-type {
      overflow-wrap: anywhere;
    }

    .event-qty {
      color: var(--ink);
      font-weight: 650;
      white-space: nowrap;
      word-break: keep-all;
    }

    .detail-drop {
      margin-top: 8px;
      border-top: 1px solid rgba(0, 0, 0, 0.14);
      padding-top: 8px;
      background: rgba(255, 255, 255, 0.42);
    }

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

    .detail-item {
      min-width: 0;
    }

    .detail-label {
      display: block;
      color: var(--muted);
      font-size: 11px;
    }

    .detail-value {
      display: block;
      color: var(--ink);
      font-size: 12px;
      overflow-wrap: anywhere;
    }

    .close-detail {
      margin-top: 8px;
    }

    .muted {
      color: var(--muted);
    }

    .nowrap {
      white-space: nowrap;
    }

    @media (max-width: 1180px) {
      .audit-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }

      .source-info-panel {
        grid-column: 1 / -1;
      }

      .flow-chain.penetrated {
        grid-template-columns: 1fr;
      }

      .flow-connector {
        min-height: 34px;
        padding-top: 0;
      }
    }

    @media (max-width: 980px) {
      .topbar,
      .command-band {
        grid-template-columns: 1fr;
      }

      .topbar {
        align-items: flex-start;
      }

      .meta-strip {
        justify-content: flex-start;
      }

      .flow {
        grid-template-columns: 1fr;
      }

      .audit-summary-grid,
      .source-info-body {
        grid-template-columns: 1fr;
      }

      .source-info-panel {
        grid-column: auto;
      }

      .flow-chain.penetrated {
        grid-template-columns: 1fr;
      }

      .flow-chain.penetrated .company-flow {
        min-width: 0;
      }

      .flow-arrow {
        min-height: 28px;
      }

      .flow-connector {
        min-height: 34px;
      }

      .timeline-grid {
        grid-template-columns: 112px repeat(var(--erp-count, 1), minmax(170px, 1fr) minmax(170px, 1fr) minmax(92px, 0.52fr));
      }
    }

    @media (max-width: 720px) {
      main {
        width: min(100% - 20px, 1440px);
      }

      .topbar {
        padding: 12px 16px;
      }

      h1 {
        white-space: normal;
      }

      .command-actions,
      .meta-strip,
      .filter-row,
      .section-head {
        align-items: stretch;
      }

      .section-title-line,
      .detail-actions {
        width: 100%;
      }

      .button,
      .field,
      .meta-item {
        width: 100%;
      }

      .segmented {
        width: 100%;
      }

      .metric-grid,
      .detail-grid {
        grid-template-columns: 1fr;
      }

      .timeline-wrap {
        overflow-x: auto;
      }

      .timeline-grid {
        min-width: 660px;
      }

      .timeline-grid.penetrated {
        min-width: 1080px;
      }
    }
  
