:root {
  color-scheme: dark;
  --red: #D00000;
  --amber: #FFBA08;
  --dark: #080F0F;
  --paper: #FFFCF9;
  --blue: #0496FF;
  --brand: #D00000;
  --brand-2: #A90000;
  --brand-soft: rgba(208, 0, 0, .18);
  --bg: #080F0F;
  --panel: #101818;
  --panel-2: #0c1414;
  --panel-3: #162020;
  --text: #FFFCF9;
  --muted: rgba(255, 252, 249, .66);
  --line: rgba(255, 252, 249, .13);
  --accent: #D00000;
  --accent-2: #FFBA08;
  --danger: #D00000;
  --ok: #34d399;
  --shadow: 0 24px 80px rgba(0, 0, 0, .42);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% -12%, rgba(208, 0, 0, .42), transparent 34rem),
    radial-gradient(circle at 86% 2%, rgba(255, 186, 8, .16), transparent 32rem),
    linear-gradient(135deg, #080F0F 0%, #0d1515 54%, #120b0b 100%);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

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

.small-text {
  font-size: 12px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(470px, 100%);
  padding: 34px;
  border: 1px solid rgba(208, 0, 0, .38);
  border-top: 5px solid var(--brand);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(16, 24, 24, .96), rgba(8, 15, 15, .94));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand {
  align-items: flex-start;
  margin-bottom: 20px;
}

.brand-logo {
  width: 76px;
  height: 76px;
  object-fit: contain;
  border-radius: 18px;
  background: var(--red);
  box-shadow: 0 14px 36px rgba(208, 0, 0, .28);
}

.brand-logo.small {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  flex: 0 0 auto;
}

.brand-badge {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: var(--paper);
  font-weight: 900;
  letter-spacing: .04em;
}

.brand-badge.small {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.login-card h1,
.topbar h1,
.sidebar h2,
.editor-header h2 {
  margin: 14px 0 4px;
  line-height: 1.1;
}

.login-card h1 {
  margin-top: 4px;
}

.login-card p {
  margin-top: 0;
}

label {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  color: var(--muted);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 252, 249, .055);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(208, 0, 0, .86);
  box-shadow: 0 0 0 4px rgba(208, 0, 0, .16);
}

button {
  border: 0;
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--text);
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease, box-shadow .12s ease;
}

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

button:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: var(--paper);
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(208, 0, 0, .28);
}

.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 252, 249, .055);
}

.ghost:hover {
  border-color: rgba(208, 0, 0, .44);
  background: rgba(208, 0, 0, .12);
}

.danger {
  border: 1px solid rgba(208, 0, 0, .58);
  background: rgba(208, 0, 0, .16);
  color: #ffd7d7;
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 252, 249, .055);
  font-size: 22px;
}

.full {
  width: 100%;
}

.error {
  min-height: 20px;
  color: #ffd7d7;
}

.app-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid rgba(208, 0, 0, .25);
  background: linear-gradient(180deg, rgba(8, 15, 15, .94), rgba(14, 18, 18, .88));
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.logo-row h2 {
  margin: 0;
}

.logo-row p {
  margin: 4px 0 0;
}

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

.tab {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-weight: 750;
}

.tab.active {
  background: linear-gradient(90deg, rgba(208, 0, 0, .34), rgba(208, 0, 0, .10));
  border-color: rgba(208, 0, 0, .55);
  color: var(--paper);
  box-shadow: inset 4px 0 0 var(--brand);
}

.content {
  min-width: 0;
  padding: 28px;
}

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

.topbar h1,
.topbar p {
  margin: 0;
}

.actions,
.toolbar,
.pager,
.editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar {
  margin-bottom: 14px;
}

.toolbar input {
  max-width: 560px;
}

.toolbar select {
  max-width: 150px;
}

.table-card {
  border: 1px solid rgba(208, 0, 0, .22);
  border-top: 4px solid var(--brand);
  border-radius: var(--radius);
  background: rgba(16, 24, 24, .88);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 210px);
}

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

th,
td {
  padding: 11px 13px;
  border-bottom: 1px solid rgba(255, 252, 249, .09);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #080F0F;
  color: rgba(255, 252, 249, .84);
  font-size: 12px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

tr {
  cursor: pointer;
}

tbody tr:hover {
  background: rgba(208, 0, 0, .10);
}

td.boolean {
  text-align: center;
}

.bool-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 252, 249, .10);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.bool-pill.yes {
  background: rgba(255, 186, 8, .16);
  color: var(--amber);
}

.pager {
  justify-content: center;
  padding: 14px;
}

.editor-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(620px, 96vw);
  height: 100vh;
  padding: 22px;
  transform: translateX(105%);
  transition: transform .2s ease;
  border-left: 1px solid rgba(208, 0, 0, .28);
  background: rgba(8, 15, 15, .98);
  box-shadow: var(--shadow);
  z-index: 20;
  display: flex;
  flex-direction: column;
}

.editor-panel.open {
  transform: translateX(0);
}

.editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.editor-header h2,
.editor-header p {
  margin: 0;
}

.edit-form {
  flex: 1;
  overflow: auto;
  padding: 12px 2px 20px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 16px 0;
  color: var(--text);
}

.checkbox-row input {
  width: auto;
  accent-color: var(--brand);
}

.readonly {
  opacity: .68;
}

.editor-actions {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.spacer {
  flex: 1;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  max-width: 420px;
  padding: 13px 15px;
  border: 1px solid rgba(208, 0, 0, .42);
  border-radius: 16px;
  background: rgba(8, 15, 15, .95);
  color: var(--paper);
  box-shadow: var(--shadow);
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .topbar,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

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