:root {
  color-scheme: dark;
  --bg: #000000;
  --panel: rgba(8, 14, 24, 0.92);
  --panel-soft: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(0, 174, 239, 0.4);
  --text: #f5f9ff;
  --muted: rgba(245, 249, 255, 0.65);
  --accent: #00aeef;
  --accent-strong: #0b59ff;
  --danger: #ff5e7a;
  --success: #38d39f;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(0, 174, 239, 0.2), transparent 22%),
    radial-gradient(circle at bottom left, rgba(11, 89, 255, 0.15), transparent 25%),
    var(--bg);
  color: var(--text);
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.015), transparent 30%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.02), transparent 60%);
}

.app-shell {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar,
.panel,
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.topbar {
  border-radius: 28px;
  padding: 24px 28px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
}

.topbar h1,
.panel h2 {
  margin: 6px 0 8px;
  font-size: 30px;
  line-height: 1.05;
}

.topbar p,
.panel-header p,
.field span,
.stat-label {
  color: var(--muted);
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  font-weight: 800;
}

.dashboard {
  margin-top: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  border-radius: 24px;
  padding: 20px 22px;
}

.stat-value {
  margin-top: 12px;
  font-size: 34px;
  font-weight: 900;
}

.stat-value.small {
  font-size: 20px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.12fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

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

.panel {
  border-radius: 28px;
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.primary-button,
.ghost-button,
.danger-button,
.table-button,
select,
input,
textarea {
  transition:
    transform 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease,
    background-color 220ms ease,
    opacity 220ms ease;
}

.primary-button,
.ghost-button,
.danger-button,
.table-button {
  border-radius: 16px;
  border: 1px solid transparent;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  color: #001019;
  background: linear-gradient(135deg, var(--accent), #63d6ff);
  box-shadow: 0 14px 28px rgba(0, 174, 239, 0.28);
}

.ghost-button,
.table-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}

.danger-button {
  color: #fff0f4;
  background: rgba(255, 94, 122, 0.14);
  border-color: rgba(255, 94, 122, 0.25);
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
}

.primary-button:hover,
.primary-button:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible,
.table-button:hover,
.table-button:focus-visible,
.danger-button:hover,
.danger-button:focus-visible,
select:focus,
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(0, 174, 239, 0.14);
}

.stack-form,
.editor-form {
  margin-top: 18px;
  display: grid;
  gap: 16px;
}

.editor-form {
  margin-bottom: 22px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

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

.full-width {
  grid-column: 1 / -1;
}

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

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

.field span {
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
}

.toggle-row,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.table-shell {
  overflow: auto;
  border-radius: 22px;
  border: 1px solid var(--line);
}

.table-shell .inline-note,
.muted {
  color: var(--muted);
}

.empty-state {
  padding: 22px;
  color: var(--muted);
}

.as-link {
  text-decoration: none;
}

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

thead {
  background: rgba(255, 255, 255, 0.04);
}

th,
td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

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

.badge {
  background: rgba(0, 174, 239, 0.14);
  color: var(--accent);
}

.status-pill.active {
  background: rgba(56, 211, 159, 0.14);
  color: var(--success);
}

.status-pill.inactive {
  background: rgba(255, 94, 122, 0.14);
  color: var(--danger);
}

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

.toast {
  position: sticky;
  top: 16px;
  z-index: 10;
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(4, 18, 28, 0.96);
  border: 1px solid rgba(0, 174, 239, 0.24);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.login-panel {
  max-width: 520px;
  margin: 28px auto 0;
}

.hidden {
  display: none !important;
}

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

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 24px, 1480px);
    padding-top: 16px;
  }

  .topbar {
    padding: 20px;
    flex-direction: column;
  }

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