:root {
  --bg: #eef0f3;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-soft: #f6f7f9;
  --surface-tint: #e6f3f0;
  --line: #e7e9ee;
  --line-strong: #d2d6dd;
  --text: #14161a;
  --muted: #6b7280;
  --accent: #0d9488;
  --accent-dark: #0f766e;
  --accent-weak: #d6f1ec;
  --accent-ink: #0f766e;
  --signal: #d4862a;
  --ink: #14161a;
  --success: #15803d;
  --danger: #dc2626;
  --warn: #b45309;
  --shadow: 0 24px 60px rgba(28, 32, 42, 0.12);
  --shadow-soft: 0 6px 18px rgba(28, 32, 42, 0.07);
  --radius: 10px;
  --font-ui: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", "Cascadia Mono", "Consolas", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font-ui);
  letter-spacing: -0.1px;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
  letter-spacing: 0;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 82px;
  padding: 0 15px;
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(13, 148, 136, 0.28);
  outline-offset: 2px;
}

button.secondary,
.download-button {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
  font-weight: 500;
}

button.secondary:hover,
.download-button:hover {
  background: var(--surface-soft);
  border-color: #c2c7cf;
}

button.danger {
  background: #fff;
  border-color: var(--danger);
  color: var(--danger);
}

button.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

input,
select {
  padding: 0 12px;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

input:hover,
select:hover {
  border-color: var(--line-strong);
}

input[type="file"] {
  min-height: 40px;
  height: auto;
  padding: 7px 10px;
  line-height: 1.2;
}

input[type="search"]{
  min-width: 380px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: inherit;
  font-family: var(--font-ui);
  font-size: clamp(18px, 1.8vw, 22px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.3px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

p,
.muted {
  color: var(--muted);
}

.hidden,
[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--accent);
  color: #ffffff;
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-block {
  min-width: 0;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar p {
  max-width: 760px;
  margin-top: 3px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.access-badge,
.icon-button {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

.access-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.icon-button {
  min-width: 96px;
  color: var(--text);
  font-weight: 500;
}

.icon-button:hover {
  background: var(--surface-soft);
  border-color: #c2c7cf;
}

.login-wrap {
  position: relative;
}

.login-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: min(340px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
  color: var(--text);
}

.login-popover label,
.settings-form label {
  color: #3a3a3c;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-popover input,
.settings-form input,
.settings-form select {
  width: 100%;
}

.microsoft-login-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #185abd;
  border-radius: 6px;
  background: #185abd;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.microsoft-login-button:hover {
  background: #124a9c;
  border-color: #124a9c;
}

.microsoft-login-hint {
  margin: -3px 0 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.local-login-fallback {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.local-login-fallback summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}

.local-login-fields {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.login-popover .login-close-actions {
  grid-template-columns: 1fr;
}

.microsoft-auth-state {
  color: var(--muted);
  font-size: 11px;
}

.login-actions,
.feedback-row,
.download-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.login-popover .login-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.login-actions button {
  flex: 1;
  min-width: 0;
}

main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px clamp(16px, 1.8vw, 36px) 28px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  box-shadow: none;
}

.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  height: auto;
  min-height: 54px;
  padding: 18px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

button.stat:hover {
  border-color: #c8ccd4;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.stat::before {
  display: none;
}

.stat strong {
  display: block;
  flex-shrink: 0;
  width: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat span {
  display: block;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

.stat-delta {
  display: block;
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-delta--up {
  color: var(--success);
}

.stat-delta--warn {
  color: var(--warn);
}

.stat-delta--muted {
  color: var(--muted);
}

.tabs {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  overflow-x: visible;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 9px;
}

.nav-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #a7adb6;
}

.nav-divider {
  width: 1px;
  height: 22px;
  background: var(--line-strong);
}

.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius);
  background: #e3e6eb;
}

.tab {
  min-width: auto;
  height: 32px;
  padding: 0 13px;
  border: 0;
  border-color: transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
  box-shadow: none;
  font-weight: 500;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.5);
  border-color: transparent;
  color: var(--text);
}

.tab.active {
  background: var(--surface);
  border-color: transparent;
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(28, 32, 42, 0.12), 0 0 0 1px rgba(28, 32, 42, 0.04);
  font-weight: 600;
}

.panel {
  display: none;
  min-height: calc(100vh - 210px);
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.panel.active {
  display: block;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(17, 24, 21, 0.12);
}

.panel-header p {
  margin-top: 4px;
}

#tab-workboard .panel-header p {
  display: none;
}

.toolbar,
.toolbar form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar {
  margin-bottom: 16px;
}

.quick-import {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(200px, 320px) auto minmax(100px, auto);
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
  padding: 8px;
  border: 1px solid rgba(17, 24, 21, 0.12);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(12, 118, 109, 0.08), transparent 38%),
    #fbfaf5;
}

.quick-import strong,
.quick-import span {
  display: block;
}

.quick-import strong {
  margin-bottom: 0;
}

.quick-import > div span {
  display: none;
  color: var(--muted);
  font-size: 12px;
}

#tab-workboard .panel-header {
  display: block;
}

.workboard-toolbar {
  justify-content: flex-start;
  width: 100%;
}

.workboard-toolbar .quick-import--toolbar {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}

.quick-import--toolbar button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.quick-import--toolbar .feedback-status:empty {
  display: none;
}

.quick-import--toolbar .feedback-status:not(:empty) {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 35;
  width: max-content;
  max-width: 280px;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
}

.workboard-toolbar .wb-search {
  min-width: 220px;
  flex-basis: 260px;
}

.workboard-toolbar .wb-search input {
  width: 100%;
  min-width: 0;
}

#tab-workboard .workboard-toolbar .autosave-status:empty {
  display: none;
}

.workboard-toolbar > button,
.workboard-toolbar > select,
.workboard-toolbar > .column-picker {
  flex-shrink: 0;
  white-space: nowrap;
}

@media (min-width: 1280px) {
  #tab-workboard .workboard-toolbar {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 6px;
  }

  #tab-workboard .workboard-toolbar .wb-search {
    margin-left: auto;
  }
}

@media (max-width: 1000px) {
  .workboard-toolbar .quick-import--toolbar {
    flex: 1 1 100%;
  }
}

.import-area {
  display: grid;
  gap: 8px;
  max-width: 880px;
  margin-bottom: 16px;
}

.daily-import-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.danger-check {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 18px minmax(220px, 1fr);
  align-items: start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(220, 38, 38, 0.24);
  border-radius: var(--radius);
  background: #fff7f7;
  color: var(--text);
}

.danger-check input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--danger);
}

.danger-check strong,
.danger-check small {
  display: block;
}

.danger-check strong {
  color: var(--danger);
  font-size: 13px;
}

.danger-check small {
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.35;
}

.daily-fda-preserve {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.daily-fda-preserve strong {
  color: var(--accent);
}

.daily-fda-preserve input {
  accent-color: var(--accent);
}

.log,
.status-log,
.meta {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  white-space: pre-wrap;
}

.log {
  min-height: 190px;
  max-height: 460px;
  padding: 15px;
  background: #1d1d1f;
  color: #f5f5f7;
}

.status-log {
  min-height: 92px;
  max-height: 300px;
  padding: 12px;
  background: #fafafa;
  color: #3a3a3c;
}

.wb-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Always-visible top horizontal scrollbar, synced with the table below, so the
   wide Workboard can be scrolled sideways without hunting for the bottom bar. */
.wb-hscroll {
  overflow-x: auto;
  overflow-y: hidden;
  height: 14px;
  margin-bottom: 4px;
}

.wb-hscroll > div {
  height: 1px;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 310px);
  border: 1px solid rgba(17, 24, 21, 0.13);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

#loadsTable {
  height: calc(100vh - 300px);
  min-height: 460px;
  max-height: none;
}

