:root {
  --bg: #f4efe6;
  --paper: #fffdf8;
  --panel: #f8f3eb;
  --line: #d8cbb8;
  --text: #2d261d;
  --muted: #72685a;
  --primary: #8c3d19;
  --primary-strong: #6c2b0d;
  --accent: #1f5f5b;
  --good: #236f45;
  --warn: #90621e;
  --shadow: 0 18px 50px rgba(68, 44, 22, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(140, 61, 25, 0.12), transparent 32%),
    linear-gradient(180deg, #f8f3ea, var(--bg));
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.hero {
  display: block;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  font-weight: 700;
}

.hero h1,
.section-head h2,
.panel-head h3 {
  font-family: Georgia, "Times New Roman", serif;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.05;
}

.hero-copy,
.section-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.card {
  border: 1px solid rgba(141, 110, 76, 0.24);
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  gap: 20px;
  margin-bottom: 20px;
}

.card {
  padding: 22px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.section-head h2,
.panel-head h3 {
  margin: 0 0 8px;
  font-size: 28px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
}

.btn-secondary {
  color: var(--text);
  background: #efe6d7;
}

.btn-ghost {
  color: var(--muted);
  background: transparent;
  border: 1px dashed rgba(114, 104, 90, 0.4);
}

.video-shell {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  min-height: 320px;
  background: linear-gradient(180deg, #251c15, #5d4232);
  border: 1px solid rgba(141, 110, 76, 0.18);
}

.video-shell video {
  width: 100%;
  min-height: 320px;
  object-fit: cover;
  display: block;
}

.video-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 20px;
  color: #fef9f2;
  background: linear-gradient(180deg, rgba(15, 12, 10, 0.1), rgba(15, 12, 10, 0.2));
}

.scan-frame {
  width: min(62vw, 280px);
  height: min(62vw, 280px);
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 26px;
  box-shadow: 0 0 0 200vmax rgba(15, 12, 10, 0.34);
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 18px 0;
}

.upload-box,
.text-box {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid rgba(141, 110, 76, 0.16);
}

.upload-box input,
.field-grid input {
  width: 100%;
  border: 1px solid rgba(141, 110, 76, 0.26);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.9);
}

.asset-form {
  display: grid;
  gap: 16px;
}

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

.field-grid label,
.network-group,
.device-panel {
  padding: 16px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid rgba(141, 110, 76, 0.16);
}

.field-grid label span,
.upload-box span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.network-group {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.network-group legend {
  width: 100%;
  margin-bottom: 8px;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-waiting {
  color: #6d5b3c;
  background: rgba(144, 98, 30, 0.12);
}

.badge-ready {
  color: #fff;
  background: linear-gradient(135deg, var(--good), #2c9157);
}

.device-details {
  margin: 0;
  display: grid;
  gap: 10px;
}

.device-details div {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 10px;
  align-items: start;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(141, 110, 76, 0.24);
}

.device-details div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.device-details dt {
  color: var(--muted);
}

.device-details dd {
  margin: 0;
  word-break: break-all;
}

.records-card {
  overflow: hidden;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(141, 110, 76, 0.18);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

.status-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(88vw, 420px);
  padding: 14px 16px;
  border-radius: 16px;
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 50;
}

.status-success {
  background: linear-gradient(135deg, var(--good), #2c9157);
}

.status-error {
  background: linear-gradient(135deg, #b03d27, #7a2315);
}

.hidden-canvas {
  display: none;
}

@media (max-width: 1024px) {
  .hero,
  .layout,
  .tool-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 18px 14px 28px;
  }

  .card,
  .card {
    padding: 16px;
    border-radius: 18px;
  }

  .scan-frame {
    width: min(72vw, 240px);
    height: min(72vw, 240px);
  }

  .section-head,
  .panel-head {
    flex-direction: column;
  }

  th,
  td {
    padding: 12px 10px;
  }
}
