:root {
  --bg: #080705;
  --panel: #15120c;
  --panel-2: #1e190f;
  --text: #f8efd7;
  --muted: #b9ad90;
  --gold: #f0bd45;
  --gold-2: #b97f23;
  --line: rgba(240, 189, 69, 0.25);
  --soft-line: rgba(255, 255, 255, 0.08);
  --green: #7da552;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    radial-gradient(circle at 76% 8%, rgba(240, 189, 69, 0.18), transparent 28rem),
    linear-gradient(135deg, var(--bg), #12100a 55%, #080705);
  background-size: 42px 42px, 42px 42px, auto, auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.admin-sidebar,
.admin-shell {
  display: none;
}

body.admin-unlocked .admin-sidebar {
  display: block;
}

body.admin-unlocked .admin-shell {
  display: block;
}

.admin-gate {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: clamp(1rem, 4vw, 2rem);
}

body.admin-unlocked .admin-gate {
  display: none;
}

.admin-gate-card {
  width: min(100%, 34rem);
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(240, 189, 69, 0.12), transparent 48%),
    rgba(17, 14, 9, 0.95);
  box-shadow: var(--shadow);
}

.admin-gate-card h1 {
  margin-bottom: 0.75rem;
}

.gate-copy,
.gate-status {
  color: var(--muted);
  line-height: 1.7;
}

.admin-gate-card label {
  display: grid;
  gap: 0.45rem;
  margin: 1.4rem 0 0.9rem;
  color: var(--muted);
  font-weight: 800;
}

.admin-gate-card input {
  width: 100%;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 0.95rem 1rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.admin-gate-card .button {
  width: 100%;
}

.gate-secondary-action {
  margin-top: 0.75rem;
}

.password-reset-panel {
  margin-top: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.password-reset-panel p {
  margin: 0.4rem 0 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}

.gate-back {
  display: inline-flex;
  margin-top: 1rem;
  color: var(--gold);
  font-weight: 900;
}

.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 17rem;
  padding: 1.25rem;
  border-right: 1px solid var(--line);
  background: rgba(9, 8, 5, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 2rem;
}

.brand-mark {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--gold), var(--gold-2));
  color: #100b02;
  font-family: Cinzel, serif;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 0.15rem;
  color: var(--muted);
}

.admin-sidebar nav {
  display: grid;
  gap: 0.45rem;
}

.admin-sidebar nav a {
  padding: 0.85rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}

.admin-sidebar nav a.active,
.admin-sidebar nav a:hover {
  border-color: var(--line);
  color: var(--gold);
  background: rgba(240, 189, 69, 0.08);
}

.admin-shell {
  margin-left: 17rem;
  padding: clamp(1rem, 3vw, 2.25rem);
}

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  min-height: 14rem;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(240, 189, 69, 0.12), transparent 42%),
    rgba(17, 14, 9, 0.92);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: Cinzel, Georgia, serif;
}

h1 {
  max-width: 44rem;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.98;
}

h2 {
  font-size: clamp(1.3rem, 2vw, 2rem);
}

.header-actions,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.button {
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.button.primary {
  background: linear-gradient(145deg, var(--gold), var(--gold-2));
  color: #130d02;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}

.metric-grid,
.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.metric-grid article,
.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 13, 9, 0.9);
}

.metric-grid article {
  padding: 1rem;
}

.metric-grid span,
.metric-grid small {
  display: block;
  color: var(--muted);
}

.metric-grid strong {
  display: block;
  margin: 0.4rem 0;
  font-size: 1.45rem;
}

.admin-panel {
  margin-top: 1rem;
  padding: 1rem;
}

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

.status-pill {
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(125, 165, 82, 0.35);
  border-radius: 999px;
  color: var(--green);
  font-weight: 900;
  background: rgba(125, 165, 82, 0.1);
}

