:root {
  color-scheme: light;
  --bg: #f3f2f1;
  --panel: #ffffff;
  --ink: #0b0c0c;
  --muted: #505a5f;
  --line: #b1b4b6;
  --accent: #1d70b8;
  --accent-strong: #003078;
  --warn: #d4351c;
  --good: #00703c;
  --soft: #f8f8f8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #182326;
}

.login-panel {
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 8px;
  background: white;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
}

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 26px;
}

.login-panel p {
  margin: 0 0 18px;
  color: var(--muted);
}

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

.login-message {
  min-height: 24px;
  margin-top: 12px;
  color: var(--warn);
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  background: #0b0c0c;
  color: white;
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: 0;
}

.topbar p {
  margin: 0;
  color: #d8d8d8;
}

.company-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: white;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
}

.company-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 30px;
  background: #d4351c;
  color: white;
  font-size: 14px;
}

.login-brand {
  color: var(--ink);
  margin-bottom: 18px;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 8px 12px;
  border-radius: 999px;
  color: #dce9e5;
}

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

.nav-more {
  position: relative;
}

.nav-more summary {
  min-height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 2px;
  cursor: pointer;
  list-style: none;
}

.nav-more summary::-webkit-details-marker {
  display: none;
}

.nav-more summary::after {
  content: "▾";
  margin-left: 7px;
  font-size: 12px;
}

.nav-more[open] summary {
  background: rgba(255, 255, 255, 0.12);
}