.table-footer {
  position: sticky;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: max-content;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.workboard-footer {
  min-width: 1320px;
}

.pager-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pager-actions button:disabled {
  border-color: var(--line);
  background: #f5f5f7;
  color: #a1a1a6;
  cursor: not-allowed;
  transform: none;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.workboard-table {
  min-width: 1320px;
  table-layout: fixed;
  font-size: 12.5px;
}

.workboard-table th,
.workboard-table td {
  height: 32px;
  padding: 5px 8px;
  overflow: hidden;
  line-height: 1.2;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.workboard-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0;
  background: var(--surface-soft);
  color: #4b515a;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  user-select: none;
}

.workboard-table thead th[draggable="true"] {
  cursor: grab;
}

.workboard-table thead th[draggable="true"]:active {
  cursor: grabbing;
}

.column-sort-button {
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 5px 18px 5px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: 760;
  text-align: left;
  text-transform: inherit;
  box-shadow: none;
  transform: none;
}

.column-sort-button:hover {
  background: rgba(12, 118, 109, 0.08);
  border-color: transparent;
}

.column-sort-button:active {
  transform: none;
}

.column-sort-button .column-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.column-sort-button::after {
  color: #a1a1a6;
  content: "\2195";
  font-size: 10px;
  font-weight: 700;
}

.workboard-table thead th.is-sorted {
  background: #e5f1ee;
  color: var(--accent-dark);
}

.workboard-table thead th.sort-asc .column-sort-button::after {
  color: var(--accent);
  content: "\2191";
}

.workboard-table thead th.sort-desc .column-sort-button::after {
  color: var(--accent);
  content: "\2193";
}

.column-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  z-index: 3;
  width: 8px;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: col-resize;
  transform: none;
}

.column-resize-handle:hover,
.column-resize-handle:focus-visible {
  background: rgba(12, 118, 109, 0.28);
  outline: none;
}

body.is-resizing-column,
body.is-resizing-column * {
  cursor: col-resize !important;
  user-select: none !important;
}

.workboard-table thead th.dragging-column {
  opacity: 0.5;
}

.workboard-table thead th.drop-target-column {
  background: #e8f2ff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.workboard-table tbody tr {
  cursor: pointer;
}

.workboard-table tbody tr:hover td {
  background: #edf8f5;
}

.workboard-table .col-load {
  width: 112px;
  font-weight: 760;
}

.workboard-table .col-status {
  width: 96px;
}

.workboard-table .col-po {
  width: 88px;
}

.workboard-table .col-sku {
  width: 108px;
  font-weight: 760;
}

.workboard-table .col-number {
  width: 76px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.workboard-table .col-date {
  width: 96px;
  font-variant-numeric: tabular-nums;
}

.workboard-table .col-warehouse {
  width: 150px;
}

.workboard-table .col-dest {
  width: 76px;
}

.workboard-table .col-vendor {
  width: 128px;
}

.workboard-table .col-customer {
  width: 126px;
}

.workboard-table .col-description {
  width: 260px;
}

.workboard-table .col-text {
  width: 150px;
}

.workboard-table .col-step {
  width: 52px;
  text-align: center;
}

.workboard-table select[data-step-field] {
  width: 44px;
  min-width: 0;
  height: 24px;
  padding: 0 4px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 760;
}

.workboard-table select[data-step-field].is-done,
.step-select.is-done {
  border-color: rgba(22, 138, 100, 0.34);
  background: #e8f8ef;
  color: var(--success);
}

.workboard-table select[data-step-field].is-no,
.step-select.is-no {
  border-color: rgba(180, 35, 24, 0.28);
  background: #fff1f0;
  color: var(--danger);
}

.workboard-table select[data-step-field].is-na,
.step-select.is-na {
  border-color: var(--line-strong);
  background: #f0f1f4;
  color: #6b7280;
}

.workboard-table .status-pill {
  min-height: 20px;
  padding: 0 7px;
  font-size: 11px;
}

.workboard-status-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  max-width: 100%;
}

.workboard-status-cell .status-fda-hold {
  box-sizing: border-box;
  max-width: 100%;
  padding-top: 2px;
  padding-bottom: 2px;
  white-space: normal;
  line-height: 1.3;
  background: #fff0d8;
  color: #8c4600;
}

.workboard-table .grid-step {
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  font-size: 11px;
}

.excel-grid th,
.excel-grid td {
  padding: 7px 9px;
  font-size: 13px;
}

.excel-grid .description-cell {
  min-width: 280px;
  max-width: 520px;
  white-space: normal;
}

.grid-input,
.detail-line-input {
  width: 100%;
  min-width: 86px;
  height: 28px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.grid-input.short,
.detail-line-input.short {
  min-width: 82px;
}

.grid-input.medium,
.detail-line-input.medium {
  min-width: 150px;
}

.grid-input.sku-input,
.detail-line-input.sku-input {
  min-width: 118px;
  font-weight: 720;
}

.grid-input.number-input,
.detail-line-input.number-input {
  min-width: 92px;
  text-align: right;
}

.grid-input.date-input {
  min-width: 112px;
}

.grid-input.description-input,
.detail-line-input.description-input {
  min-width: 300px;
}

.grid-input:hover,
.detail-line-input:hover {
  border-color: var(--line);
  background: #ffffff;
}

.grid-input:focus,
.detail-line-input:focus {
  border-color: var(--accent);
  background: #ffffff;
  outline: 2px solid rgba(0, 122, 255, 0.14);
}

.grid-input.is-saving,
.detail-line-input.is-saving,
.detail-form input.is-saving,
.detail-form textarea.is-saving {
  background: #fff8e6;
}

.grid-input.is-saved,
.detail-line-input.is-saved,
.detail-form input.is-saved,
.detail-form textarea.is-saved {
  background: #e8f8ef;
}

.excel-grid .sticky-action {
  position: sticky;
  left: 0;
  z-index: 1;
  background: inherit;
}

.excel-grid thead th:first-child {
  left: 0;
  z-index: 3;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f5f7;
  color: #3a3a3c;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td {
  max-width: 360px;
  overflow: hidden;
  color: #2c2c2e;
  text-overflow: ellipsis;
}

tbody tr:nth-child(even) td {
  background: #fbfaf5;
}

tbody tr:hover td {
  background: var(--surface-tint);
}

.empty-state {
  padding: 34px 18px;
  color: var(--muted);
  text-align: center;
}

.meta {
  margin: 10px 0 0;
  padding: 10px;
  background: #f7f7f8;
  color: var(--muted);
  font-size: 12px;
}

.feedback-row,
.download-row {
  margin-top: 10px;
}

.feedback-button,
.download-button {
  min-width: auto;
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.feedback-button:disabled,
.download-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.feedback-status {
  color: var(--muted);
  font-size: 12px;
}

.chart-card {
  max-width: 940px;
  margin: 0 0 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.chart-title {
  margin: 0 0 8px;
  color: var(--text);
  font-weight: 720;
}

.price-chart {
  display: block;
  width: 100%;
  height: auto;
  color: var(--muted);
  font-size: 12px;
}

.chart-grid {
  stroke: #d8d8dc;
}

.chart-axis {
  stroke: #8e8e93;
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-points circle {
  fill: #ffffff;
  stroke: var(--accent);
  stroke-width: 2;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(360px, 1fr);
  gap: 24px;
  align-items: start;
}

.admin-grid {
  display: grid;
  gap: 24px;
}

.settings-layout > div:first-child {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfbfd;
}

.settings-layout h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.settings-form {
  display: grid;
  gap: 10px;
  max-width: 760px;
}

.admin-failure-section {
  display: grid;
  gap: 12px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading p {
  margin-top: 4px;
}

.admin-failure-table {
  max-height: 420px;
}

.admin-table {
  min-width: 980px;
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f5f7;
  color: #3a3a3c;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.numeric-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.compact-toolbar {
  justify-content: flex-end;
  margin-bottom: 0;
}

/* Workboard 智能搜索框：一个框写 `字段:值` 多条件 + 全字段自由词 */
.wb-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 360px;
  flex: 1 1 360px;
  max-width: 560px;
}

/* Narrow phones (~390px): let the search box shrink to fit instead of forcing
   360px and overflowing the toolbar. Desktop layout above is unchanged. */
@media (max-width: 480px) {
  .wb-search {
    min-width: 0;
    flex-basis: 100%;
  }
}

.wb-search input {
  width: 100%;
}

/* 字段名联想下拉：打字段名时弹出匹配项 */
.wb-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 45;
  min-width: 200px;
  max-width: 320px;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

.wb-suggest.hidden {
  display: none;
}

.wb-suggest-option {
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
}

.wb-suggest-option:hover,
.wb-suggest-option.is-active {
  background: var(--surface-tint);
  color: var(--accent-dark);
}

/* 未知字段名的红色警示，浮在搜索框下方，不挤占工具栏布局 */
.wb-search-warning {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 35;
  padding: 4px 8px;
  border: 1px solid var(--danger);
  border-radius: 6px;
  background: #fff;
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: var(--shadow-soft);
}

.wb-search-warning.hidden {
  display: none;
}

/* Fields 帮助面板：列出可搜字段名，点一下插进搜索框 */
.wb-fields-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: max-content;
  max-width: 520px;
  max-height: 320px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

.wb-fields-panel.hidden {
  display: none;
}

.wb-fields-hint {
  flex: 1 0 100%;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.wb-field-chip {
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.wb-field-chip:hover {
  background: var(--surface-tint);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.wb-fields-empty {
  color: var(--muted);
  font-size: 0.8rem;
}

.column-picker {
  position: relative;
}

.column-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  display: grid;
  width: 300px;
  max-height: 420px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.column-category {
  padding: 2px 0;
}

.column-category summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  padding: 4px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
}

.column-category summary span {
  color: #a1a1a6;
  font-size: 11px;
}

.column-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.column-option:hover {
  background: #f5f5f7;
}

.column-option input {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
}

.column-menu-actions {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.column-menu-actions button {
  width: 100%;
  height: 32px;
  font-size: 12px;
}

.excel-workboard {
  display: grid;
  gap: 12px;
}

.workspace-grid {
  position: relative;
}

.detail-panel {
  display: none;
  overflow: auto;
  height: auto;
  max-height: none;
  min-height: 0;
  border: 1px solid rgba(17, 24, 21, 0.13);
  border-radius: var(--radius);
  background: #ffffff;
}

.detail-panel.is-open {
  display: block;
}

.detail-drawer-body {
  min-height: 100%;
  overflow: visible;
  border-radius: inherit;
  background: #ffffff;
}

.detail-collapse-tab {
  display: none;
}

.detail-panel-toggle {
  min-width: 58px;
}

.detail-panel.is-collapsed {
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.detail-panel.is-collapsed .detail-drawer-body {
  display: none;
}

.detail-panel.is-collapsed .detail-collapse-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  width: 56px;
  min-width: 56px;
  min-height: 138px;
  padding: 10px 6px;
  border: 1px solid rgba(13, 148, 136, 0.28);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--accent);
  box-shadow: var(--shadow-soft);
}

.detail-panel.is-collapsed .detail-collapse-tab:hover {
  border-color: var(--accent);
  background: #f2fbf8;
  color: var(--accent-dark);
}

.detail-collapse-label,
.detail-collapse-load {
  display: block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 0;
  white-space: nowrap;
}

.detail-collapse-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 760;
}

.detail-collapse-load {
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
}

.detail-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf5;
}

.detail-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.detail-header-actions .small-button,
.detail-header-actions select {
  max-width: 100%;
}

.status-move-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-move-select {
  width: 142px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
}

.detail-tabs {
  position: sticky;
  top: 61px;
  z-index: 2;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #eceae1;
}

.detail-tab {
  min-width: auto;
  height: 32px;
  padding: 0 10px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  box-shadow: none;
  white-space: nowrap;
}

.detail-tab:hover {
  background: #ffffff;
  border-color: var(--line);
  color: var(--text);
}

.detail-tab.active {
  border-color: var(--line);
  background: #ffffff;
  color: var(--accent);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.form-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-grid input,
.form-grid select {
  width: 100%;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.detail-lines-section {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.detail-lines-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.detail-lines-section h2 {
  margin: 0;
  font-size: 15px;
}

.detail-line-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.detail-line-field-picker {
  position: relative;
  flex: 0 0 auto;
}

.detail-line-field-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 8;
  width: min(280px, calc(100vw - 40px));
  max-height: 340px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.detail-line-field-menu.hidden {
  display: none;
}

.detail-line-field-category {
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}

.detail-line-field-category:last-of-type {
  border-bottom: 0;
}

.detail-line-field-category summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-line-field-category summary span {
  float: right;
  color: var(--muted);
  font-weight: 500;
}

.detail-line-field-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 2px;
  color: var(--text);
  font-size: 12px;
}

.detail-line-field-option input {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
}

.detail-line-field-actions {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.detail-line-field-actions button {
  width: 100%;
  height: 32px;
  font-size: 12px;
}

.document-list {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.document-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 180px auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfbfd;
}

.document-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-row .download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  text-decoration: none;
}

.detail-tab-panel {
  display: none;
}

.detail-tab-panel.active {
  display: block;
}

.autosave-status {
  min-width: 58px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.autosave-status.saving {
  color: #8a5a00;
}

.autosave-status.saved {
  color: var(--success);
}

.autosave-status.error {
  color: var(--danger);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 6px;
  background: #f0f1f4;
  color: #4b515a;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.status-at_source {
  background: #eaeef5;
  color: #3f5169;
}

.status-in_transit {
  background: #e6f0fb;
  color: #1d5aa8;
}

.status-arriving {
  background: #d9f0e8;
  color: #0f766e;
}

.status-received {
  background: #eef0f3;
  color: #6b7280;
}

.selected-row td {
  background: #e8f2ff !important;
}

/* Per-user LOAD colour marks (private to-do reminders) */
.load-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
}

.load-cell-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.load-mark-dot {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  min-width: 0;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid #c8ccd4;
  background: #ffffff;
  box-shadow: none;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}

.load-mark-dot:hover {
  border-color: var(--muted);
  transform: scale(1.12);
}

.load-mark-dot.is-set {
  border-color: transparent;
}

.mark-picker {
  position: absolute;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.mark-pick {
  width: 20px;
  height: 20px;
  min-width: 0;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(20, 22, 26, 0.1);
  box-shadow: none;
  cursor: pointer;
  transition: transform 120ms ease;
}

.mark-pick:hover {
  transform: scale(1.15);
}

.mark-pick.is-current {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}

.mark-pick-clear {
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mark-pick-clear:hover {
  background: var(--surface-soft);
}

.small-button {
  min-width: auto;
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.pack-size-dialog {
  width: min(640px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.pack-size-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.pack-editor-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(130px, 1fr); gap: 16px; }
.pack-editor-fields label { display: grid; gap: 6px; }
.pack-editor-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 16px; }
.pack-edit-button { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pack-bulk-calculated { display: block; margin-top: 4px; color: var(--muted); }

.step-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.step-toggle {
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
}

.grid-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 26px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
}

button.grid-step {
  cursor: pointer;
}

.grid-step.is-done {
  border-color: rgba(22, 138, 100, 0.34);
  background: #e8f8ef;
  color: var(--success);
}

.grid-step.is-no {
  border-color: rgba(180, 35, 24, 0.28);
  background: #fff1f0;
  color: var(--danger);
}

.grid-step.is-na {
  border-color: var(--line-strong);
  background: #f0f1f4;
  color: #6b7280;
}

.step-toggle.is-done {
  border-color: rgba(22, 138, 100, 0.34);
  background: #e8f8ef;
  color: var(--success);
}

.step-toggle.is-no {
  border-color: rgba(180, 35, 24, 0.28);
  background: #fff1f0;
  color: var(--danger);
}

.step-toggle.is-na {
  border-color: var(--line-strong);
  background: #f0f1f4;
  color: #6b7280;
}

.step-select-wrap {
  display: grid;
  grid-template-columns: auto minmax(64px, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.step-select-wrap span {
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
}

.step-select {
  min-width: 46px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
}

.step-select.is-done {
  border-color: rgba(22, 138, 100, 0.34);
  background: #e8f8ef;
  color: var(--success);
}

.step-select.is-no {
  border-color: rgba(180, 35, 24, 0.28);
  background: #fff1f0;
  color: var(--danger);
}

.step-select.is-na {
  border-color: var(--line-strong);
  background: #f0f1f4;
  color: #6b7280;
}

.detail-step-select {
  width: 100%;
}

.detail-form,
.line-form,
.stack-form {
  display: grid;
  gap: 10px;
}

.detail-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-form label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.detail-form span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-form textarea {
  min-height: 76px;
  resize: vertical;
}

.detail-form button,
.line-form button {
  justify-self: start;
}

.detail-section {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-section h2 {
  margin-bottom: 10px;
  font-size: 15px;
}

.detail-lines {
  max-height: 150px;
  margin-bottom: 0;
}

.detail-lines.is-expanded {
  max-height: 360px;
}

.mini-table {
  max-height: 260px;
  margin-bottom: 10px;
}

.line-delete-cell {
  width: 92px;
  min-width: 92px;
  text-align: right;
  white-space: nowrap;
}

.line-delete-cell .small-button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 11px;
}

.line-form {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
}

.doc-list,
.audit-list {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
  padding-left: 18px;
}

.doc-item {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfbfd;
}

.doc-main,
.doc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.doc-list span,
.audit-list span {
  color: var(--muted);
  font-size: 12px;
}

.document-extraction {
  display: grid;
  gap: 4px;
  margin-top: 6px;
  font-size: 12px;
}

.document-extraction strong {
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.doc-actions {
  margin-top: 8px;
}

.warning-text {
  color: var(--danger) !important;
}

.applied-note {
  color: var(--success) !important;
  font-weight: 700;
}

.document-form {
  grid-template-columns: minmax(150px, 220px) minmax(260px, 1fr) auto;
}

.document-form .feedback-status {
  grid-column: 1 / -1;
}

#tab-import {
  min-height: 0;
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

.import-grid > .import-area {
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: 24px;
  gap: 12px;
  align-content: start;
}

.import-grid > .import-area:nth-child(even) {
  border-left: 1px solid var(--line);
}

.import-grid > .import-area:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}

.import-grid .daily-import-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.import-grid input[type="file"] {
  min-width: 0;
  width: 100%;
}

.import-grid .danger-check {
  grid-template-columns: 18px minmax(0, 1fr);
}

.import-grid .compact-log {
  min-height: 0;
  margin: 4px 0 0;
  padding: 12px;
  background: var(--surface-soft);
  color: var(--text);
}

.import-grid .compact-log:empty {
  display: none;
}

.compact-log {
  min-height: 160px;
  max-height: 320px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.inline-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
}

.warning {
  color: var(--warn);
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 24px 20px;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .login-popover {
    position: fixed;
    top: 88px;
    right: 16px;
    left: 16px;
    width: auto;
  }

  main {
    padding: 14px 12px 28px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel {
    padding: 16px;
  }

  .panel-header{
    flex-direction: column;
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .section-heading {
    flex-direction: column;
  }

  .import-grid {
    grid-template-columns: 1fr;
  }

  .import-grid > .import-area {
    padding: 24px 0;
  }

  .import-grid > .import-area:nth-child(even) {
    border-left: 0;
  }

  .import-grid > .import-area:first-child {
    padding-top: 8px;
  }

  .import-grid > .import-area + .import-area {
    border-top: 1px solid var(--line);
  }

  .import-grid .daily-import-form {
    grid-template-columns: 1fr;
  }

  .daily-import-form {
    grid-template-columns: 1fr;
  }

  .detail-form,
  .line-form {
    grid-template-columns: 1fr;
  }

  .step-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  input[type="search"]{
    min-width: 100%;
  }
}

@media (min-width: 1024px) {
  .detail-panel.is-open {
    position: fixed;
    top: var(--detail-drawer-top, 128px);
    right: clamp(40px, 2.5vw, 72px);
    bottom: 24px;
    left: auto;
    z-index: 30;
    width: min(520px, calc(100vw - 112px));
    box-shadow: 0 24px 70px rgba(28, 32, 42, 0.2);
  }

  .detail-panel.is-open.is-collapsed {
    bottom: auto;
    width: 56px;
    box-shadow: none;
  }
}

@media (max-width: 1023px) {
  .detail-panel.is-collapsed {
    width: 100%;
  }

  .detail-panel.is-collapsed .detail-collapse-tab {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
  }

  .detail-collapse-label,
  .detail-collapse-load {
    writing-mode: horizontal-tb;
    transform: none;
  }
}

@media (min-width: 1800px) {
  .workboard-table {
    min-width: 1540px;
  }

  .workboard-footer {
    min-width: 1540px;
  }

  .workboard-table .col-description {
    width: 340px;
  }
}

@media (max-width: 560px) {
  .stats {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .toolbar form {
    align-items: stretch;
    flex-direction: column;
  }

  button,
  input,
  select {
    width: 100%;
  }
}

/* PO PDF preview-and-confirm modal */
.po-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: stretch;
  justify-content: center;
}
.po-modal.is-open {
  display: flex;
}
.po-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 20, 0.62);
}
.po-modal-dialog {
  position: relative;
  margin: 1.5vh auto;
  width: min(1720px, 98vw);
  height: 97vh;
  display: flex;
  flex-direction: column;
  background: var(--surface, #fff);
  color: inherit;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.po-modal-header,
.po-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(120, 130, 150, 0.25);
}
.po-modal-footer {
  border-bottom: none;
  border-top: 1px solid rgba(120, 130, 150, 0.25);
}
.po-modal-actions {
  display: flex;
  gap: 8px;
}
.po-modal-body {
  display: flex;
  flex: 1;
  min-height: 0;
}
.po-pdf-pane {
  flex: 1 1 62%;
  min-width: 0;
  border-right: 1px solid rgba(120, 130, 150, 0.25);
  background: #525659;
}
.po-pdf-pane embed,
.po-pdf-pane iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.po-fields-pane {
  flex: 1 1 38%;
  min-width: 360px;
  overflow-y: auto;
  padding: 14px 16px;
}
.po-card {
  border: 1px solid rgba(120, 130, 150, 0.3);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}
.po-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}
.po-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
.po-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.po-field.po-field--wide {
  grid-column: 1 / -1;
}
.po-field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
}
.po-field input {
  padding: 5px 7px;
}
.po-line {
  border-top: 1px dashed rgba(120, 130, 150, 0.35);
  margin-top: 10px;
  padding-top: 10px;
}
.po-warning {
  margin: 8px 0 0;
  padding: 6px 9px;
  border-radius: 6px;
  background: rgba(214, 158, 30, 0.16);
  border: 1px solid rgba(214, 158, 30, 0.45);
  font-size: 12px;
}
.po-recon {
  margin: 8px 0 0;
  padding: 6px 9px;
  border-radius: 6px;
  background: rgba(56, 132, 222, 0.14);
  border: 1px solid rgba(56, 132, 222, 0.4);
  font-size: 12px;
}
.po-recon--blocked {
  background: rgba(214, 69, 65, 0.14);
  border-color: rgba(214, 69, 65, 0.45);
}
.po-delete-warning {
  margin: 8px 0 0;
  padding: 6px 9px;
  border-radius: 6px;
  background: rgba(214, 69, 65, 0.14);
  border: 1px solid rgba(214, 69, 65, 0.45);
  font-size: 12px;
}
.po-delete-warning ul {
  margin: 6px 0 0;
  padding-left: 18px;
}
.po-delete-warning .po-delete-load {
  opacity: 0.7;
}

/* 拼柜 / combine-shipment modal */
.po-modal-body--column {
  flex-direction: column;
}
.ship-hint {
  padding: 10px 16px 0;
}
.ship-fields {
  flex: 1;
}
.ship-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px dashed rgba(120, 130, 150, 0.25);
}
.ship-line input {
  width: 120px;
  flex: 0 0 auto;
}
.ship-add {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: 8px;
  padding: 0 0 10px;
  background: var(--surface, #fff);
}
.ship-add input {
  flex: 1;
}
.ship-po-search {
  position: relative;
  flex: 1;
  min-width: 0;
}
.ship-po-search input {
  width: 100%;
}
.ship-add button {
  flex: 0 0 auto;
}
.ship-empty {
  padding: 10px 2px;
}
.link-button {
  min-width: 0;
  height: auto;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.link-button:hover {
  background: none;
  text-decoration: underline;
}

/* Inline-editable PO/SKU line cells in the detail panel */
.mini-table input.line-input {
  width: 100%;
  min-width: 70px;
  height: 28px;
  padding: 2px 6px;
  font: inherit;
}

/* ---- Preset Reports (Preset Reports tab) ---- */
/* 输入框 + 联想下拉的定位容器（下拉复用 Workboard 的 .wb-suggest 样式） */
.preset-search {
  position: relative;
  flex: 0 1 320px;
  min-width: 0;
  max-width: 320px;
  display: flex;
}
.preset-search > input {
  width: 100%;
  min-width: 0;
}
/* Run report 按钮永远排在输入框之后、并画在其上层，绝不被输入框盖住 */
#runPreset {
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
  white-space: nowrap;
}
.preset-report {
  margin-top: 12px;
}
.preset-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
}
.preset-title {
  font-size: 18px;
  font-weight: 600;
}
.preset-sub {
  font-size: 13px;
  color: var(--muted);
}
.preset-hint {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted);
}
.preset-section-title {
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 600;
}
.preset-section-title .muted {
  font-weight: 400;
  color: var(--muted);
}
.preset-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.preset-kpi {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  height: auto;
  padding: 12px 14px;
  text-align: left;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.preset-kpi--plain {
  cursor: default;
}
.preset-kpi-label {
  font-size: 12px;
  color: var(--muted);
}
.preset-kpi-num {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}
.preset-kpi-sub {
  font-size: 12px;
  color: var(--muted);
}
.preset-bars {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.preset-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: auto;
  padding: 5px 8px;
  color: var(--text);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}
.preset-bar:hover {
  background: var(--surface-soft);
}
.preset-bar-label {
  flex: 0 0 160px;
  width: 160px;
  font-size: 13px;
  text-align: left;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preset-bar-track {
  flex: 1;
  height: 16px;
  background: var(--surface-tint);
  border-radius: 4px;
  overflow: hidden;
}
.preset-bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
}
.preset-bar-value {
  flex: 0 0 150px;
  width: 150px;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
.preset-drill.is-active {
  border-color: var(--accent);
  background: var(--surface-tint);
  outline: 2px solid var(--accent);
  outline-offset: 0;
}
tr.preset-drill {
  cursor: pointer;
}
tr.preset-drill:hover {
  background: var(--surface-soft);
}
tr.preset-drill.is-active {
  outline: none;
  background: var(--surface-tint);
  box-shadow: inset 3px 0 0 var(--accent);
}
/* 到港周竖向柱状图 + No ETA 单独卡片 */
.preset-noeta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: auto;
  padding: 8px 12px;
  margin-bottom: 12px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.preset-noeta-label {
  font-weight: 600;
}
.preset-noeta-val {
  font-size: 13px;
  color: var(--muted);
}
.preset-colchart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 200px;
  max-width: 840px;
  padding-top: 6px;
}
.preset-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 4px 2px;
  color: var(--text);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}
.preset-col:hover {
  background: var(--surface-soft);
}
.preset-col-val {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
.preset-col-val-sub {
  font-size: 10px;
}
.preset-col-bar-wrap {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.preset-col-bar {
  width: 60%;
  min-height: 2px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
}
.preset-col-label {
  font-size: 11px;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
}
.preset-col.is-active .preset-col-bar {
  background: var(--accent-dark);
}

.preset-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 6px;
}

.preset-chart-toolbar--arrival {
  align-items: flex-start;
}

.preset-chart-controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-width: 0;
}

.preset-control-group {
  display: grid;
  gap: 3px;
}

.preset-control-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.preset-metric-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preset-metric-btn,
.preset-view-btn {
  height: 26px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.preset-metric-btn:hover,
.preset-view-btn:hover {
  color: var(--text);
}

.preset-metric-btn.is-active,
.preset-view-btn.is-active {
  color: var(--accent-dark);
  background: #ffffff;
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.preset-range-controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-date-field,
.preset-target-field {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.preset-date-input,
.preset-target-input {
  width: 128px;
  height: 32px;
  padding: 0 8px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
}

.preset-target-input {
  width: 112px;
}

.preset-chart-chips {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.preset-chip {
  display: inline-block;
  width: 14px;
  height: 8px;
  margin-right: 5px;
  border-radius: 999px;
}

.preset-chip--cases {
  background: var(--accent);
}

.preset-chip--pos {
  background: #2563eb;
}

.preset-echart {
  width: 100%;
  min-height: 220px;
}

.preset-echart--week {
  height: 228px;
}

.preset-chart-combo {
  min-height: 190px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.preset-echart--donut {
  flex: 0 0 220px;
  width: 220px;
  height: 190px;
  min-height: 190px;
}

/* Two-column block: pie (by warehouse) beside the week chart, to save space */
.preset-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 4px;
}

.preset-col-block {
  min-width: 0;
}

@media (max-width: 900px) {
  .preset-two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .preset-chart-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .preset-chart-controls,
  .preset-range-controls {
    width: 100%;
  }
  .preset-date-field,
  .preset-target-field {
    flex: 1 1 112px;
  }
  .preset-date-input,
  .preset-target-input {
    width: 100%;
  }
  .preset-chart-combo {
    align-items: stretch;
    flex-direction: column;
  }
  .preset-echart--donut {
    width: 100%;
    flex-basis: 190px;
  }
}

.preset-pie {
  display: flex;
  align-items: center;
  gap: 16px;
}

.preset-pie-svg {
  flex: 0 0 auto;
  width: 150px;
  height: 150px;
}

.preset-pie-slice {
  cursor: pointer;
  transition: stroke-width 120ms ease, opacity 120ms ease;
}

.preset-pie-slice:hover {
  opacity: 0.82;
}

.preset-pie-slice.is-active {
  stroke-width: 22;
}

.preset-pie-center-num {
  fill: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
}

.preset-pie-center-lbl {
  fill: var(--muted);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preset-legend {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
}

.preset-legend-item {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: auto;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.preset-legend-item:hover {
  background: var(--surface-soft);
  border-color: transparent;
}

.preset-legend-item.is-active {
  border-color: var(--accent);
  background: var(--accent-weak);
}

.preset-legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

.preset-legend-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.preset-legend-val {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.preset-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.preset-arrival-insight {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 16px 18px 14px;
  margin-top: 18px;
}
.preset-chart-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  margin: -2px 0 8px;
}
.preset-arrival-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 8px 0 10px;
}
.preset-schedule-mode,
.preset-schedule-reset {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.preset-schedule-mode.is-active {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}
.preset-schedule-mode:focus-visible,
.preset-schedule-reset:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.preset-arrival-matrix {
  min-width: 0;
}
.preset-arrival-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 12px;
}
.preset-arrival-table th,
.preset-arrival-table td {
  padding: 5px 6px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.preset-arrival-table thead th {
  color: var(--muted);
  font-weight: 600;
  background: var(--surface-soft);
}
.preset-arrival-table tfoot th,
.preset-arrival-table tfoot td {
  font-weight: 600;
  background: var(--surface-soft);
}
.preset-arrival-table .num {
  text-align: right;
}
.preset-arrival-sku,
.preset-arrival-total,
.preset-arrival-cell {
  width: 100%;
  height: auto;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.preset-arrival-sku {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px;
  text-align: left;
}
.preset-arrival-sku span {
  max-width: 210px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preset-arrival-total {
  padding: 6px;
  font-weight: 600;
  text-align: right;
}
.preset-arrival-cell {
  min-height: 34px;
  padding: 5px 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  background: rgba(13, 148, 136, var(--heat, 0));
}
.preset-arrival-cell span {
  display: block;
  margin-top: 1px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
}
.preset-arrival-cell.is-strong {
  color: #ffffff;
}
.preset-arrival-cell.is-strong span {
  color: rgba(255, 255, 255, 0.84);
}
.preset-arrival-cell.is-empty {
  color: var(--muted);
  background: var(--surface-soft);
}
.preset-arrival-sku:hover,
.preset-arrival-total:hover,
.preset-arrival-cell:hover {
  border-color: var(--accent);
}
.preset-sku-leader {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.preset-sku-row {
  display: grid;
  grid-template-columns: 22px minmax(130px, 1fr) minmax(80px, 0.7fr) 112px;
  align-items: center;
  gap: 10px;
  height: auto;
  padding: 7px 8px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}
.preset-sku-row:hover {
  background: var(--surface-soft);
}
.preset-sku-rank {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}
.preset-sku-name {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
}
.preset-sku-name strong,
.preset-sku-name span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.preset-sku-name span {
  color: var(--muted);
  font-size: 11px;
}
.preset-sku-track {
  position: relative;
  height: 16px;
  background: var(--surface-tint);
  border-radius: 999px;
}
.preset-sku-line {
  position: absolute;
  left: 0;
  top: 7px;
  height: 2px;
  background: var(--accent);
  border-radius: 999px;
}
.preset-sku-dot {
  position: absolute;
  top: 4px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: var(--accent);
  border-radius: 999px;
}
.preset-sku-value {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}
/* Numeric vendor schedule: fixed product names and totals, scrollable dates. */
.arrival-table-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.arrival-table-heading .preset-section-title { margin-top: 0; margin-bottom: 8px; }
.arrival-table-ranking { position: relative; flex-shrink: 0; }
.arrival-table-ranking summary { color: var(--accent); cursor: pointer; padding: 4px 6px; font-size: 13px; }
.arrival-table-ranking .preset-sku-leader { position: absolute; z-index: 8; right: 0; top: 32px; width: min(620px, 80vw); max-height: 380px; overflow: auto; background: white; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(17, 24, 39, .12); }
.arrival-table-navigation { display: flex; align-items: center; gap: 8px; }
.arrival-table-navigation button { font-size: 12px; padding: 6px 10px; color: var(--text); background: #fff; border: 1px solid var(--line); }
.arrival-table-range { min-width: 215px; text-align: center; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.arrival-table-span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.arrival-table-span select { width: auto; min-width: 100px; font-size: 12px; padding: 6px 26px 6px 10px; }
.preset-arrival-toolbar .preset-noeta { margin-left: auto; font-size: 12px; }
.arrival-table-notices { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--muted); margin: 0 0 10px; }
.arrival-table-notices:empty { display: none; }
.arrival-table-selection-note { color: var(--text); }
.arrival-table-scroll { max-height: 565px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); isolation: isolate; }
.preset-arrival-matrix--numeric .preset-arrival-table { min-width: 1030px; border-collapse: separate; border-spacing: 0; font-family: var(--font-ui); }
.preset-arrival-matrix--numeric th, .preset-arrival-matrix--numeric td { padding: 0; border-top: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: #fff; }
.preset-arrival-matrix--numeric thead th { position: sticky; top: 0; z-index: 3; min-width: 86px; height: 64px; text-align: center; padding: 4px 8px; color: var(--text); background: var(--surface-soft); }
.preset-arrival-matrix--numeric th small { display: block; font-size: 11px; font-weight: 400; }
.preset-arrival-matrix--numeric .arrival-table-sku { position: sticky; left: 0; z-index: 2; width: 225px; min-width: 225px; max-width: 225px; background: #fff; text-align: left; }
.preset-arrival-matrix--numeric thead .arrival-table-sku { z-index: 5; padding: 12px; background: var(--surface-soft); }
.preset-arrival-matrix--numeric tbody tr:nth-child(even) td, .preset-arrival-matrix--numeric tbody tr:nth-child(even) th { background: #fafbfc; }
.preset-arrival-matrix--numeric .arrival-table-total { position: sticky; right: 0; z-index: 2; min-width: 90px; padding: 10px; font-weight: 600; background: #f7f9fb; box-shadow: -1px 0 var(--line); }
.preset-arrival-matrix--numeric thead .arrival-table-total { z-index: 5; }
.preset-arrival-matrix--numeric .preset-arrival-sku { padding: 9px 12px; min-height: 51px; border-radius: 0; font-size: 13px; align-items: flex-start; }
.preset-arrival-matrix--numeric .preset-arrival-sku span { max-width: 200px; font-weight: 400; font-size: 11px; }
.preset-arrival-matrix--numeric .preset-arrival-cell { display: block; height: 51px; min-width: 86px; border-radius: 0; border: 2px solid transparent; padding: 8px 12px; font: inherit; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text); background: rgba(13, 148, 136, var(--heat, 0)); }
.preset-arrival-matrix--numeric .preset-arrival-cell:hover { border-color: var(--accent); }
.preset-arrival-matrix--numeric .preset-arrival-cell.is-selected { border-color: var(--accent); background: rgba(13, 148, 136, .27); font-weight: 700; }
.arrival-table-empty { display: block; height: 51px; padding: 15px 12px; color: var(--muted); text-align: right; }
.preset-arrival-matrix--numeric .arrival-table-selected-row .arrival-table-sku { box-shadow: inset 3px 0 var(--accent); }
.arrival-table-period { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 0; background: transparent; color: inherit; width: 100%; height: 100%; padding: 2px 0; cursor: pointer; font: inherit; font-size: 12px; }
.arrival-table-period:hover { color: var(--accent); }
.arrival-table-current-label { color: #006c63; font-weight: 600 !important; margin-top: 3px; }
.preset-arrival-matrix--numeric thead th.is-current { background: #dff3ef; }
.preset-arrival-matrix--numeric tfoot th, .preset-arrival-matrix--numeric tfoot td { position: sticky; bottom: 0; z-index: 3; padding: 12px; background: #f0f5f9; font-weight: 700; }
.preset-arrival-matrix--numeric tfoot .arrival-table-sku, .preset-arrival-matrix--numeric tfoot .arrival-table-total { z-index: 5; }
.arrival-table-footnote { margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.arrival-table-no-orders { padding: 20px !important; text-align: center !important; color: var(--muted); }
.preset-arrival-table .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.arrival-table-scroll:focus-visible, .preset-arrival-insight button:focus-visible, .preset-arrival-insight summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
@media (max-width: 760px) {
  .preset-arrival-insight { padding: 12px; }
  .arrival-table-navigation { flex-wrap: wrap; }
  .arrival-table-range { min-width: 185px; }
  .preset-arrival-toolbar .preset-noeta { margin-left: 0; }
  .preset-arrival-matrix--numeric .arrival-table-sku { min-width: 180px; max-width: 180px; width: 180px; }
  .preset-arrival-matrix--numeric .preset-arrival-sku span { max-width: 155px; }
}
.preset-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.preset-table th,
.preset-table td {
  padding: 7px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
}
.preset-table thead th {
  border-top: 0;
  color: var(--muted);
  font-weight: 500;
}
.preset-table .num {
  text-align: right;
}
.preset-detail {
  margin-top: 18px;
  padding-top: 4px;
  border-top: 1px solid var(--line-strong);
}
.preset-detail-head {
  margin: 12px 0 6px;
  font-size: 13px;
  color: var(--muted);
}
.preset-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 4px 2px;
}

/* ---- Archive Reports (redesigned 2026-06-10) ---- */
.report-filter {
  flex: 0 1 320px;
  max-width: 320px;
  min-width: 0;
}
.rep-row {
  cursor: pointer;
}
.rep-row:hover td {
  background: var(--surface-soft);
}
.rep-row.is-selected td {
  background: var(--surface-soft);
  font-weight: 600;
}
.rep-up {
  color: var(--danger); /* price / cost going up is bad */
  font-weight: 600;
}
.rep-down {
  color: var(--success);
  font-weight: 600;
}
.rep-flat {
  color: var(--muted);
}
.price-trend {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 3px 7px;
  min-width: 132px;
  max-width: 220px;
  line-height: 1.25;
}
.price-trend small {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-align: right;
  white-space: normal;
}
.price-trend-values {
  white-space: nowrap;
}
.rep-history > td {
  background: var(--surface-soft);
  padding: 6px 10px 12px;
}
.rep-history-table {
  font-size: 12.5px;
}
.rep-history-table thead th {
  font-size: 11.5px;
}
.rep-chip,
.rep-month-chip {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 2px 2px 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  background: var(--surface-soft);
  color: var(--text);
}
.rep-month-chips {
  margin: 4px 0 10px;
}

/* ---- Audit Log (admin-only page) ---- */
.audit-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.audit-filters label {
  font-size: 12px;
  color: var(--muted);
}
.audit-filters select,
.audit-filters input[type="search"] {
  height: 34px;
}
.audit-log-wrap {
  max-height: calc(100vh - 320px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.audit-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.audit-log-table th,
.audit-log-table td {
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.audit-log-table thead th {
  position: sticky;
  top: 0;
  border-top: 0;
  background: var(--surface);
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.audit-log-table tbody tr:hover td {
  background: var(--surface-soft);
}
.audit-log-table td:nth-child(1),
.audit-log-table td:nth-child(2),
.audit-log-table td:nth-child(3),
.audit-log-table td:nth-child(4) {
  white-space: nowrap;
}
.audit-log-table td:last-child {
  min-width: 320px;
  max-width: 680px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.audit-detail-summary {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.audit-recorded-data {
  margin-top: 5px;
}
.audit-recorded-data summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}
.audit-recorded-data pre {
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
}

/* ---- Supplier Shipping Plan import (preview + delay/early highlight) ---- */
.supplier-plan-preview {
  margin-top: 12px;
}
.supplier-plan-summary {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
}
.supplier-plan-table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.supplier-plan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.supplier-plan-table th,
.supplier-plan-table td {
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.supplier-plan-table thead th {
  position: sticky;
  top: 0;
  border-top: 0;
  background: var(--surface);
  color: var(--muted);
  font-weight: 500;
}
.supplier-plan-table tbody tr:hover td {
  background: var(--surface-soft);
}
.plan-cell-delay {
  background: var(--danger-weak, rgba(220, 38, 38, 0.12));
  color: var(--danger);
  font-weight: 600;
}
.plan-cell-early {
  background: var(--success-weak, rgba(22, 163, 74, 0.12));
  color: var(--success);
  font-weight: 600;
}
.plan-row-flag td {
  background: var(--surface-soft);
  color: var(--muted);
}
.plan-chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
}
.plan-delay {
  background: var(--danger-weak, rgba(220, 38, 38, 0.12));
  color: var(--danger);
}
.plan-early {
  background: var(--success-weak, rgba(22, 163, 74, 0.12));
  color: var(--success);
}
.plan-same,
.plan-new {
  background: var(--surface-soft);
  color: var(--muted);
}
.plan-cell-dest-changed {
  background: var(--warning-weak, rgba(217, 119, 6, 0.14));
  color: var(--warning, #b45309);
  font-weight: 600;
}
.plan-dest {
  background: var(--warning-weak, rgba(217, 119, 6, 0.14));
  color: var(--warning, #b45309);
}
.plan-unmatched,
.plan-ambiguous {
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--line);
}
.supplier-plan-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.plan-load-pick {
  height: 26px;
  font-size: 11px;
  margin-left: 4px;
  max-width: 220px;
  vertical-align: middle;
}

/* ---- Plan History (Phase 3, read-only deviation analysis) ---- */
.plan-history-wrap {
  max-height: calc(100vh - 320px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.plan-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.plan-history-table th,
.plan-history-table td {
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.plan-history-table thead th {
  position: sticky;
  top: 0;
  border-top: 0;
  background: var(--surface);
  color: var(--muted);
  font-weight: 500;
}
.plan-history-row {
  cursor: pointer;
}
.plan-history-row:hover td {
  background: var(--surface-soft);
}
.plan-history-row.is-selected td {
  background: var(--accent-weak);
}
.plan-history-detail {
  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--line-strong, var(--line));
}

/* Demand coverage report (Phase 1) */
#tab-coverage { min-height: 0; }
.cov-header { align-items: center; flex-wrap: wrap; gap: 12px; }
.cov-updated { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.cov-header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.cov-disclosure { position: relative; }
.cov-disclosure summary { cursor: pointer; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 12px; color: var(--muted); }
.cov-disclosure summary strong { color: var(--text); font-weight: 600; margin-left: 4px; }
.cov-disclosure summary:hover, .cov-disclosure[open] summary { border-color: var(--accent); color: var(--accent-dark); }
.cov-disclosure summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.cov-disclosure-body { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; width: 390px; max-width: calc(100vw - 64px); padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 28px #182b4026; font-size: 13px; line-height: 1.5; }
.cov-disclosure-body p { margin: 0 0 12px; }
.cov-disclosure-body p:last-child { margin-bottom: 0; }
.cov-disclosure-title { font-weight: 600; }
.cov-disclosure .cov-safety-editor label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.cov-disclosure .cov-safety-editor { align-items: end; }
#coverageSafetyStatus { display: block; margin-top: 8px; color: var(--muted); }
#coverageSafetyStatus:empty { display: none; }
.cov-upload { margin-bottom: 16px; }
.cov-upload-summary { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; }
.cov-upload-summary strong { font-weight: 600; }
.cov-upload-mismatch { margin-top: 8px; font-size: 12px; color: var(--danger); }
.cov-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 12px 0; }
.cov-kpi { background: var(--surface-soft); border-radius: var(--radius); padding: 12px 14px; }
.cov-kpi strong { display: block; font-size: 22px; font-weight: 600; }
.cov-kpi span { font-size: 12px; color: var(--muted); }
.cov-status-nav { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 14px 0 12px; }
.cov-status-card { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 44px; height: auto; min-width: 0; padding: 8px 10px; background: var(--surface-soft); color: var(--text); font-weight: 400; border-color: transparent; }
.cov-status-card strong { font-size: 16px; font-weight: 600; }
.cov-status-card span { font-size: 12px; }
.cov-status-card:hover { background: var(--accent-weak); border-color: var(--accent); }
.cov-status-card[aria-pressed="true"] { background: var(--accent-weak); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cov-status-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.cov-results-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.cov-results-meta > strong { font-size: 14px; color: var(--text); }
.cov-result-scope { margin-left: auto; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cov-num-below { color: #a32d2d; }
.cov-num-healthy { color: #0f6e56; }
.cov-num-over { color: #854f0b; }
.cov-meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.cov-table-wrap { overflow-x: auto; }
.cov-table { table-layout: fixed; width: 100%; min-width: 720px; border-collapse: collapse; font-size: 13px; }
.cov-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 4px 8px; border-bottom: 1px solid var(--line-strong, var(--line)); }
.cov-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; line-height: 1.35; }
.cov-table tbody tr:hover td { background: var(--surface-soft); }
.cov-table .cov-data-row { cursor: pointer; }
.cov-table .cov-data-row.is-selected td { background: var(--accent-weak); }
.cov-table th:nth-child(1), .cov-table td:nth-child(1) { width: 26%; }
.cov-table th:nth-child(2), .cov-table td:nth-child(2) { width: 9%; text-align: center; }
.cov-table th:nth-child(3), .cov-table td:nth-child(3) { width: 13%; }
.cov-table th:nth-child(4), .cov-table td:nth-child(4) { width: 13%; }
.cov-table th:nth-child(5), .cov-table td:nth-child(5) { width: 13%; }
.cov-table th:nth-child(6), .cov-table td:nth-child(6) { width: 11%; text-align: right; }
.cov-table th:nth-child(7), .cov-table td:nth-child(7) { width: 12%; }
.cov-sku { font-weight: 600; }
.cov-sku-link { font-weight: 600; color: var(--accent-dark); cursor: pointer; }
.cov-sku-link:hover { text-decoration: underline; }
.cov-desc { display: block; font-size: 11px; line-height: 1.35; color: var(--muted); max-width: 100%; max-height: 2.7em; overflow: hidden; white-space: normal; }
#demandResult:empty { display: none; }
.cov-pill, .cov-badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.cov-po { font-weight: 600; }
.cov-po small { display: block; font-size: 10px; color: var(--muted); font-weight: 400; }
.cov-dim { color: var(--muted); }
.cov-below { background: #fcebeb; color: #a32d2d; }
.cov-healthy { background: #e1f5ee; color: #0f6e56; }
.cov-over { background: #faeeda; color: #854f0b; }
.cov-none { background: var(--surface-soft); color: var(--muted); }
.cov-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.cov-category-filter { display: grid; gap: 4px; max-width: 100%; font-size: 12px; color: var(--muted); }
.cov-category-filter select { width: 240px; max-width: 100%; }
.cov-safety-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.cov-safety-label { color: var(--muted); }
.cov-safety-input { width: 64px; }
.cov-th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.cov-th-sort:hover, .cov-th-sort.is-active { color: var(--accent-dark); }
.cov-arrow { font-size: 10px; }
.cov-po-btn { background: none; border: none; padding: 2px 4px; margin: 0; cursor: pointer; font: inherit; color: inherit; text-align: left; border-radius: 4px; }
.cov-po-btn:hover { background: var(--surface-soft); }
.cov-po-btn.is-open { background: var(--accent-weak); }
.cov-detail-row td { background: var(--surface-soft); padding: 0; }
.cov-detail { padding: 8px 12px; }
.cov-detail-head { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.cov-detail-table { width: auto; min-width: 320px; border-collapse: collapse; font-size: 12px; }
.cov-detail-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 3px 12px 3px 0; }
.cov-detail-table td { padding: 3px 12px 3px 0; border-bottom: 1px solid var(--line); }
.cov-detail-empty { font-size: 12px; color: var(--muted); padding: 8px 12px; }
.cov-detail-panel { margin: 12px 0 16px; border: 1px solid var(--line-strong, var(--line)); border-radius: var(--radius); background: var(--surface); }
.cov-detail-panel-inner { padding: 14px 16px; }
.cov-detail-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.cov-rec-banner { display: flex; gap: 8px; padding: 10px 12px; border-radius: var(--radius); font-size: 13px; line-height: 1.5; margin: 4px 0 14px; }
.cov-rec-banner.cov-below { background: #fcebeb; color: #501313; }
.cov-rec-banner.cov-healthy { background: #e1f5ee; color: #04342c; }
.cov-rec-banner.cov-over { background: #faeeda; color: #412402; }
.cov-rec-banner.cov-none { background: var(--surface-soft); color: var(--muted); }
.cov-chart { position: relative; max-width: 780px; margin: 4px 0 0; }
.cov-echart { width: 100%; height: 250px; min-height: 220px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.cov-echart--projection { height: 290px; }
.cov-echart--history { height: 190px; min-height: 170px; }
.cov-tip { position: absolute; transform: translate(-50%, -115%); background: #14161a; color: #fff; font-size: 11px; line-height: 1.35; padding: 4px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; z-index: 5; }
.cov-explain { font-size: 12px; color: var(--muted); line-height: 1.55; margin: 10px 0 4px; max-width: 760px; }
.cov-chart-title { font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.cov-chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.cov-chart-legend i { display: inline-block; width: 14px; height: 10px; vertical-align: -1px; margin-right: 4px; }
.cov-lg-line { background: #0d9488; height: 3px !important; }
.cov-lg-band { background: #e1f5ee; }
.cov-lg-dash { border-top: 1px dashed #1d9e75; height: 0 !important; }
.cov-lg-estimate { border-top: 1px dashed #b97916; height: 0 !important; }
.cov-eta-source, .cov-eta-overdue { display: block; font-size: 10px; line-height: 1.35; color: var(--muted); }
.cov-eta-source.is-estimated { color: #854f0b; }
.cov-eta-overdue { color: #a32d2d; }
.cov-arrival-note, .cov-arrival-warning { margin: 8px 0; padding: 9px 10px; font-size: 12px; line-height: 1.5; border-radius: var(--radius); }
.cov-arrival-note { background: #faeeda; color: #854f0b; }
.cov-arrival-warning { background: #fcebeb; color: #a32d2d; }
.cov-arrival-warning ul { padding-left: 18px; margin: 6px 0 0; }
.cov-lg-out { background: #dc2626; border-radius: 50%; width: 10px !important; }
.cov-act { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.cov-act-pull_in { background: #fcebeb; color: #a32d2d; }
.cov-act-push_out { background: #faeeda; color: #854f0b; }
.cov-act-keep { background: #e1f5ee; color: #0f6e56; }
.cov-act-en_route { background: var(--surface-soft); color: var(--muted); }
/* Coverage two-column layout: table left, SKU detail in the right side panel. */
.cov-layout { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.cov-main { flex: 1 1 640px; min-width: 0; }
.cov-side { flex: 1 1 440px; max-width: 560px; margin: 0; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.cov-detail-actions { display: flex; gap: 8px; }
@media (max-width: 900px) {
  .cov-status-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .cov-header-actions { width: 100%; }
  .cov-disclosure { position: static; }
  .cov-header { position: relative; }
  .cov-disclosure-body { top: 100%; right: 0; width: 100%; max-width: 100%; }
  .cov-category-filter { flex: 1 1 180px; }
  .cov-category-filter select { width: 100%; }
  .cov-result-scope { margin-left: 0; max-width: 100%; flex-basis: 100%; }
}
@media (max-width: 440px) {
  .cov-status-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .cov-echart--projection { height: 250px; }
  .cov-echart--history { height: 170px; }
}

/* --- Workboard bulk edit: select column + bulk action bar --- */
.workboard-table .wb-select-col { width: 38px; }
/* Keep the checkbox cell from making the row taller: zero margins, fixed small
   box, middle-aligned, tight padding. Qualified selectors beat the base td/th rules. */
.workboard-table td.wb-select-cell,
.workboard-table th.wb-select-col { text-align: center; padding: 0 4px; }
.workboard-table .wb-row-check,
.workboard-table .wb-select-all { margin: 0; width: 14px; height: 14px; vertical-align: middle; cursor: pointer; }
.workboard-table td.wb-select-cell,
.workboard-table th.wb-select-col { position: sticky; left: 0; z-index: 2; background: var(--surface, #fff); }
.workboard-table th.wb-select-col { z-index: 4; }
.workboard-table tr.selected-row .wb-select-cell { background: #e8f3ff; }
.wb-row-controls { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 34px; }
.wb-row-menu-toggle { min-width: 26px; width: 26px; min-height: 26px; padding: 0; font-size: 21px; line-height: 1; color: #526477; background: transparent; border: 1px solid #d7dfe7; border-radius: 5px; }
.wb-row-menu-toggle:hover, .wb-row-menu-toggle[aria-expanded="true"] { color: #087e78; background: #e4f5f1; border-color: #5baca5; }
.wb-row-menu-toggle:focus-visible { outline: 2px solid #087e78; outline-offset: 2px; }
.wb-row-menu { position: fixed; z-index: 1200; width: min(312px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow: auto; padding: 7px; border: 1px solid #d4dde5; border-radius: 10px; background: #fff; box-shadow: 0 12px 36px #182b4030; }
.wb-row-menu-context { display: grid; gap: 4px; padding: 7px 9px 10px; border-bottom: 1px solid #e7ecf0; overflow-wrap: anywhere; }
.wb-row-menu-context strong { color: #182b40; }
.wb-row-menu-context span { font-size: 12px; }
.wb-row-menu-context small { color: #64748b; font-size: 11px; }
.wb-row-menu button { display: block; width: 100%; text-align: left; padding: 9px; margin-top: 3px; border: 0; border-radius: 5px; background: #fff; color: #182b40; font-size: 13px; }
.wb-row-menu button:hover, .wb-row-menu button:focus-visible { background: #e4f5f1; color: #087e78; outline: 2px solid #087e78; outline-offset: -2px; }
.wb-row-menu button:disabled { opacity: 0.6; cursor: not-allowed; }
.wb-row-menu-note, .wb-row-menu-message { margin: 3px 9px 7px; color: #64748b; font-size: 12px; line-height: 1.5; }
.wb-row-menu { border-radius: 4px; box-shadow: 0 5px 18px #182b4026; overflow: visible; }
.wb-menu-separator { height: 1px; margin: 5px 3px; background: #e3e8ed; }
.wb-row-menu [data-row-submenu] { display: flex; justify-content: space-between; }
.wb-row-submenu { position: fixed; z-index: 1201; width: 255px; padding: 5px; border: 1px solid #d4dde5; border-radius: 4px; background: #fff; box-shadow: 0 5px 18px #182b4026; }
.wb-row-submenu[hidden] { display: none; }
.workboard-table tr[data-line-id]:focus-visible { outline: 2px solid #087e78; outline-offset: -2px; }
.workboard-shortcut-hint { margin: 5px 0 9px; font-size: 12px; }
.line-quantities { display: block; margin-top: 5px; color: #64748b; white-space: nowrap; }
.wb-bulk-bar { margin: 0 0 8px; border: 1px solid #1d9e75; border-radius: 8px; background: #e1f5ee; }
.wb-bulk-bar.hidden { display: none; }
.wb-bulk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; }
.wb-bulk-count { font-weight: 600; color: #0f6e56; }
.wb-bulk-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.wb-bulk-value { width: 120px; }
.wb-bulk-all-matching { background: none; border: none; color: #0f6e56; text-decoration: underline; cursor: pointer; padding: 0; font: inherit; }
.wb-bulk-all-matching.hidden { display: none; }
.wb-bulk-preview-area { padding: 0 12px 10px; }
.wb-bulk-preview-area:empty { padding: 0; }
.wb-bulk-preview-card { background: #fff; border: 1px solid #1d9e75; border-radius: 8px; padding: 10px 12px; }
.wb-bulk-changes { margin: 6px 0; padding-left: 18px; }
.wb-bulk-changes li { margin: 2px 0; }
.wb-bulk-changes s { color: var(--muted); }
.wb-bulk-warn { color: #854f0b; background: #faeeda; border-radius: 6px; padding: 6px 8px; margin: 6px 0; }
.wb-bulk-actions { display: flex; gap: 8px; margin-top: 8px; }
.wb-bulk-confirm { background: #0f6e56; color: #fff; border-color: #0f6e56; }
.wb-bulk-delete-card { border-color: #c2413a; background: #fffafa; }
.wb-bulk-danger-note { color: #9f2d28; font-weight: 700; margin: 8px 0; }
.wb-bulk-delete-confirm-label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.wb-bulk-delete-confirm-label code { color: #9f2d28; font-weight: 700; }
.wb-bulk-delete-confirm-input { width: 150px; }

/* --- Excel-style inline cell editing --- */
#workboardEditToggle.active { background: #0f6e56; color: #fff; border-color: #0f6e56; }
.wb-cell-input {
  width: 100%; box-sizing: border-box; border: 1px solid transparent;
  background: transparent; font: inherit; color: inherit;
  padding: 1px 3px; border-radius: 3px; min-height: 22px;
}
.wb-cell-input:hover { border-color: #cfd4d9; }
.wb-cell-input:focus { border-color: #1d9e75; background: #fff; outline: none; }
.wb-cell-input.wb-cell-saving { opacity: 0.6; }
.wb-cell-input.wb-cell-saved { background: #e1f5ee; }
.wb-cell-input.wb-cell-error { border-color: #e24b4a; background: #fcebeb; }
.wb-edit-mode .workboard-table tbody tr { cursor: default; }

/* ---- Task board (Phase 1, 2026-07-07): kanban lanes + reminder surfaces ---- */
.task-nav-badge,
.task-bell-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.task-bell-wrap {
  position: relative;
  display: inline-flex;
}

.task-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.task-bell svg {
  width: 15px;
  height: 15px;
  display: block;
}

.task-bell-badge {
  position: absolute;
  top: -7px;
  right: -9px;
  margin-left: 0;
}

.task-bell-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(320px, calc(100vw - 32px));
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 60;
  overflow: hidden;
}

.task-bell-head {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.task-bell-empty {
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}

.task-bell-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  width: 100%;
  height: auto;
  min-height: 52px;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  line-height: 1.25;
}

.task-bell-item:hover {
  background: var(--surface-soft);
}

.task-bell-item strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-bell-item span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.25;
}

.task-bell-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.task-bell-ref {
  display: inline-flex;
  align-items: center;
  max-width: 120px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--accent-weak);
  color: var(--accent-dark);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-bell-open {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
}

.task-bell-open:hover {
  background: var(--accent-weak);
}

.task-overdue-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 12px;
  padding: 8px 14px;
  border: 1px solid #f3c1c1;
  border-radius: var(--radius);
  background: #fcebeb;
  color: #791f1f;
  font-size: 13px;
}

.task-overdue-banner .small-button {
  margin-left: auto;
}

.task-banner-dismiss {
  border: 0;
  background: transparent;
  color: #791f1f;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}

.task-toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 90;
  max-width: min(360px, calc(100vw - 32px));
}

.task-toast {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.task-toast-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.task-toast-body strong {
  font-size: 13px;
}

.task-toast-body span {
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

.task-toast-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px;
  margin-left: auto;
}

.task-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.task-lane {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 160px;
}

.task-lane.task-lane--drop {
  border-color: var(--accent);
  background: var(--accent-weak);
}

.task-lane-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.task-lane-count {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 500;
}

.task-card {
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: grab;
  box-shadow: var(--shadow-soft);
}

.task-card:hover {
  border-color: var(--accent);
}

.task-card.task-card--dragging {
  opacity: 0.5;
}

.task-card--done {
  opacity: 0.72;
}

.task-card--done .task-card-title {
  text-decoration: line-through;
}

.task-card-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 8px;
  word-break: break-word;
}

.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.task-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  background: var(--surface-soft);
  font-size: 11px;
}

button.task-chip {
  min-width: 0;
  height: auto;
  min-height: 0;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.2;
}

.task-chip.task-assignee {
  background: var(--accent-weak);
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 600;
}

.task-ref-chip {
  cursor: pointer;
  color: var(--accent-dark);
}

.task-ref-chip:hover {
  background: var(--accent-weak);
  border-color: rgba(12, 118, 109, 0.24);
}

.task-due--overdue {
  color: var(--danger);
  font-weight: 600;
}

.task-priority {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}

.task-priority::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.task-priority--high::before {
  background: var(--danger);
}

.task-priority--medium::before {
  background: var(--signal);
}

.task-priority--low::before {
  background: var(--line-strong);
}

.task-show-done {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.task-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-form label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.task-form input,
.task-form select,
.task-form textarea {
  width: 100%;
}

.task-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.task-modal-dialog {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
  height: auto;
  max-height: min(720px, calc(100vh - 32px));
  margin: auto;
}

.task-modal-dialog .po-modal-body {
  flex: 0 0 auto;
  overflow: auto;
  padding: 16px;
}

@media (max-width: 900px) {
  .task-board {
    grid-template-columns: 1fr;
  }
}
.collaboration-banner {
  position: sticky;
  top: 0;
  z-index: 45;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid #d7a52b;
  border-radius: 10px;
  background: #fff8df;
  color: #4b3908;
  box-shadow: 0 4px 14px rgba(67, 50, 5, 0.12);
}

.collaboration-banner.hidden { display: none; }
.collaboration-banner > div:first-child { display: grid; gap: 4px; }
.collaboration-banner--conflict { border-color: #cf5b52; background: #fff0ef; color: #671c17; }
.collaboration-banner--busy { border-color: #6c8db7; background: #eff6ff; color: #173c68; }
.collaboration-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.collaboration-conflict-row { display: grid; grid-template-columns: minmax(100px, 0.8fr) repeat(3, minmax(130px, 1fr)); gap: 8px; margin-top: 8px; }
.collaboration-conflict-row span { display: grid; padding: 6px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.72); overflow-wrap: anywhere; }
.collaboration-conflict-row b { font-size: 0.75rem; opacity: 0.72; }

@media (max-width: 900px) {
  .collaboration-banner { position: static; flex-direction: column; }
  .collaboration-conflict-row { grid-template-columns: 1fr; }
}

/* FDA cases keep shipment identity and business dates visible while editing. */
#fdaCounts { margin: 12px 0; color: var(--muted); font-size: 13px; }
#fdaList { overflow-x: auto; }
.fda-table { min-width: 820px; width: 100%; }
.fda-table td { vertical-align: top; white-space: normal; overflow-wrap: anywhere; max-width: 300px; }
.fda-table small { display: block; margin: 5px 0; color: var(--muted); }
.fda-case-link { background: transparent; color: var(--accent-ink); border: 0; padding: 0; text-align: left; line-height: 1.5; }
.fda-case-link:hover { background: var(--accent-weak); color: var(--accent-dark); }
.fda-overdue { background: #fff1eb; }
.fda-due { background: #fff8df; }
.fda-overdue td:first-child { border-left: 3px solid #ba5427; }
.fda-due td:first-child { border-left: 3px solid #c89318; }
#fdaHistoryDialog { width: 620px; max-width: calc(100vw - 64px); max-height: calc(100vh - 64px); box-sizing: border-box; padding: 0; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 80px #172b4d33; background: var(--surface); }
#fdaHistoryDialog[data-mode="action"] { width: 880px; }
#fdaHistoryDialog::backdrop { background: #10243c55; }
#fdaDetail { margin: 0; padding: 20px; background: var(--surface); }
#fdaDetailFeedback { padding: 0 20px 12px; margin: 0; font-size: 13px; color: var(--accent-ink); }
#fdaDetail .fda-timeline { margin: 14px 0; }
#fdaDetail .fda-timeline > li { margin: 10px 0; padding: 8px 10px; border: 0; background: var(--surface-soft); }
#fdaDetail .fda-timeline small { color: var(--muted); font-size: 11px; }
#fdaDetail .fda-timeline p { margin: 5px 0; }
.fda-history-summary { font-size: 12px; color: var(--muted); }
.fda-history-summary .fda-badge { margin-right: 8px; }
.fda-file-list { padding-left: 18px; font-size: 13px; }
.fda-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.fda-detail-head h3 { margin: 0; }
.fda-detail-head > button { width: auto; flex: none; }
.fda-badge { display: inline-block; border-radius: 20px; padding: 5px 10px; background: var(--accent-weak); color: var(--accent-ink); font-size: 12px; }
.fda-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
#fdaDetail label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; min-width: 0; }
#fdaDetail input, #fdaDetail select, #fdaDetail textarea { width: 100%; min-width: 0; box-sizing: border-box; }
#fdaDetail textarea { font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.fda-full { grid-column: 1 / -1; }
#fdaDetail .fda-checkbox { flex-direction: row; align-items: center; }
#fdaDetail .fda-checkbox input { width: auto; }
.fda-timeline { list-style: none; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.fda-timeline > li { margin: 16px 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.fda-event-heading { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fda-event-heading time { color: var(--muted); font-size: 13px; }
.fda-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
#fdaDetail details { margin: 16px 0; }
#fdaDetail summary { cursor: pointer; color: var(--accent-ink); }
#fdaDetail form[data-fda-form="attachment"], #fdaDetail form[data-fda-form="transition"] { display: grid; gap: 14px; margin-top: 16px; }
#fdaDetail form > button { justify-self: start; }
.fda-warning { padding: 12px; background: #fff6de; border-left: 3px solid #c89318; border-radius: 4px; line-height: 1.5; }
#coverageReport .fda-warning { white-space: normal; overflow-wrap: anywhere; }
.fda-load-actions { padding: 18px; margin: 20px 0; border: 1px solid var(--accent); border-radius: 8px; }
.fda-load-actions button { margin: 6px 8px 0 0; }
.fda-audit li { margin: 12px 0; font-size: 13px; overflow-wrap: anywhere; }
/* FDA groups expose LOAD context without making the whole LOAD one HOLD. */
.fda-load-group { margin: 14px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.fda-group-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 14px 16px 8px; }
.fda-group-heading > span { font-size: 13px; color: var(--muted); }
.fda-group-toggle { background: transparent; color: var(--accent-ink); border: 0; padding: 0; font-size: 16px; font-weight: 700; text-align: left; }
.fda-group-facts { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 4px 16px 12px; color: var(--muted); font-size: 13px; }
.fda-group-progress { margin: 0 16px 12px; font-size: 13px; overflow-wrap: anywhere; }
.fda-group-progress small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.fda-overdue-text { color: #a73b1d; font-weight: 600; }
.fda-group-actions, .fda-quick-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); }
.fda-group-actions > span { margin-right: 8px; color: var(--muted); font-size: 12px; }
.fda-quick-actions { padding-left: 0; margin: 16px 0; }
.fda-group-lines { overflow-x: auto; }
.fda-items-table { width: 100%; min-width: 780px; }
.fda-items-table td { vertical-align: top; white-space: normal; }
.fda-items-table small, .fda-entry-table small { display: block; color: var(--muted); margin-top: 4px; }
.fda-quantity-summary { display: flex; flex-wrap: wrap; gap: 12px 20px; margin: 12px 0; font-size: 13px; }
.fda-quantity-summary div { min-width: 72px; }
.fda-quantity-summary dt { color: var(--muted); font-size: 11px; }
.fda-quantity-summary dd { margin: 4px 0 0; font-weight: 700; }
.fda-items-table .fda-quantity-summary { gap: 8px 12px; margin: 0; }
.fda-entry-table { width: 100%; min-width: 650px; }
.fda-entry-table td { vertical-align: top; white-space: normal; }
#fdaDetail .fda-entry-table input[type="checkbox"] { width: auto; }
#fdaDetail .fda-entry-table input[type="number"] { min-width: 95px; }
#fdaDetail .fda-entry-table input[type="date"] { min-width: 135px; }
.fda-registration-actions { margin: 16px 0; }
/* Compact desktop cells keep the four daily milestones on the goods row. */
.fda-group-lines { overflow: visible; }
.fda-load-group { overflow: visible; }
.fda-items-table:has([data-fda-inline-row]) { table-layout: fixed; min-width: 1040px; font-size: 12px; }
.fda-items-table:has([data-fda-inline-row]) th, .fda-items-table:has([data-fda-inline-row]) td { padding: 10px 8px; }
.fda-inline-select { width: 30px; }
.fda-inline-item { width: 18%; }
.fda-inline-item strong { font-size: 12px; }
.fda-inline-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fda-inline-current { display: inline-block; padding: 3px 6px; margin-top: 6px; border-radius: 4px; background: var(--accent-weak); color: var(--accent-ink); font-size: 11px; }
.fda-inline-quantity { width: 8%; }
.fda-inline-stage { width: 12%; }
.fda-inline-followup-cell { width: 15%; }
.fda-inline-more { width: 6%; position: relative; overflow: visible; }
.fda-inline-more:has(.fda-row-more[open]) { z-index: 30; }
.fda-inline-stage-button { width: 100%; padding: 7px 5px; min-height: 32px; border: 1px dashed var(--line); border-radius: 6px; background: var(--surface); color: var(--accent-ink); font-size: 12px; }
.fda-inline-stage-button:hover { border-color: var(--accent); background: var(--accent-weak); color: var(--accent-ink); }
.fda-inline-stage-button.is-recorded { border-style: solid; background: var(--accent-weak); }
.fda-inline-stage-button:disabled { cursor: default; opacity: .65; }
.fda-inline-stage-value { display: inline-block; padding: 7px 0; }
.fda-inline-lots, .fda-inline-next { overflow-wrap: anywhere; max-height: 44px; overflow: hidden; }
.fda-inline-followup { width: 100%; height: auto; padding: 3px 0; background: transparent; color: var(--text); border: 0; font-size: 12px; text-align: left; }
.fda-inline-followup:hover { color: var(--accent-ink); background: var(--accent-weak); }
.fda-inline-editor { display: grid; gap: 7px; margin: 0; }
.fda-inline-editor label { display: grid; gap: 3px; font-size: 11px; color: var(--muted); }
.fda-inline-editor input, .fda-inline-editor select { width: 100%; min-width: 0; box-sizing: border-box; padding: 6px 4px; border-radius: 4px; font-size: 11px; }
.fda-inline-editor small { margin-top: 0; line-height: 1.4; }
.fda-inline-buttons { display: flex; gap: 4px; flex-wrap: wrap; }
.fda-inline-buttons button { padding: 5px 7px; font-size: 11px; min-height: 28px; }
.fda-inline-repeat { border: 0; background: transparent; color: var(--accent-ink); padding: 2px; font-size: 11px; text-align: left; }
.fda-inline-error { color: #a73b1d !important; }
.fda-row-more { margin: 0; }
.fda-row-more > summary { cursor: pointer; color: var(--accent-ink); font-size: 12px; padding: 7px 0; }
.fda-row-more > div { position: absolute; right: 4px; z-index: 20; display: grid; min-width: 170px; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: 0 8px 24px #172b4d22; }
.fda-row-more button { padding: 8px 9px; border: 0; background: transparent; color: var(--text); text-align: left; font-size: 12px; }
.fda-row-more button:hover { background: var(--accent-weak); color: var(--accent-ink); }
.fda-batch-controls { margin: 0; border-top: 1px solid var(--line); }
.fda-batch-controls > summary { padding: 8px 16px; cursor: pointer; color: var(--muted); font-size: 11px; }
.fda-batch-controls .fda-group-actions { border: 0; padding-top: 0; }
@media (max-width: 640px) {
  #fdaDetail { padding: 14px; }
  .fda-form-grid { grid-template-columns: minmax(0, 1fr); }
  .fda-timeline { padding-left: 10px; }
  .fda-load-actions button { width: 100%; margin: 8px 0 0; }
}

/* System monitoring is scoped to Admin; it does not alter the main tab model. */
.ops-alert { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 16px; padding: 14px 18px; border: 1px solid #e4b863; border-radius: 10px; background: #fff8e8; color: #795318; }
.ops-alert--critical { background: #fff0f0; border-color: #e7a2a2; color: #992727; }
.ops-alert p { margin: 4px 0 0; }
.ops-alert .toolbar { flex-shrink: 0; }
.ops-subnav { padding: 0 20px 18px; }
.ops-subnav button[aria-pressed="true"] { background: var(--accent-weak); color: var(--accent-ink); border-color: var(--accent); }
.ops-monitor { padding: 0 20px 20px; }
.ops-monitor > .section-heading { margin: 0 0 12px; }
.ops-monitor h3 { font-size: 15px; margin: 0 0 12px; }
.ops-monitor h4 { font-size: 14px; margin: 0; }
.ops-monitor p { line-height: 1.5; }
.ops-notice { border-left: 3px solid var(--accent); padding-left: 10px; }
.ops-notice:empty { display: none; }
.ops-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0 10px; }
.ops-card { border: 1px solid var(--line); background: var(--surface-soft); border-radius: 8px; padding: 16px; min-width: 0; }
.ops-card > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.ops-card > strong { display: block; font-size: 19px; overflow-wrap: anywhere; }
.ops-columns { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; margin: 18px 0; }
.ops-section { padding: 18px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; margin-top: 16px; }
.ops-columns > .ops-section, .ops-side-sections > .ops-section:first-child { margin-top: 0; }
.ops-readings { display: grid; grid-template-columns: minmax(130px, .9fr) minmax(0, 1.1fr); gap: 9px 14px; margin: 0; font-size: 13px; }
.ops-readings dt { color: var(--muted); }
.ops-readings dd { margin: 0; overflow-wrap: anywhere; }
.ops-presence { list-style: none; padding: 0; margin: 0; }
.ops-presence li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.ops-presence strong, .ops-presence span { display: block; overflow-wrap: anywhere; }
.ops-presence span { margin-top: 4px; font-size: 12px; }
.ops-filter { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.ops-errors-table table { min-width: 850px; }
.ops-errors-table td { white-space: normal; max-width: 300px; overflow-wrap: anywhere; vertical-align: top; }
.ops-route { margin-top: 5px; font-family: var(--font-mono); font-size: 12px; }
.ops-pagination { justify-content: flex-end; margin-top: 12px; }
.ops-pagination > span { margin-right: auto; }
.ops-error-detail { margin-top: 18px; padding: 18px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; }
.ops-error-detail > .toolbar { margin-top: 14px; }
.ops-error-detail summary { cursor: pointer; font-size: 13px; }
.ops-safe-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 340px; overflow: auto; }
@media (max-width: 900px) {
  .ops-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-columns { grid-template-columns: minmax(0, 1fr); }
  .ops-alert { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 540px) {
  .ops-monitor { padding: 0 12px 12px; }
  .ops-subnav { padding: 0 12px 14px; }
  .ops-section { padding: 12px; }
  .ops-readings { grid-template-columns: 1fr; gap: 3px; }
  .ops-readings dd { margin-bottom: 10px; }
}
