.admin-body {
  min-height: 100vh;
  color: #161711;
  background:
    linear-gradient(90deg, rgba(22, 23, 17, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(22, 23, 17, 0.045) 1px, transparent 1px),
    #f4f0df;
  background-size: 36px 36px;
}

.admin-body .scanline {
  display: none;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid rgba(22, 23, 17, 0.12);
  color: #f4f0df;
  background: rgba(18, 23, 17, 0.92);
  backdrop-filter: blur(16px);
}

.admin-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 24px;
  width: min(1480px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.admin-sidebar,
.admin-content,
.admin-card,
.admin-panel {
  border: 1px solid rgba(22, 23, 17, 0.14);
  border-radius: 18px 18px 6px 18px;
  background: rgba(255, 252, 238, 0.86);
  box-shadow: 9px 9px 0 rgba(22, 23, 17, 0.08);
}

.admin-sidebar {
  position: sticky;
  top: 86px;
  align-self: start;
  padding: 22px;
}

.admin-kicker {
  margin: 0 0 10px;
  color: #4d5f23;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-sidebar h1 {
  margin-bottom: 20px;
  font-size: clamp(34px, 4vw, 52px);
}

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

.admin-tabs button,
.admin-button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid rgba(22, 23, 17, 0.16);
  border-radius: 10px 10px 4px 10px;
  color: #161711;
  background: rgba(244, 240, 223, 0.7);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.admin-tabs button {
  text-align: left;
}

.admin-tabs button.active,
.admin-button {
  background: var(--green);
}

.admin-button.ghost {
  background: rgba(255, 252, 238, 0.72);
}

.admin-button.saved {
  background: var(--sun);
}

.admin-button.danger {
  color: #f4f0df;
  background: #b8473f;
}

.admin-note {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  padding: 14px;
  border-radius: 12px 12px 4px 12px;
  background: rgba(255, 209, 92, 0.28);
  font-size: 13px;
}

.admin-note span {
  color: #555445;
  font-weight: 800;
}

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

.admin-toolbar,
.entity-bar,
.export-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-toolbar {
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 14px 14px 5px 14px;
  background: rgba(22, 23, 17, 0.05);
}

.admin-toolbar span,
.admin-toolbar strong {
  display: block;
}

.admin-toolbar span {
  color: #5b5b4e;
  font-size: 12px;
  font-weight: 900;
}

.admin-toolbar strong {
  font-size: 18px;
}

.admin-panel {
  display: none;
  padding: clamp(18px, 3vw, 28px);
  box-shadow: none;
}

.admin-panel.active {
  display: block;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin: 0;
  font-size: clamp(32px, 4vw, 56px);
}

.panel-heading p {
  max-width: 440px;
  margin: 0;
  color: #5b5b4e;
  font-weight: 800;
}

.entity-bar {
  margin-bottom: 18px;
  padding: 12px;
  border-radius: 14px 14px 5px 14px;
  background: rgba(22, 23, 17, 0.05);
}

.entity-bar select {
  flex: 1 1 260px;
}

.admin-form {
  display: grid;
  gap: 16px;
}

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

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

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

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

.field label,
.fieldset-title {
  color: #4a4a3e;
  font-size: 13px;
  font-weight: 900;
}

.field small {
  color: #6b6a5b;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(22, 23, 17, 0.16);
  border-radius: 10px 10px 4px 10px;
  color: #161711;
  background: rgba(255, 252, 238, 0.86);
  font: inherit;
  font-weight: 700;
}

input[readonly],
textarea[readonly] {
  color: #6b6a5b;
  background:
    repeating-linear-gradient(-45deg, rgba(22, 23, 17, 0.04) 0 1px, transparent 1px 10px),
    rgba(244, 240, 223, 0.68);
  cursor: not-allowed;
}

input,
select {
  min-height: 42px;
  padding: 8px 10px;
}

textarea {
  min-height: 92px;
  padding: 10px;
  resize: vertical;
}

.mini-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(22, 23, 17, 0.12);
  border-radius: 10px 10px 4px 10px;
  background: rgba(255, 252, 238, 0.6);
  font-weight: 900;
}

.mini-check input {
  width: auto;
  min-height: auto;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(22, 23, 17, 0.1);
  border-radius: 12px 12px 4px 12px;
  background: rgba(22, 23, 17, 0.035);
}

.check-grid .mini-check {
  min-height: 38px;
  background: rgba(255, 252, 238, 0.76);
}

.admin-fieldset {
  padding: 14px;
  border: 1px solid rgba(22, 23, 17, 0.12);
  border-radius: 14px 14px 5px 14px;
  background: rgba(22, 23, 17, 0.035);
}

.system-fields {
  background: rgba(101, 217, 210, 0.12);
}

.system-fields p {
  margin: -2px 0 12px;
  color: #5b5b4e;
  font-size: 13px;
  font-weight: 800;
}

.system-toggle {
  width: fit-content;
  margin-bottom: 12px;
}

.fieldset-title {
  display: block;
  margin-bottom: 12px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}

.code-preview {
  width: 100%;
  min-height: 560px;
  margin-top: 16px;
  color: #f4f0df;
  background: #121711;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.55;
}

.backup-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.backup-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(22, 23, 17, 0.12);
  border-radius: 14px 14px 5px 14px;
  background: rgba(255, 252, 238, 0.72);
}

.backup-item strong,
.backup-item span {
  display: block;
}

.backup-item span,
.empty-state {
  color: #5b5b4e;
  font-size: 13px;
  font-weight: 800;
}

.empty-state {
  margin: 0;
  padding: 14px;
  border-radius: 12px 12px 4px 12px;
  background: rgba(22, 23, 17, 0.05);
}

.supabase-console {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(22, 23, 17, 0.12);
  border-radius: 18px 18px 6px 18px;
  background: linear-gradient(135deg, rgba(101, 217, 210, 0.18), rgba(172, 243, 95, 0.18));
  box-shadow: 8px 8px 0 rgba(22, 23, 17, 0.08);
}

.supabase-copy strong,
.supabase-copy span {
  display: block;
}

.supabase-copy strong {
  margin-bottom: 4px;
  font-size: 18px;
  font-weight: 950;
}

.supabase-copy span {
  color: #5b5b4e;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.supabase-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr)) repeat(4, auto);
  gap: 8px;
  align-items: center;
}

.supabase-actions input {
  min-width: 0;
}

.admin-toast {
  position: fixed;
  right: clamp(16px, 3vw, 32px);
  bottom: 24px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 32px));
  padding: 13px 16px;
  border: 1px solid rgba(22, 23, 17, 0.18);
  border-radius: 14px 14px 5px 14px;
  color: #161711;
  background: var(--green);
  box-shadow: 8px 8px 0 rgba(22, 23, 17, 0.14);
  font-weight: 950;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.admin-toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 960px) {
  .admin-header,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .admin-sidebar {
    position: static;
  }

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

  .form-grid,
  .form-grid.three,
  .backup-item,
  .supabase-console,
  .supabase-actions {
    grid-template-columns: 1fr;
  }
}