.nav-more-menu {
  position: absolute;
  z-index: 30;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.topnav .nav-more-menu a {
  display: flex;
  min-height: 40px;
  color: var(--ink);
  background: white;
  border: 0;
  border-bottom: 1px solid var(--line);
  justify-content: flex-start;
}

.topnav .nav-more-menu a:hover {
  color: white;
  background: var(--accent-strong);
}

.topnav .nav-more-menu a:last-child {
  border-bottom: 0;
}

.reference-price {
  display: grid;
  gap: 2px;
  min-width: 150px;
}

.reference-price small {
  color: var(--muted);
}

.status-tag {
  display: inline-flex;
  padding: 3px 7px;
  border: 1px solid var(--line);
  background: #f3f5f4;
  font-size: 13px;
}

.expiry-note {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.outbound-filters {
  grid-template-columns: minmax(240px, 1fr) minmax(160px, 220px) minmax(120px, 160px);
}

.topnav a,
.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 2px;
  color: white;
  text-decoration: none;
}

.action-link {
  min-height: 46px;
  border-color: var(--line);
  background: var(--accent);
}

.action-link:hover {
  background: var(--accent-strong);
}

.app-shell {
  width: min(1440px, calc(100% - 40px));
  margin: 24px auto 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.app-shell > * {
  min-width: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 18px;
  box-shadow: none;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 20px;
}

.panel-heading span {
  color: var(--muted);
  font-size: 14px;
}

.query-row {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 10px;
}

.query-row.with-voice {
  grid-template-columns: 1fr minmax(88px, auto) minmax(110px, auto);
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 2px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

.ghost-button {
  background: #e8eeee;
  color: var(--ink);
}

.ghost-button:hover {
  background: #d8e2e0;
}

.primary-button {
  background: var(--accent);
}

.quick-queries {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.quick-queries button {
  min-height: 34px;
  padding: 0 10px;
  background: var(--soft);
  color: var(--accent-strong);
}

.summary-box {
  margin-top: 14px;
  padding: 12px;
  border-radius: 2px;
  background: #f4f6f5;
  color: var(--muted);
  min-height: 46px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.results-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.coil-card,
.plan-card {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px;
  background: white;
}

.coil-card strong,
.plan-card strong {
  display: block;
  margin-bottom: 8px;
}

.meta-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  color: var(--muted);
  font-size: 14px;
}

.match-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-top: 10px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  font-size: 13px;
}

.filter-details {
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 10px;
}

.filter-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
}

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

.check-chip {
  position: relative;
  display: block;
  min-width: 0;
}

.check-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.check-chip span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-size: 14px;
  text-align: center;
  overflow-wrap: anywhere;
}

.check-chip input:checked + span {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.slitting-layout {
  display: grid;
  grid-template-columns: minmax(420px, 520px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.demand-editor {
  display: grid;
  gap: 12px;
  align-content: start;
}

.hint-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.demand-row {
  display: grid;
  grid-template-columns: minmax(132px, 1.3fr) repeat(3, minmax(104px, 1fr)) 42px;
  gap: 8px;
  margin-bottom: 8px;
  align-items: end;
}

.demand-row label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.demand-row label input {
  min-width: 0;
  padding-left: 8px;
  padding-right: 8px;
}

.demand-row button {
  background: #efe7df;
  color: #7b4210;
}

.plan-results {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

.plan-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.plan-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.plan-score {
  color: var(--good);
  font-weight: 700;
}

.pattern-line {
  padding: 8px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.plan-summary {
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 2px;
  background: #f4f6f5;
  color: var(--ink);
  line-height: 1.55;
}

.delivery-list {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.delivery-line {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  color: var(--muted);
}

.delivery-line strong {
  margin: 0;
  color: var(--ink);
}

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

.hidden {
  display: none !important;
}

.work-order-editor {
  width: 100%;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 14px;
  resize: vertical;
  font: 15px/1.7 "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background: #fbfcfb;
}

.work-order-panel {
  scroll-margin-top: 18px;
}

.inventory-form {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 12px;
  align-items: end;
}

.inventory-form label,
.demand-editor label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.form-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 8px;
  grid-column: 1 / -1;
}

.danger-button {
  background: var(--warn);
}

.danger-button:hover {
  background: #942514;
}

.table-tools {
  display: grid;
  grid-template-columns: minmax(240px, 420px) 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

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

.board-column {
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  padding: 10px;
}

.board-column header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 700;
}

.board-column header span {
  color: var(--muted);
  font-weight: 400;
}

.board-cards {
  display: grid;
  gap: 10px;
  min-height: 80px;
}

.order-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  cursor: grab;
}

.order-card.dragging {
  opacity: 0.55;
  outline: 2px solid var(--accent);
}

.order-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.order-card-head span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.order-card label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 14px;
}

.order-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  resize: vertical;
  font: inherit;
}

.order-card pre {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  margin: 0;
  padding: 10px;
  border-radius: 6px;
  background: #f4f6f5;
  color: var(--muted);
  font-family: inherit;
  line-height: 1.5;
}

.order-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.quote-list {
  display: grid;
  gap: 8px;
}

.quote-list div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.quote-list small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.quote-actions {
  margin-top: 10px;
  grid-template-columns: minmax(180px, 260px);
}

.ai-setup-row {
  margin-top: 10px;
  grid-template-columns: minmax(240px, 1fr) minmax(120px, 180px);
}

.quote-parse {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quote-parse span {
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
}

.quote-parse b {
  color: var(--ink);
}

.settings-form {
  grid-template-columns: minmax(220px, 1.2fr) minmax(260px, 1.4fr) minmax(160px, 0.8fr);
}

.settings-test-query {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.settings-count {
  display: grid;
  grid-template-columns: minmax(160px, 240px);
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}

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

.mill-class-grid label {
  display: grid;
  gap: 8px;
}

.mill-class-grid textarea {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--line);
  background: white;
  font: inherit;
  line-height: 1.6;
}

.inline-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.inline-select select {
  min-width: 90px;
}

.classification-link {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.quote-row-link {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.quote-detail-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.quote-detail-meta > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.quote-detail-meta span {
  color: var(--muted);
  font-size: 13px;
}

.detail-actions {
  margin-top: 14px;
  grid-template-columns: repeat(2, minmax(160px, 240px));
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  background: var(--accent);
  color: white;
  text-decoration: none;
}

.evidence-loading {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
  background: #f5f7f6;
  border: 1px solid var(--line);
}

.loading-spinner {
  width: 38px;
  height: 38px;
  border: 4px solid #c9d2cf;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: evidence-spin 0.9s linear infinite;
}

@keyframes evidence-spin {
  to { transform: rotate(360deg); }
}

.evidence-image {
  display: block;
  width: min(100%, 1280px);
  margin: 0 auto;
  border: 1px solid var(--line);
  background: white;
}

.agent-token-actions {
  grid-template-columns: minmax(140px, 220px) minmax(140px, 220px);
}

.token-box {
  overflow-x: auto;
  padding: 10px;
  border: 1px solid var(--line);
  background: white;
  white-space: nowrap;
}

.empty-board {
  padding: 16px;
  color: var(--muted);
  text-align: center;
}

.table-tools span {
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 6px;
}

.mini-button {
  min-height: 30px;
  padding: 0 8px;
  border-radius: 5px;
  background: #e8eeee;
  color: var(--ink);
  white-space: nowrap;
}

.mini-button:hover {
  background: #d8e2e0;
}

.danger-mini {
  background: #f2e5e3;
  color: #8f332e;
}

.utility-footer {
  max-width: 1180px;
  margin: -10px auto 24px;
  padding: 0 20px;
  text-align: right;
}

.utility-footer a {
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.utility-footer a:hover {
  color: var(--accent);
}

.site-legal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.site-legal-footer a {
  color: var(--accent-strong);
  text-decoration: none;
}

.site-legal-footer a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.mobile-bottom-nav {
  display: none;
}

.log-list {
  display: grid;
  gap: 8px;
}

.log-item {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.log-item div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.log-item span,
.log-item p,
.log-item time {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.today-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.today-grid h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #f8faf9;
}

@media (max-width: 760px) {
  body {
    background: #eef2ef;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .topbar,
  .panel-heading,
  .slitting-layout,
  .query-row,
  .query-row.with-voice,
  .inventory-form,
  .filter-grid,
  .table-tools,
  .form-actions {
    grid-template-columns: 1fr;
  }

  .production-board,
  .today-grid,
  .plan-actions,
  .mill-class-grid,
  .quote-detail-meta,
  .detail-actions {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 14px 16px;
    gap: 6px;
  }

  .topnav {
    display: none;
  }

  .topbar h1 {
    margin: 0;
    font-size: 20px;
  }

  .company-brand {
    margin-bottom: 4px;
    font-size: 12px;
  }

  .company-mark {
    width: 34px;
    height: 24px;
    font-size: 12px;
  }

  .topbar p {
    display: none;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: white;
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.08);
  }

  .mobile-bottom-nav > a,
  .mobile-more-button {
    display: grid;
    place-items: center;
    min-height: 46px;
    padding: 0;
    border: 0;
    border-radius: 2px;
    background: white;
    color: var(--ink);
    text-decoration: none;
    font-size: 13px;
    font-family: inherit;
  }

  .mobile-bottom-nav > a.active {
    background: var(--accent);
    color: white;
    font-weight: 700;
  }

  .mobile-more-button[aria-expanded="true"] {
    background: #e8f1f8;
    color: var(--accent);
    font-weight: 700;
  }

  .mobile-more-menu {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(64px + env(safe-area-inset-bottom));
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    max-height: min(62vh, 460px);
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--line);
    background: white;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.16);
  }

  .mobile-bottom-nav.more-open .mobile-more-menu {
    display: grid;
  }

  .mobile-more-menu a {
    min-height: 44px;
    padding: 11px 12px;
    border-bottom: 1px solid #e5e7e8;
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
  }

  .status-pill {
    width: fit-content;
    padding: 6px 10px;
    font-size: 13px;
  }

  .app-shell {
    width: 100%;
    margin: 0;
    gap: 10px;
    padding: 10px;
  }

  .panel {
    padding: 14px;
    border-radius: 8px;
    box-shadow: none;
  }

  .panel-heading {
    display: grid;
    gap: 4px;
  }

  .panel-heading h2 {
    font-size: 18px;
  }

  .panel-heading span {
    font-size: 13px;
  }

  input,
  select,
  button {
    min-height: 46px;
    font-size: 16px;
  }

  .quick-queries {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .quick-queries button {
    min-height: 40px;
    padding: 0 8px;
  }

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

  .slitting-layout {
    display: grid;
    gap: 12px;
  }

  .filter-details {
    padding: 10px;
  }

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

  .check-chip span {
    min-height: 44px;
    padding: 5px;
    font-size: 13px;
  }

  .demand-row {
    grid-template-columns: 1fr;
    padding: 10px;
    border: 1px solid var(--line);
    background: var(--soft);
  }

  .work-order-panel {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 10px;
    padding: 14px;
    border: 0;
    border-radius: 0;
    overflow: hidden;
  }

  .work-order-panel.hidden {
    display: none !important;
  }

  .work-order-panel .panel-heading {
    margin: 0;
  }

  .work-order-editor {
    min-height: 0;
    height: 100%;
    resize: none;
    font-size: 16px;
    line-height: 1.75;
  }

  .work-order-panel .form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .plan-card header {
    display: grid;
    gap: 4px;
  }

  .delivery-line {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
  }

  .pattern-line {
    line-height: 1.55;
  }

  .inventory-form {
    gap: 10px;
  }

  .form-actions {
    gap: 8px;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: white;
  }

  td {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 10px;
    align-items: center;
    padding: 7px 0;
    border: 0;
    white-space: normal;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
  }

  td[data-label="卷号"] {
    font-weight: 700;
    color: var(--ink);
  }

  td[data-label="操作"] {
    grid-template-columns: 1fr;
    padding-top: 10px;
  }

  td[data-label="操作"]::before {
    display: none;
  }

  .row-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .mini-button {
    min-height: 38px;
    padding: 0 6px;
  }
}

@media (max-width: 420px) {
  .quick-queries,
  .row-actions {
    grid-template-columns: 1fr;
  }

  .meta-list {
    grid-template-columns: 72px 1fr;
  }
}
.semantic-fields {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.semantic-fields label {
  display: grid;
  gap: 5px;
  font-weight: 700;
}

.semantic-fields input {
  width: 100%;
}

@media (max-width: 800px) {
  .semantic-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .semantic-fields button {
    grid-column: 1 / -1;
  }
}

.steel-master-shell {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr) minmax(260px, 330px);
  height: calc(100vh - 104px);
  min-height: 620px;
  border-top: 1px solid #b1b4b6;
  background: #ffffff;
}

.steel-master-sidebar,
.steel-detail-panel {
  overflow: auto;
  padding: 18px;
  background: #f3f2f1;
}

.steel-master-sidebar {
  border-right: 1px solid #b1b4b6;
}

.steel-detail-panel {
  position: relative;
  border-left: 1px solid #b1b4b6;
}

.steel-master-sidebar h2,
.steel-detail-panel h2 {
  margin: 20px 0 10px;
  font-size: 18px;
}

.master-search label,
.feedback-box label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.master-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 16px 0;
  padding: 12px 0;
  border-top: 2px solid #0b0c0c;
  border-bottom: 1px solid #b1b4b6;
}

.master-stats strong {
  grid-column: 1 / -1;
}

.master-stats span {
  font-size: 13px;
}

.master-gate-status {
  display: grid;
  gap: 6px;
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid #85994b;
  border-left: 5px solid #85994b;
  background: #f7f9ee;
  font-size: 12px;
}

.master-gate-status.locked {
  border-color: #d4351c;
  background: #fff4f2;
}

.master-gate-status strong {
  font-size: 14px;
}

.master-gate-status small {
  color: #505a5f;
}

.knowledge-guidance {
  margin: 12px 0;
}

.knowledge-guidance-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid #d4351c;
  border-left: 5px solid #d4351c;
  background: #fff4f2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.knowledge-guidance-card p {
  margin: 0;
  color: #505a5f;
}

.guidance-block span {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
}

.guidance-block ul {
  margin: 0;
  padding-left: 18px;
}

.guidance-block small {
  display: inline-block;
  margin-top: 4px;
  color: #505a5f;
  line-height: 1.45;
}

.coverage-list {
  display: grid;
  gap: 4px;
}

.coverage-list > span {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 7px;
  padding: 6px 0;
  border-bottom: 1px solid #d8dde0;
  font-size: 14px;
}

.coverage-list small,
.source-list small {
  color: #505a5f;
  font-size: 11px;
}

.coverage-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b1b4b6;
}

.coverage-dot.reviewed,
.coverage-dot.reviewed_out_of_scope {
  background: #00703c;
}

.coverage-dot.discovered,
.coverage-dot.extracted {
  background: #f47738;
}

.coverage-dot.identity_pending {
  background: #d4351c;
}

.source-list {
  display: grid;
  gap: 2px;
}

.source-list a {
  display: grid;
  gap: 3px;
  padding: 9px 0;
  border-bottom: 1px solid #b1b4b6;
  color: #1d70b8;
  text-decoration: none;
}

.source-list a:hover {
  text-decoration: underline;
}

.steel-graph-workspace {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #ffffff;
}

.graph-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 8px 12px;
  border-bottom: 1px solid #b1b4b6;
  background: #ffffff;
}

.segmented-control {
  display: flex;
  flex: 1;
  min-width: 0;
}

.segmented-control button {
  min-height: 38px;
  border: 1px solid #505a5f;
  border-right: 0;
  border-radius: 0;
  background: #ffffff;
  color: #0b0c0c;
  white-space: nowrap;
}

.segmented-control button:last-child {
  border-right: 1px solid #505a5f;
}

.segmented-control button.active {
  background: #0b0c0c;
  color: #ffffff;
}

.steel-graph {
  width: 100%;
  height: calc(100% - 54px);
  min-height: 500px;
}

.graph-status {
  position: absolute;
  left: 12px;
  bottom: 10px;
  max-width: calc(100% - 24px);
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #b1b4b6;
  font-size: 12px;
  pointer-events: none;
}

.steel-graph-list {
  height: calc(100% - 54px);
  overflow: auto;
  padding: 12px;
}

.steel-graph-list button {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 12px 8px;
  border: 0;
  border-bottom: 1px solid #b1b4b6;
  background: #ffffff;
  color: #0b0c0c;
  text-align: left;
}

.node-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.detail-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  color: #0b0c0c;
  font-size: 28px;
}

.node-kind {
  display: inline-block;
  padding: 3px 6px;
  background: #ffdd00;
  font-size: 12px;
  font-weight: 700;
}

.steel-detail-list {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0;
  margin: 14px 0;
  border-top: 1px solid #b1b4b6;
}

.steel-detail-list dt,
.steel-detail-list dd {
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid #d8dde0;
  overflow-wrap: anywhere;
}

.steel-detail-list dt {
  font-weight: 700;
}

.source-citation {
  padding-left: 10px;
  border-left: 4px solid #1d70b8;
  font-size: 13px;
}

.feedback-box {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 2px solid #0b0c0c;
}

.feedback-box textarea {
  width: 100%;
  margin-bottom: 8px;
}

@media (max-width: 980px) {
  .steel-master-shell {
    grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
  }

  .steel-detail-panel {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 250px;
    max-height: 58vh;
    border-top: 2px solid #0b0c0c;
    border-left: 0;
    transform: translateY(105%);
    transition: transform 160ms ease;
    box-shadow: 0 -6px 18px rgba(11, 12, 12, 0.18);
  }

  .steel-detail-panel.open {
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .steel-master-shell {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: auto;
    min-height: calc(100dvh - 70px);
    border-top: 0;
    background: #eef2ef;
  }

  .steel-master-sidebar {
    position: relative;
    z-index: 20;
    top: auto;
    height: auto;
    max-height: none;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid #b1b4b6;
    background: #ffffff;
  }

  .steel-master-sidebar > :not(.master-search):not(.master-stats) {
    display: none;
  }

  .master-search .query-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .master-stats {
    display: flex;
    gap: 10px;
    margin: 8px 0 0;
    padding: 7px 0 0;
    overflow-x: auto;
    border-bottom: 0;
    white-space: nowrap;
  }

  .master-stats strong {
    display: none;
  }

  .steel-graph-workspace {
    height: min(64dvh, 620px);
    min-height: 420px;
    margin: 10px;
    border: 1px solid #b1b4b6;
    background: #ffffff;
  }

  .graph-toolbar {
    display: grid;
    grid-template-columns: 1fr repeat(3, auto);
    min-height: 48px;
    gap: 6px;
    padding: 7px;
    overflow-x: auto;
  }

  .segmented-control {
    overflow-x: auto;
  }

  .segmented-control button {
    min-height: 36px;
    padding: 5px 9px;
    font-size: 12px;
  }

  .graph-toolbar .ghost-button {
    min-height: 36px;
    padding: 5px 9px;
    white-space: nowrap;
  }

  .steel-graph,
  .steel-graph-list {
    height: calc(100% - 48px);
    min-height: 0;
  }

  .steel-graph-list {
    -webkit-overflow-scrolling: touch;
    padding-bottom: 72px;
  }

  .steel-graph-list button {
    grid-template-columns: 14px 1fr;
    gap: 8px;
    min-height: 50px;
  }

  .steel-graph-list button small {
    grid-column: 2;
  }

  .graph-status {
    bottom: 8px;
    font-size: 11px;
  }

  .steel-detail-panel {
    left: 0;
    max-height: 68dvh;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 0;
  }

  .steel-detail-panel::before {
    content: "";
    display: block;
    width: 44px;
    height: 4px;
    margin: -8px auto 12px;
    background: #6f777b;
  }
}
