:root {
  --sidebar-bg: #2f4057;
  --sidebar-text: #d9e2ef;
  --sidebar-muted: #98a7ba;
  --sidebar-active: #3f8cff;
  --app-bg: #f3f6fb;
  --panel-bg: #ffffff;
  --panel-border: #e3e8f0;
  --text-main: #1f2937;
  --text-subtle: #6b7280;
  --text-soft: #94a3b8;
  --primary: #409eff;
  --primary-dark: #2f7fe8;
  --danger: #ef4444;
  --success: #22c55e;
  --warning-bg: #fff7ed;
  --warning-border: #fed7aa;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--app-bg);
  color: var(--text-main);
}

a {
  color: inherit;
  text-decoration: none;
}

img,
video {
  max-width: 100%;
  display: block;
}

.dashboard-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
  background: var(--app-bg);
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 22px 18px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  box-shadow: 2px 0 18px rgba(15, 23, 42, 0.08);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7ddc52, #3ecf8e);
  position: relative;
  box-shadow: 0 8px 20px rgba(61, 207, 142, 0.24);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  border: 2px solid #183153;
  border-radius: 7px;
}

.brand-mark::before {
  inset: 8px 10px 8px 7px;
}

.brand-mark::after {
  inset: 10px 7px 10px 13px;
}

.sidebar-brand strong {
  display: block;
  font-size: 17px;
  color: #ffffff;
}

.sidebar-brand span {
  display: block;
  margin-top: 4px;
  color: var(--sidebar-muted);
  font-size: 12px;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
  align-content: start;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--sidebar-text);
  transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-link.is-active {
  background: rgba(63, 140, 255, 0.16);
  color: #ffffff;
}

.nav-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  opacity: 0.88;
  flex: 0 0 auto;
}

.sidebar-meta {
  padding: 14px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--sidebar-muted);
  font-size: 12px;
  line-height: 1.8;
}

.app-main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 68px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--panel-border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-main {
  min-width: 0;
}

.topbar-label {
  margin: 0 0 4px;
  color: var(--text-soft);
  font-size: 12px;
}

.topbar-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-main);
}

.topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-subtle);
  font-size: 14px;
}

.topbar-user strong {
  display: block;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
}

.topbar-user small {
  display: block;
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 12px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #cfd8e3, #adb8c8);
  display: inline-flex;
}

.content-area {
  padding: 24px;
  display: grid;
  gap: 20px;
}

.page-hero {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.page-hero-rich {
  align-items: stretch;
}

.page-tag,
.section-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #3578d4;
  font-size: 12px;
}

.page-hero h2 {
  margin: 10px 0 8px;
  font-size: 26px;
  font-weight: 600;
}

.page-desc {
  margin: 0;
  max-width: 760px;
  color: var(--text-subtle);
  line-height: 1.8;
}

.page-actions,
.hero-actions,
.compact-actions,
.history-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-aside {
  min-width: 260px;
  max-width: 320px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: #f8fbff;
  padding: 16px;
}

.hero-aside h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.fact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fact-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #e8f1ff;
  color: #2563eb;
  font-size: 13px;
}

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

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

.panel-head h1,
.panel-head h2,
.result-card h3,
.result-card h4,
.overview-card h3,
.class-item h3,
.stat-card h3,
.history-item h3 {
  margin: 6px 0 0;
}

.muted {
  color: var(--text-subtle);
}