.status-pill.connected {
  border-color: rgba(125, 165, 82, 0.55);
  background: rgba(125, 165, 82, 0.18);
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(16rem, 1fr) minmax(16rem, 0.65fr) auto;
  gap: 1rem;
  align-items: end;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.auth-panel strong,
.auth-panel span {
  display: block;
}

.auth-panel span {
  margin-top: 0.35rem;
  color: var(--muted);
  line-height: 1.45;
}

.auth-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.price-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 0.35fr) 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.mills-editor,
.price-table,
.shortcut-list,
.settings-grid {
  display: grid;
  gap: 0.75rem;
}

label {
  color: var(--muted);
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 2.6rem;
  margin-top: 0.35rem;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  padding: 0 0.75rem;
}

select option {
  color: #111;
}

.money-input {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  align-items: end;
}

.money-input span {
  display: grid;
  min-height: 2.6rem;
  margin-top: 0.35rem;
  place-items: center;
  border: 1px solid var(--soft-line);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: rgba(240, 189, 69, 0.1);
  color: var(--gold);
}

.money-input input {
  border-radius: 0 8px 8px 0;
}

.quote-preview {
  padding: 1rem;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: rgba(240, 189, 69, 0.08);
}

.quote-preview span,
.quote-preview strong {
  display: block;
}

.quote-preview strong {
  margin-top: 0.3rem;
  font-size: 1.6rem;
  color: var(--gold);
}

.table-row {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 0.7fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
}

.table-head {
  color: var(--gold);
  font-weight: 900;
  background: rgba(240, 189, 69, 0.08);
}

.shortcut-list label,
.toggle-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  min-height: 2.9rem;
  padding: 0.75rem;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
}

.shortcut-list input,
.toggle-row input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.toggle-row strong {
  color: var(--gold);
}

.proof-manager {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.account-admin-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.account-admin-form .wide-field {
  grid-column: span 3;
}

.account-form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  grid-column: span 3;
}

.account-admin-form textarea {
  width: 100%;
  min-height: 7rem;
  margin-top: 0.35rem;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  padding: 0.75rem;
  resize: vertical;
}

.account-admin-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.analytics-list {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}

.analytics-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.analytics-row span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.analytics-row strong {
  color: var(--gold);
  white-space: nowrap;
}

.account-admin-item,
.account-empty {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.account-empty {
  align-items: start;
  flex-direction: column;
}

.account-admin-item strong,
.account-admin-item span,
.account-empty strong,
.account-empty span {
  display: block;
}

.account-admin-item span,
.account-empty span {
  margin-top: 0.25rem;
  color: var(--muted);
}

.account-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.proof-manager article {
  overflow: hidden;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.proof-manager img {
  width: 100%;
  height: 11rem;
  object-fit: cover;
  display: block;
}

.proof-manager strong,
.proof-manager span {
  display: block;
  padding: 0 0.8rem;
}

.proof-manager strong {
  padding-top: 0.75rem;
}

.proof-manager span {
  padding-bottom: 0.85rem;
  color: var(--muted);
}

.settings-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1rem;
}

.save-panel {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.save-panel span {
  color: var(--muted);
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 13, 9, 0.95);
  color: var(--gold);
  box-shadow: var(--shadow);
  transform: translateY(150%);
  transition: transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
}

@media (max-width: 980px) {
  .admin-sidebar {
    position: static;
    width: auto;
  }

  .admin-shell {
    margin-left: 0;
  }

  .metric-grid,
  .price-layout,
  .admin-grid,
  .account-admin-form,
  .proof-manager,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .account-admin-form .wide-field {
    grid-column: auto;
  }

  .account-form-actions {
    align-items: stretch;
    flex-direction: column;
    grid-column: auto;
  }

  .admin-header,
  .auth-panel,
  .save-panel,
  .panel-heading {
    align-items: start;
    flex-direction: column;
  }

  .auth-panel {
    display: grid;
    grid-template-columns: 1fr;
  }
}
