:root {
  --paper: #f6f8f5;
  --paper-soft: #fbfcf7;
  --ink: #183b34;
  --ink-2: #244b43;
  --muted: #697773;
  --line: rgba(24, 59, 52, 0.14);
  --mint: #4fbf9f;
  --coral: #f26b5e;
  --amber: #f4b740;
  --blue: #3e6ae1;
  --danger: #b9382f;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background:
    linear-gradient(90deg, rgba(24, 59, 52, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(24, 59, 52, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

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

button {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: var(--paper-soft);
  background: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

button:disabled {
  cursor: not-allowed;
  color: rgba(105, 119, 115, 0.72);
  background: rgba(24, 59, 52, 0.08);
}

.ghost,
.secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.danger {
  color: #fff;
  background: var(--danger);
}

.text-button {
  min-height: auto;
  padding: 0;
  color: var(--muted);
  background: transparent;
}

.ops-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(251, 252, 247, 0.94);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mark {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 8px;
  color: var(--ink);
  background: var(--amber);
  box-shadow: 7px 7px 0 rgba(79, 191, 159, 0.4);
  font-size: 26px;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 20px;
}

.brand span,
.operator-card span,
label span,
.muted,
small,
p {
  color: var(--muted);
}

.operator-card {
  margin: 22px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.operator-card span,
.operator-card strong {
  display: block;
}

.operator-card strong {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.45;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav-group {
  margin: 14px 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
}

.nav button.active {
  color: var(--paper-soft);
  border-color: var(--ink);
  background: var(--ink);
}

.nav strong {
  min-width: 28px;
  padding: 4px 7px;
  border-radius: 8px;
  color: var(--ink);
  background: var(--amber);
  text-align: center;
  font-size: 12px;
}

.nav strong.coral {
  color: #fff;
  background: var(--coral);
}

.nav strong.amber {
  background: var(--amber);
}

.auth-panel {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.auth-panel label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

textarea {
  min-height: 108px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  resize: vertical;
}

.wide {
  width: 100%;
}

.workspace {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: 38px;
  line-height: 1.05;
}

.topbar p,
.module-head p,
.panel-head p {
  max-width: 760px;
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.55;
}

.eyebrow {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--ink);
  background: rgba(79, 191, 159, 0.18);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.muted {
  color: var(--muted);
  background: rgba(24, 59, 52, 0.08);
}

.badge.mint {
  background: rgba(79, 191, 159, 0.22);
}

.badge.coral {
  color: #fff;
  background: var(--coral);
}

.badge.amber {
  background: rgba(244, 183, 64, 0.38);
}

.badge.blue {
  color: #fff;
  background: var(--blue);
}

.app-root {
  margin-top: 24px;
}

.site-filing {
  padding: 10px 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.site-filing a {
  color: var(--muted);
  text-decoration: none;
}

.site-filing a:hover {
  color: var(--ink);
  text-decoration: underline;
}

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

.ops-metrics {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.metric {
  min-height: 104px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--paper-soft);
  background: var(--ink);
}

.metric[data-nav] {
  cursor: pointer;
}

.metric[data-nav]:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(24, 59, 52, 0.14);
}

.metric span,
.metric small {
  display: block;
  color: rgba(251, 252, 247, 0.72);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin: 8px 0 4px;
  color: var(--amber);
  font-size: 30px;
}

.metric.mint strong {
  color: var(--mint);
}

.metric.coral strong {
  color: var(--coral);
}

.metric.blue strong {
  color: #9cb4ff;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.ops-insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 14px;
  margin-top: 16px;
}

.panel,
.module,
.state-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 252, 247, 0.94);
  box-shadow: 0 16px 36px rgba(24, 59, 52, 0.08);
}

.panel-head,
.module-head,
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel h3,
.module h2,
.state-panel h2,
.drawer h2,
.audit-box h3 {
  margin: 2px 0 0;
}

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

.module-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.module-summary div {
  min-height: 70px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.module-summary span,
.module-summary strong {
  display: block;
}

.module-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.module-summary strong {
  margin-top: 6px;
  font-size: 24px;
}

.queue-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.queue-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.bar-chart {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.bar-row div {
  height: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(24, 59, 52, 0.08);
}

.bar-row i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--mint);
}

.bar-row strong {
  color: var(--ink);
  text-align: right;
}

.priority-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.priority-list div {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.priority-list strong {
  color: var(--coral);
}

.priority-list span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: end;
  gap: 10px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.toolbar label {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.toolbar .search {
  grid-column: span 2;
  min-width: min(100%, 280px);
}

.toolbar button {
  align-self: end;
  min-width: 84px;
}

.toolbar span {
  font-size: 12px;
  font-weight: 900;
}

input,
select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.selection-line,
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  scrollbar-gutter: stable;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: var(--paper-soft);
  font-size: 12px;
  font-weight: 900;
}

.action-cell {
  position: sticky;
  right: 0;
  z-index: 3;
  min-width: 214px;
  background: rgba(251, 252, 247, 0.96);
  box-shadow: -10px 0 18px rgba(24, 59, 52, 0.08);
}

th.action-cell {
  z-index: 5;
  background: var(--paper-soft);
}

td.action-cell {
  vertical-align: top;
}

tbody tr:hover {
  background: rgba(79, 191, 159, 0.08);
}

tbody tr:hover .action-cell {
  background: #f1f8ef;
}

.check-cell {
  width: 42px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.row-actions button {
  min-height: 32px;
}

.identity strong,
.identity span,
.two-line strong,
.two-line span {
  display: block;
}

.identity strong,
.two-line strong {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.identity span,
.two-line span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.score {
  display: inline-grid;
  min-width: 44px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  color: var(--ink);
  background: rgba(244, 183, 64, 0.34);
  font-weight: 900;
}

.score.mint {
  background: rgba(79, 191, 159, 0.22);
}

.score.coral {
  color: #fff;
  background: var(--coral);
}

.empty-state,
.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
}

.empty-state h3 {
  margin: 0;
  color: var(--ink);
}

.state-panel {
  max-width: 720px;
}

.state-panel.error {
  border-left: 8px solid var(--coral);
}

.loading-grid {
  display: grid;
  gap: 14px;
}

.loading-grid div {
  min-height: 170px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(24, 59, 52, 0.08), rgba(255, 255, 255, 0.7), rgba(24, 59, 52, 0.08));
  background-size: 300% 100%;
  animation: loading 1.2s ease infinite;
}

@keyframes loading {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  width: min(520px, 94vw);
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  padding: 22px 22px 28px;
  border-left: 1px solid var(--line);
  background: var(--paper-soft);
  box-shadow: -20px 0 60px rgba(24, 59, 52, 0.18);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(105%);
  transition: transform 0.2s ease;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-bottom: 12px;
  background: var(--paper-soft);
}

.drawer-head h2 {
  overflow-wrap: anywhere;
}

.drawer-section {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  overflow-wrap: anywhere;
}

.drawer-section h3 {
  margin: 4px 0 0;
}

.evidence-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(62, 106, 225, 0.08);
}

.evidence-box a {
  color: var(--blue);
  font-weight: 900;
}

.reason-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.reason-templates span {
  flex: 1 0 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

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

.risk-grid div {
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 59, 52, 0.04);
}

.risk-grid span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.risk-grid strong {
  display: block;
  color: var(--ink);
  font-size: 20px;
}

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

.detail-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.detail-grid span,
.detail-grid strong {
  display: block;
}

.detail-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.detail-grid strong {
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.45;
}

.audit-box {
  margin-top: 18px;
}

.audit-row {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 59, 52, 0.04);
  overflow-wrap: anywhere;
}

.audit-row span,
.audit-row small {
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  min-width: 220px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--paper-soft);
  background: var(--ink);
  box-shadow: 0 16px 42px rgba(24, 59, 52, 0.22);
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mobile-only {
  display: none;
}

.nav-scrim {
  display: none;
}

@media (max-width: 1180px) {
  body.nav-open {
    overflow: hidden;
  }

  .ops-shell {
    grid-template-columns: 1fr;
  }

  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(286px, 84vw);
    transform: translateX(-104%);
    transition: transform 0.2s ease;
  }

  .nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: block;
    background: rgba(24, 59, 52, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }

  .nav-open .nav-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .nav-open .side {
    transform: translateX(0);
  }

  .mobile-only {
    display: inline-flex;
  }

  .metrics,
  .ops-metrics,
  .dashboard-grid,
  .ops-insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .toolbar .search {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .module-head,
  .panel-head {
    display: grid;
  }

  .metrics,
  .ops-metrics,
  .dashboard-grid,
  .ops-insight-grid,
  .toolbar,
  .detail-grid,
  .module-summary,
  .risk-grid {
    grid-template-columns: 1fr;
  }

  .topbar h1 {
    font-size: 32px;
  }

  .row-actions {
    min-width: 0;
  }

  .action-cell {
    min-width: 176px;
  }

  .drawer {
    width: 100vw;
    padding: 18px 18px 24px;
  }
}
