:root {
  --bg: #f4efe6;
  --panel: rgba(255, 252, 246, 0.84);
  --panel-strong: #fffaf2;
  --line: rgba(34, 34, 34, 0.1);
  --text: #231815;
  --muted: #6a5c54;
  --accent: #d05a2f;
  --accent-strong: #ab3f18;
  --ok: #0d8b61;
  --warn: #b36a10;
  --shadow: 0 24px 80px rgba(64, 35, 18, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(208, 90, 47, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(13, 139, 97, 0.14), transparent 25%),
    linear-gradient(180deg, #f7f2e9 0%, #efe6d6 100%);
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 28px auto 48px;
}

.hero {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.4fr 0.9fr;
  align-items: stretch;
}

.card {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.headline {
  padding: 28px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(35, 24, 21, 0.06);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 16px 0 8px;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 0.96;
}

.headline p {
  margin: 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.summary {
  padding: 22px;
  display: grid;
  gap: 14px;
}

a.action-button {
  text-decoration: none;
}

.summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-grid-triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric {
  padding: 16px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.metric-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric-value {
  font-size: 34px;
  line-height: 1;
}

.toolbar {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

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

.action-button {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 14px;
  padding: 12px 18px;
  min-height: 46px;
  font: inherit;
  font-size: 15px;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.action-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.action-button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.action-button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 148px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff9f4;
}

#sync-channels-button {
  width: 100%;
}

.action-button.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 148px;
  background: rgba(35, 24, 21, 0.06);
  color: var(--text);
}

.table-card {
  margin-top: 18px;
  overflow: hidden;
}

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

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

.col-channel {
  width: 31%;
}

.col-enable {
  width: 20%;
}

.col-access {
  width: 15%;
}

.col-actions {
  width: 34%;
}

th,
td {
  padding: 18px 22px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

tr:last-child td {
  border-bottom: 0;
}

.channel-name {
  font-size: 18px;
  margin-bottom: 4px;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.status-on {
  background: rgba(13, 139, 97, 0.12);
  color: var(--ok);
}

.status-off {
  background: rgba(179, 106, 16, 0.14);
  color: var(--warn);
}

.status-access {
  background: rgba(35, 24, 21, 0.08);
  color: var(--text);
}

.status-no-access {
  background: rgba(104, 92, 84, 0.14);
  color: var(--muted);
}

.channel-row-inactive {
  background: rgba(35, 24, 21, 0.03);
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 168px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.toggle-switch:disabled {
  cursor: wait;
  opacity: 0.56;
}

.toggle-track {
  position: relative;
  width: 52px;
  height: 32px;
  border-radius: 999px;
  background: rgba(35, 24, 21, 0.18);
  transition: background 160ms ease;
  box-shadow: inset 0 0 0 1px rgba(35, 24, 21, 0.08);
}

.toggle-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fffdf9;
  box-shadow: 0 6px 16px rgba(35, 24, 21, 0.18);
  transition: transform 160ms ease;
}

.toggle-switch.is-on .toggle-track {
  background: linear-gradient(135deg, #0d8b61, #0b6f4e);
}

.toggle-switch.is-on .toggle-thumb {
  transform: translateX(20px);
}

.toggle-copy {
  display: inline-flex;
  align-items: center;
  min-width: 92px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 46px;
}

.empty-state {
  padding: 34px 28px 40px;
  color: var(--muted);
}

.error-shell {
  display: grid;
  align-items: center;
  min-height: 100vh;
  margin-top: 0;
  margin-bottom: 0;
}

.error-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.7fr);
  align-items: stretch;
}

.error-card,
.error-detail-card {
  padding: 28px;
}

.error-code {
  margin-top: 22px;
  font-size: clamp(88px, 16vw, 172px);
  line-height: 0.88;
  letter-spacing: -0.05em;
  color: var(--accent);
}

.error-card h1 {
  margin: 18px 0 10px;
}

.error-card p,
.error-note {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

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

.error-route {
  display: block;
  font-size: 24px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.error-note {
  margin-top: 18px;
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 12px;
  width: min(360px, calc(100vw - 32px));
  z-index: 1000;
}

.toast {
  border-radius: 16px;
  padding: 14px 16px;
  color: #fffdf8;
  box-shadow: 0 18px 40px rgba(35, 24, 21, 0.22);
  animation: slideUp 220ms ease;
}

.toast.success {
  background: linear-gradient(135deg, #0d8b61, #0b6f4e);
}

.toast.error {
  background: linear-gradient(135deg, #c24621, #84270d);
}

.toast.info {
  background: linear-gradient(135deg, #5a524d, #2f2a27);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .error-layout {
    grid-template-columns: 1fr;
  }

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

  th,
  td {
    padding: 16px 14px;
  }
}