.status-pill {
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #dbe4ef;
  background: #f8fafc;
  color: var(--text-subtle);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.status-ok {
  background: #ecfdf5;
  color: #15803d;
  border-color: #bbf7d0;
}

.status-bad {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.health-text {
  font-weight: 600;
}

.health-time {
  font-size: 12px;
  opacity: 0.85;
}

.btn {
  border: none;
  border-radius: 6px;
  min-height: 38px;
  padding: 0 16px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.btn:hover {
  opacity: 0.92;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

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

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

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

.btn-block {
  width: 100%;
}

.upload-form {
  display: grid;
  gap: 14px;
}

.form-grid,
.overview-grid,
.class-grid,
.stats-grid,
.history-grid {
  display: grid;
  gap: 14px;
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.overview-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.metric-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.metric-card {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 16px;
}

.metric-label {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}

.metric-value {
  margin: 12px 0 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-main);
}

.metric-value-small {
  font-size: 18px;
  line-height: 1.5;
}

.metric-help {
  margin: 8px 0 0;
  color: var(--text-subtle);
  line-height: 1.7;
}

.overview-card,
.class-item,
.stat-card,
.history-item,
.detection-item {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: #ffffff;
  padding: 16px;
}

.overview-card p,
.class-item p,
.history-item p,
.comparison-summary,
.simple-note {
  margin: 8px 0 0;
  color: var(--text-subtle);
  line-height: 1.8;
}

.feature-showcase-grid,
.flow-grid,
.sample-grid {
  display: grid;
  gap: 14px;
}

.feature-showcase-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.feature-showcase-card,
.flow-step,
.sample-card {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: #ffffff;
  padding: 16px;
}

.feature-showcase-card h3,
.flow-step h3,
.sample-body h3 {
  margin: 0;
  font-size: 18px;
}

.feature-showcase-card p,
.flow-step p,
.sample-body p {
  margin: 10px 0 0;
  color: var(--text-subtle);
  line-height: 1.8;
}

.flow-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.flow-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

.sample-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.sample-card {
  display: grid;
  gap: 14px;
}

.sample-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #dbe4ef;
}

.sample-body {
  display: grid;
  gap: 8px;
}

.sample-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.class-item {
  display: flex;
  gap: 12px;
  align-items: center;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 14px;
  color: var(--text-main);
}

.field select,
.admin-auth input {
  width: 100%;
  min-height: 40px;
  border: 1px solid #d5deea;
  border-radius: 6px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--text-main);
  font-size: 14px;
}

.panel-control {
  min-width: 240px;
}

.toggle-field {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #d5deea;
  border-radius: 6px;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toggle-field input {
  margin: 0;
}

.upload-box {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px dashed #b5c4d8;
  border-radius: 10px;
  background: #fafcff;
  cursor: pointer;
}

.upload-box input {
  display: none;
}

.upload-box span {
  color: var(--text-main);
  font-size: 15px;
}

.upload-box small {
  color: var(--text-subtle);
}

.small-upload-box {
  min-height: 124px;
}

.tip-box {
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid transparent;
  line-height: 1.8;
}

.success-box {
  background: #effdf5;
  border-color: #bbf7d0;
  color: #166534;
}

.warning-box {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: #9a3412;
}

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

.result-card {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: #fcfdff;
  padding: 16px;
}

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

.main-label {
  margin: 6px 0 0;
  font-size: 26px;
  font-weight: 700;
}

.main-score {
  margin: 6px 0 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.model-mode {
  margin: 0 0 14px;
  color: var(--text-subtle);
  line-height: 1.8;
}

.annotated-wrapper {
  margin: 14px 0;
}

.annotated-wrapper img,
#preview-image,
.history-thumb {
  border-radius: 8px;
  border: 1px solid #dbe4ef;
}

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

.detection-item strong {
  display: block;
  margin-bottom: 8px;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.stat-card p {
  margin: 8px 0 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.history-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.history-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  margin-bottom: 12px;
}

.admin-auth {
  max-width: 520px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.admin-hint {
  margin: 12px 0 0;
}

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

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

.comparison-table th,
.comparison-table td {
  border-bottom: 1px solid var(--panel-border);
  padding: 12px 10px;
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

.comparison-table th {
  color: var(--text-subtle);
  background: #f8fafc;
  font-weight: 600;
}

.report-metric-grid {
  margin-bottom: 16px;
}

.camera-box {
  min-height: 280px;
  border: 1px solid #dbe4ef;
  border-radius: 10px;
  overflow: hidden;
  background: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
}

#camera-video {
  width: 100%;
  min-height: 280px;
  object-fit: cover;
}

.hidden {
  display: none !important;
}

@media (max-width: 1080px) {
  .dashboard-shell {
    grid-template-columns: 180px 1fr;
  }
}

@media (max-width: 900px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-template-rows: auto auto auto;
    gap: 16px;
  }

  .sidebar-nav {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .topbar,
  .page-hero,
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-aside {
    min-width: 100%;
    max-width: none;
  }

  .result-grid,
  .two-col-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .content-area {
    padding: 16px;
  }

  .topbar {
    padding: 14px 16px;
  }

  .sidebar {
    padding: 18px 14px;
  }

  .history-grid,
  .stats-grid,
  .class-grid,
  .overview-grid,
  .feature-showcase-grid,
  .flow-grid,
  .sample-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .result-main {
    grid-template-columns: 1fr;
  }
}

/* 2026-04 UI polish: denser defense-demo workspace, clearer actions, safer mobile layout. */
:root {
  --sidebar-bg: #172235;
  --sidebar-text: #eef5ff;
  --sidebar-muted: #a7b4c6;
  --sidebar-active: #2f80ff;
  --app-bg: #eef3f8;
  --panel-bg: #ffffff;
  --panel-border: #dbe4ef;
  --text-main: #132033;
  --text-subtle: #5d6b7d;
  --text-soft: #8da0b6;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #159c61;
  --danger: #dc2626;
  --radius-sm: 8px;
  --radius-md: 10px;
  --shadow: 0 14px 38px rgba(30, 49, 79, 0.09);
}

body {
  letter-spacing: 0;
}

.dashboard-shell {
  grid-template-columns: 248px minmax(0, 1fr);
  background:
    linear-gradient(180deg, rgba(239, 246, 255, 0.9), rgba(238, 243, 248, 0.9)),
    var(--app-bg);
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  padding: 20px 16px;
  background:
    linear-gradient(180deg, #172235 0%, #1f3047 54%, #182234 100%);
  box-shadow: 6px 0 26px rgba(15, 23, 42, 0.14);
}

.sidebar-brand {
  align-items: flex-start;
  padding: 6px 8px 18px;
}

.sidebar-brand strong {
  font-size: 16px;
  line-height: 1.35;
}

.sidebar-brand span,
.sidebar-meta {
  font-size: 12px;
}

.brand-mark {
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #38bdf8, #22c55e);
  box-shadow: 0 10px 24px rgba(34, 197, 94, 0.28);
}

.sidebar-nav {
  gap: 8px;
}

.sidebar-link {
  min-height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.1);
}

.sidebar-link.is-active {
  background: linear-gradient(135deg, rgba(47, 128, 255, 0.28), rgba(34, 197, 94, 0.16));
  border-color: rgba(147, 197, 253, 0.28);
  box-shadow: inset 3px 0 0 #38bdf8;
}

.nav-icon {
  border-radius: 4px;
  transform: rotate(45deg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 72px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.topbar-label,
.page-tag,
.section-tag {
  letter-spacing: 0;
  font-weight: 700;
}

.topbar-title {
  font-size: 22px;
}

.topbar-user {
  padding: 8px 12px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: #f8fbff;
}

.user-avatar {
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #2563eb, #22c55e);
}

.content-area {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
  gap: 18px;
}

.page-hero,
.panel {
  border-radius: var(--radius-md);
  border-color: var(--panel-border);
  box-shadow: var(--shadow);
}

.page-hero {
  position: relative;
  overflow: hidden;
  padding: 26px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(34, 197, 94, 0.07)),
    #ffffff;
}

.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(15, 23, 42, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 23, 42, 0.05) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.22), transparent 70%);
}

.page-hero > * {
  position: relative;
}

.page-hero h2 {
  max-width: 860px;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.18;
  letter-spacing: 0;
}

.page-desc {
  max-width: 900px;
  line-height: 1.75;
}

.hero-aside {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: none;
}

.panel {
  padding: 20px;
}

.panel-head {
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #edf2f7;
}

.panel-head h2,
.result-card h3,
.feature-showcase-card h3,
.overview-card h3,
.flow-step h3,
.sample-body h3 {
  letter-spacing: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 700;
  line-height: 1.2;
  white-space: normal;
  text-align: center;
  box-shadow: none;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.btn::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.78;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.22);
}

.btn-secondary {
  background: #ffffff;
  color: #1f3b64;
  border-color: #cbd8e8;
}

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

.btn-primary:hover {
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.28);
}

.btn-secondary:hover {
  border-color: #8fb2df;
  background: #f8fbff;
}

.btn:focus-visible,
.sidebar-link:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.page-actions,
.hero-actions,
.compact-actions,
.sample-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.metric-grid,
.sample-grid,
.feature-showcase-grid,
.flow-grid,
.overview-grid,
.history-grid,
.stats-grid,
.class-grid {
  gap: 14px;
}

.metric-card,
.sample-card,
.feature-showcase-card,
.flow-step,
.overview-card,
.class-item,
.stat-card,
.history-card,
.result-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(30, 49, 79, 0.05);
}

.metric-card,
.feature-showcase-card,
.flow-step,
.overview-card,
.class-item,
.stat-card,
.history-card {
  padding: 16px;
}

.sample-card {
  overflow: hidden;
}

.sample-thumb,
.history-thumb,
#preview-image,
.annotated-wrapper img {
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.sample-thumb {
  border-radius: 0;
}

.sample-body {
  padding: 14px 14px 0;
}

.sample-actions {
  padding: 14px;
}

.sample-actions .btn,
.upload-form > .btn,
#refresh-history,
#admin-login,
#start-camera,
#capture-camera,
#batch-form .btn,
#stress-form .btn {
  min-width: 150px;
}

.upload-form {
  gap: 14px;
}

.form-grid {
  align-items: end;
}

.field span,
.toggle-field span {
  font-weight: 700;
}

.field select {
  min-height: 42px;
  border-radius: var(--radius-sm);
}

.toggle-field {
  min-height: 42px;
  border-radius: var(--radius-sm);
  background: #f8fbff;
}

.upload-box {
  position: relative;
  min-height: 128px;
  padding: 22px;
  border-radius: var(--radius-md);
  border: 1.5px dashed #9fb5d0;
  background: linear-gradient(180deg, #fbfdff, #f4f8fe);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.upload-box::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: #e8f1ff;
  color: var(--primary);
  font-size: 24px;
  font-weight: 800;
}

.upload-box:hover {
  border-color: var(--primary);
  background: #f7fbff;
  transform: translateY(-1px);
}

.upload-box span {
  font-weight: 700;
}

.tip-box {
  border-radius: var(--radius-md);
}

.result-grid,
.two-col-grid {
  gap: 16px;
  align-items: start;
}

.result-main {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #f8fbff;
}

.main-label,
.main-score,
.metric-value {
  letter-spacing: 0;
}

.detection-item {
  padding: 12px;
  border: 1px solid #e5edf7;
  border-radius: var(--radius-sm);
  background: #fbfdff;
}

.status-pill {
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.camera-box {
  border-radius: var(--radius-md);
}

.comparison-table th {
  white-space: nowrap;
}

.admin-password-field {
  margin: 0;
}

.admin-password-field input {
  margin-bottom: 0;
}

.auth-status {
  min-height: 22px;
}

.auth-status-success {
  color: #14734d;
}

.auth-status-warning {
  color: #9a5a13;
}

.auth-status-error {
  color: var(--danger);
}

.btn:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

@media (max-width: 1080px) {
  .dashboard-shell {
    grid-template-columns: 214px minmax(0, 1fr);
  }

  .content-area {
    padding: 22px;
  }
}

@media (max-width: 900px) {
  .dashboard-shell {
    display: block;
  }

  .sidebar {
    position: static;
    min-height: auto;
    padding: 14px;
  }

  .sidebar-brand {
    padding-bottom: 12px;
  }

  .sidebar-meta {
    display: none;
  }

  .topbar {
    position: static;
  }

  .page-hero {
    padding: 20px;
  }

  .panel {
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .content-area {
    padding: 14px;
    gap: 14px;
  }

  .topbar-user {
    width: 100%;
  }

  .btn,
  .page-actions .btn,
  .hero-actions .btn,
  .sample-actions .btn,
  .upload-form > .btn,
  #admin-login,
  #refresh-history {
    width: 100%;
  }

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

  .admin-auth {
    grid-template-columns: 1fr;
  }

  .upload-box {
    min-height: 116px;
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
