:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --panel: #ffffff;
  --border: #d9dee3;
  --text: #14202b;
  --muted: #5c6873;
  --accent: #0f6cbd;
  --success: #2d8a34;
  --warning: #c28b00;
  --danger: #ba2d2d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 20px 56px;
}

.admin-shell {
  max-width: none;
  min-width: 1200px;
  width: 100%;
  padding: 24px 28px 56px;
}

.admin-shell .grid {
  grid-template-columns: minmax(520px, 1fr) minmax(420px, 1fr);
}

.admin-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.hero {
  margin-bottom: 24px;
}

.brand-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fbfd 100%);
  box-shadow: 0 10px 28px rgba(20, 32, 43, 0.07);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: min(390px, 42vw);
  height: auto;
}

.admin-brand-hero .brand-logo {
  width: min(340px, 30vw);
}

.hero-copy {
  min-width: 0;
  max-width: 720px;
}

.hero-eyebrow {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(20, 32, 43, 0.06);
}

.panel h2,
.panel h3 {
  margin-top: 0;
}

.panel p,
.panel li,
.panel label,
.panel span {
  line-height: 1.45;
}

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

.panel-title-row h2 {
  margin: 0;
}

.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 7px 12px;
  border-radius: 999px;
  background: #e9eef3;
  color: #22313f;
  font-size: 0.95rem;
  font-weight: 700;
}

.stack {
  display: grid;
  gap: 12px;
}

.compact-stack {
  gap: 10px;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

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

.field label {
  font-size: 0.95rem;
  font-weight: 700;
}

.field input,
.field select,
.field button,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
}

.admin-config-form {
  gap: 12px;
}

.admin-config-form .field {
  margin-bottom: 0;
}

.config-row {
  display: grid;
  gap: 12px;
  align-items: end;
}

.config-row-main {
  grid-template-columns: 1.1fr 1fr 0.9fr;
}

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

.config-group {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfcfd;
}

.config-group legend {
  padding: 0 6px;
  font-weight: 700;
}

.config-inline-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.compact-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.compact-field label {
  font-weight: 700;
}

.compact-field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
}

.field button,
.actions button,
.row button,
.button-link {
  cursor: pointer;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
}

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

.upload-demo-panel h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.upload-demo-panel .hint,
.compact-preview-panel .hint {
  margin: 0;
  font-size: 0.9rem;
}

.upload-demo-panel .field {
  margin-bottom: 0;
}

.upload-demo-panel .actions {
  gap: 8px;
}

.upload-demo-panel button {
  padding: 10px 12px;
}

.section-divider {
  height: 1px;
  margin: 2px 0;
  background: var(--border);
}

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

.status-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfcfd;
}

.status-item .label,
.preview-detail .label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-item .value,
.preview-detail .value {
  min-width: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.status-mode-item .value {
  display: inline-flex;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e9eef3;
}

.button-secondary {
  background: #445566;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #e9eef3;
  color: #22313f;
  font-weight: 700;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.kpi {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fbfcfd;
}

.kpi .label {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.kpi .value {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
}

.traffic-light {
  display: inline-flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 24px;
  background: #1b1b1b;
}

.light {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #444;
  opacity: 0.3;
}

.light.active.green {
  background: var(--success);
  opacity: 1;
  box-shadow: 0 0 18px rgba(45, 138, 52, 0.5);
}

.light.active.yellow {
  background: var(--warning);
  opacity: 1;
  box-shadow: 0 0 18px rgba(194, 139, 0, 0.5);
}

.light.active.red {
  background: var(--danger);
  opacity: 1;
  box-shadow: 0 0 18px rgba(186, 45, 45, 0.5);
}

.result-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
  align-items: center;
}

.message,
.hint {
  color: var(--muted);
}

.error {
  color: var(--danger);
  font-weight: 700;
}

.ok {
  color: var(--success);
  font-weight: 700;
}

code,
pre {
  font-family: Consolas, "Courier New", monospace;
}

pre {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: #0f1720;
  color: #d7e1ea;
  overflow: auto;
}

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

.admin-shell .table-wrap {
  overflow-x: visible;
}

.log-table {
  width: 100%;
  min-width: 1080px;
  border: 1px solid var(--border);
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-shell .log-table {
  min-width: 0;
  table-layout: fixed;
}

.log-table th,
.log-table td {
  padding: 10px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.log-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f7f9fb;
}

.log-thumb {
  display: block;
  width: 72px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.log-thumb-link {
  display: inline-block;
  cursor: zoom-in;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.admin-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.preview-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fbfcfd;
}

.preview-card h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.preview-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.preview-detail {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
}

.compact-kpis {
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px;
}

.preview-card .kpi {
  padding: 10px;
}

.preview-card .kpi .value {
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.admin-preview-image {
  display: none;
  width: 100%;
  height: 120px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f7f9fb;
}

.compact-preview-panel h2 {
  margin-bottom: 6px;
}

.compact-preview-panel .message,
.upload-demo-panel .message,
.status-panel .message {
  margin: 8px 0 0;
  font-size: 0.9rem;
}

.pagination {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.pagination button {
  cursor: pointer;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.footer-note {
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  .shell {
    padding: 20px 14px 44px;
  }

  .brand-hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
  }

  .brand-logo,
  .admin-brand-hero .brand-logo {
    width: min(320px, 100%);
  }

  .hero h1 {
    font-size: 1.65rem;
  }

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