:root {
  --bg: #f5f6f3;
  --panel: #ffffff;
  --ink: #161616;
  --muted: #6d716b;
  --line: #dde3da;
  --brand: #1f6b5c;
  --brand-soft: #e2f2ec;
  --warn: #b84d2e;
  --warn-soft: #fff0e8;
  --ok: #236741;
  --ok-soft: #e6f4ea;
  --blue: #2f5f9f;
  --blue-soft: #edf3ff;
  --shadow: 0 12px 28px rgba(30, 35, 30, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

.intake-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 22px 16px 48px;
}

.intake-topbar,
.panel-head,
.top-actions,
.button-row,
.filter-bar,
.record-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.intake-topbar {
  justify-content: space-between;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
}

.panel-head {
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.primary-btn,
.ghost-btn {
  border-radius: 10px;
  padding: 10px 13px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.primary-btn {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

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

.metric {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 13px;
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 28px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.tool-panel,
.review-panel,
.inbound-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
  box-shadow: var(--shadow);
}

.inbound-panel {
  margin-top: 14px;
}

.drop-zone {
  position: relative;
  display: grid;
  gap: 6px;
  place-items: center;
  min-height: 148px;
  border: 1px dashed #aeb9af;
  border-radius: 8px;
  background: #f9fbf8;
  text-align: center;
  padding: 18px;
  cursor: pointer;
}

.drop-zone.is-dragging {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.drop-zone span {
  color: var(--muted);
  font-size: 13px;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.field-control {
  display: grid;
  gap: 6px;
}

.field-control span {
  color: var(--muted);
  font-size: 12px;
}

.field-control input,
.field-control select,
.field-control textarea,
.filter-bar input,
.filter-bar select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

.block-field {
  margin-top: 12px;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

.button-row {
  flex-wrap: wrap;
  margin-top: 12px;
}

.button-row.compact {
  margin-top: 0;
}

.thumb-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.thumb {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f7f7f4;
  cursor: pointer;
}

.thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.thumb span {
  display: block;
  padding: 6px;
  color: var(--muted);
  font-size: 11px;
}

.filter-bar {
  margin-bottom: 12px;
}

.filter-bar select {
  width: 160px;
}

.filter-bar input {
  flex: 1;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.review-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #fff;
}

.review-table th,
.review-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.review-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f8f5;
  color: var(--muted);
  font-weight: 700;
}

.review-table input,
.review-table select {
  width: 100%;
  min-width: 88px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f9faf8;
  padding: 7px;
}

.review-table input:focus,
.review-table select:focus {
  border-color: var(--brand);
  outline: 0;
  background: #fff;
}

.row-risk td {
  background: var(--warn-soft);
}

.row-duplicate td {
  background: #fff8df;
}

.status-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pending {
  background: #fff4dc;
  color: #8b5b00;
}

.status-approved {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-inbounded {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-exception {
  background: var(--warn-soft);
  color: var(--warn);
}

.mini-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 12px;
}

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

.inbound-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 12px;
}

.inbound-card strong {
  display: block;
  margin-bottom: 8px;
}

.inbound-card .meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.image-dialog {
  width: min(920px, 94vw);
  border: 0;
  border-radius: 8px;
  padding: 12px;
}

.image-dialog::backdrop {
  background: rgba(0, 0, 0, 0.48);
}

.image-dialog img {
  display: block;
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
}

.dialog-close {
  float: right;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 7px 10px;
}

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

  .workspace-grid,
  .inbound-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .intake-topbar,
  .panel-head,
  .top-actions,
  .filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .primary-btn,
  .ghost-btn,
  .filter-bar select {
    width: 100%;
    text-align: center;
  }
}
