:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #dde3ee;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --soft: #eef4ff;
  --warn: #b45309;
  --warn-bg: #fff7ed;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --ok: #047857;
  --ok-bg: #ecfdf5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 22px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
}

h2 {
  font-size: 18px;
  margin-bottom: 14px;
}

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

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

.tabs,
.report-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab,
.report-tab,
.ghost,
.secondary,
.primary {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 13px;
  background: transparent;
  color: var(--ink);
}

.tab.active,
.report-tab.active {
  background: var(--soft);
  color: var(--brand-dark);
  font-weight: 700;
}

.primary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  font-weight: 700;
}

.primary:hover {
  background: var(--brand-dark);
}

.secondary {
  background: #f8fafc;
  border-color: var(--line);
}

.ghost {
  background: #fff;
  border-color: var(--line);
}

main {
  padding: 22px 28px 40px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.kpi,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kpi {
  padding: 18px;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.kpi.warn {
  background: var(--warn-bg);
}

.compact-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-actions {
  display: flex;
  gap: 8px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.small-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.split,
.grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.hint {
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

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

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

textarea {
  resize: vertical;
}

.file-label {
  position: relative;
  overflow: hidden;
}

.file-label input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.notice,
.empty {
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
}

.list {
  display: grid;
  gap: 10px;
}

.item,
.audit-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.item strong,
.audit-card strong {
  display: block;
  margin-bottom: 4px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  background: #eef2ff;
  color: #3730a3;
}

.badge.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

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

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

th {
  background: #f8fafc;
  color: #344054;
  font-size: 13px;
}

.image-preview {
  min-height: 160px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #f8fafc;
  overflow: hidden;
  margin-bottom: 12px;
}

.image-preview img {
  max-width: 100%;
  max-height: 260px;
  display: block;
}

.preview-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  padding: 10px;
}

.preview-grid figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.preview-grid img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.preview-grid figcaption {
  padding: 7px 8px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-list {
  display: grid;
  gap: 12px;
}

.audit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

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

.compact-form button {
  grid-column: span 2;
}

.report-tabs {
  padding: 0;
  border-bottom: 0;
  margin-bottom: 12px;
}


@media (max-width: 860px) {
  .topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .kpi-grid,
  .split,
  .grid.two {
    grid-template-columns: 1fr;
  }

  main {
    padding: 16px;
  }

  .tabs {
    padding: 10px 16px;
  }

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

  .compact-fields {
    grid-template-columns: 1fr;
  }

  .compact-form button {
    grid-column: auto;
  }
}
