:root {
  --bg: #07111f;
  --panel: rgba(14, 24, 42, 0.92);
  --line: rgba(255, 255, 255, 0.1);
  --text: #ebf1fb;
  --soft: #aab7d0;
  --gold: #d1a954;
  --danger: #f07f7f;
  --bg-grad-start: #07111f;
  --bg-grad-end: #081522;
  --lock-bg: rgba(4, 10, 18, 0.88);
  --sidebar-bg: rgba(7, 17, 31, 0.95);
  --surface-muted: rgba(255, 255, 255, 0.04);
  --font-body: "Manrope", system-ui, sans-serif;
  --font-display: "Playfair Display", Georgia, serif;
}

[data-theme="light"] {
  --bg: #f8fafc;
  --panel: rgba(255, 255, 255, 0.92);
  --line: rgba(15, 23, 42, 0.14);
  --text: #0f172a;
  --soft: #475569;
  --bg-grad-start: #f8fafc;
  --bg-grad-end: #eef4fb;
  --lock-bg: rgba(231, 237, 246, 0.92);
  --sidebar-bg: rgba(247, 250, 255, 0.98);
  --surface-muted: rgba(15, 23, 42, 0.03);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(209, 169, 84, 0.14), transparent 26%),
    linear-gradient(180deg, var(--bg-grad-start) 0%, var(--bg-grad-end) 100%);
  color: var(--text);
}

html,
body {
  scroll-behavior: smooth;
}

.admin-theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 130;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.admin-lock {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--lock-bg);
  backdrop-filter: blur(12px);
}

.admin-lock.hidden {
  display: none;
}

.admin-lock-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
}

.admin-login-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.admin-login-form input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--text);
  outline: none;
}

.admin-login-status {
  min-height: 24px;
  margin-top: 12px;
  color: var(--soft);
}

h1,
h2,
h3 {
  margin: 0;
}

h1,
h2 {
  font-family: var(--font-display);
}

.admin-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  padding: 28px;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(209, 169, 84, 0.14);
  color: #f7dd9e;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-sidebar p {
  color: var(--soft);
  line-height: 1.7;
}

.admin-actions-stack {
  display: grid;
  gap: 12px;
  margin: 28px 0;
}

.primary-btn,
.ghost-btn,
.small-btn,
.remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.primary-btn {
  background: linear-gradient(135deg, #f1cd83, var(--gold));
  color: #101010;
}

.ghost-btn,
.small-btn {
  background: var(--surface-muted);
  border-color: var(--line);
  color: var(--text);
}

.ghost-btn.danger,
.remove-btn {
  color: var(--danger);
  border-color: rgba(240, 127, 127, 0.28);
  background: rgba(240, 127, 127, 0.08);
}

.admin-note {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.firebase-sync-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: #f1cd83;
  box-shadow: 0 0 0 5px rgba(241, 205, 131, 0.14);
}

.firebase-sync-status .status-label {
  display: block;
  font-size: 0.9rem;
}

.firebase-sync-status .status-detail {
  margin: 3px 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--soft);
}

.firebase-sync-status[data-state="connected"] .status-dot {
  background: #68d391;
  box-shadow: 0 0 0 5px rgba(104, 211, 145, 0.18);
}

.firebase-sync-status[data-state="connected"] .status-label {
  color: #92f5ca;
}

.firebase-sync-status[data-state="offline"] .status-dot {
  background: #f07f7f;
  box-shadow: 0 0 0 5px rgba(240, 127, 127, 0.18);
}

.firebase-sync-status[data-state="offline"] .status-label {
  color: #ff9d9d;
}

.admin-status {
  margin-top: 18px;
  min-height: 24px;
}

.admin-main {
  padding: 28px;
  display: grid;
  gap: 20px;
}

.admin-panel,
.edit-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
}

.admin-panel {
  padding: 24px;
}

.panel-head,
.edit-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.editor-stack {
  display: grid;
  gap: 16px;
}

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

.edit-card {
  padding: 18px;
}

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

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

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

.field label {
  color: var(--soft);
  font-size: 0.84rem;
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--surface-muted);
  color: var(--text);
  outline: none;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

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

  .admin-sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .editor-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .admin-main,
  .admin-sidebar {
    padding: 18px;
  }

  h1 {
    font-size: 1.55rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  h3 {
    font-size: 1.08rem;
  }

  .admin-panel,
  .edit-card,
  .admin-lock-card {
    border-radius: 18px;
  }

  .admin-panel,
  .edit-card,
  .admin-lock-card {
    padding: 16px;
  }

  .primary-btn,
  .ghost-btn,
  .small-btn,
  .remove-btn,
  .admin-login-form input {
    min-height: 44px;
    font-size: 0.94rem;
  }

  .panel-head,
  .edit-card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-actions-stack .primary-btn,
  .admin-actions-stack .ghost-btn,
  .small-btn,
  .remove-btn {
    width: 100%;
  }

  .admin-theme-toggle {
    top: 10px;
    right: 10px;
  }
}
