:root {
  --bg: #0b1320;
  --bg-soft: #101a29;
  --panel: #142033;
  --panel-alt: #18273d;
  --line: rgba(209, 184, 131, 0.18);
  --text: #eef3fb;
  --muted: #a9b7ca;
  --gold: #d5b56b;
  --teal: #7ec6c1;
  --danger: #ef8a8a;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(126, 198, 193, 0.1), transparent 34%),
    radial-gradient(circle at top right, rgba(213, 181, 107, 0.08), transparent 28%),
    linear-gradient(180deg, #0a121f, #0f1726 46%, #0b1220);
  color: var(--text);
  font-family: "Noto Sans SC", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
input, select, textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(213, 181, 107, 0.18);
  background: rgba(8, 15, 26, 0.88);
  color: var(--text);
  padding: 10px 12px;
}
textarea { min-height: 96px; resize: vertical; }

.hidden { display: none !important; }
.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-size: 0.76rem;
}
.feedback { min-height: 22px; color: var(--teal); }
.global-feedback { margin-top: 18px; }

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
}
.btn-primary {
  background: linear-gradient(135deg, #d6b46d, #b68d4f);
  color: #24180c;
  font-weight: 700;
}
.btn-secondary {
  background: rgba(126, 198, 193, 0.12);
  border: 1px solid rgba(126, 198, 193, 0.24);
  color: var(--text);
}
.btn-ghost {
  background: transparent;
  border: 1px solid rgba(238, 243, 251, 0.16);
  color: var(--text);
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(720px, 100%);
  padding: 32px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(20, 32, 51, 0.9), rgba(13, 22, 35, 0.96));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 12px; font-family: "Cormorant Garamond", serif; font-size: 2.5rem; }
.auth-desc { margin: 0 0 18px; color: var(--muted); }
.auth-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 12px;
}
.field { display: grid; gap: 6px; color: var(--muted); }

.admin-view {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(9, 15, 25, 0.84);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.sidebar-title { margin: 0; font-family: "Cormorant Garamond", serif; font-size: 2rem; }
.sidebar-nav { display: grid; gap: 8px; margin: 24px 0; }
.nav-btn, .subnav-btn {
  text-align: left;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
}
.nav-btn.active, .subnav-btn.active {
  background: linear-gradient(135deg, rgba(213, 181, 107, 0.16), rgba(126, 198, 193, 0.12));
  border-color: var(--line);
}
.sidebar-user { margin: 0 0 12px; color: var(--muted); word-break: break-all; }

.main-shell { padding: 24px; }
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.topbar h1 { margin: 0; font-size: 2rem; }
.section { display: none; }
.section.active { display: block; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.toolbar.split { justify-content: space-between; }
.toolbar-group { display: flex; flex-wrap: wrap; gap: 10px; }
.check-inline { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); }
.check-inline input { width: auto; }

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 16px;
}
.panel {
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(20, 32, 51, 0.92), rgba(14, 22, 34, 0.94));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(213, 181, 107, 0.12);
}
.panel-head h3 { margin: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.table-wrap { padding: 12px 14px 16px; }
.detail-wrap { padding: 16px; }
.detail-wrap.empty { color: var(--muted); }

.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.metric {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(21, 34, 55, 0.94), rgba(12, 20, 31, 0.94));
  border: 1px solid var(--line);
}
.metric-label { margin: 0 0 8px; color: var(--muted); font-size: 0.84rem; }
.metric-value { margin: 0; font-size: 1.7rem; font-weight: 700; }

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(213, 181, 107, 0.08);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}
.table th { color: var(--muted); font-weight: 600; }
.table tr.is-clickable:hover { background: rgba(126, 198, 193, 0.06); }
.code-block, pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(7, 13, 22, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 12px;
  color: #d9e7fb;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(213, 181, 107, 0.18);
  background: rgba(213, 181, 107, 0.1);
  font-size: 0.78rem;
}
.badge.error { border-color: rgba(239, 138, 138, 0.25); background: rgba(239, 138, 138, 0.12); color: #ffd5d5; }
.badge.success { border-color: rgba(126, 198, 193, 0.22); background: rgba(126, 198, 193, 0.12); color: #c6f2ef; }

.subnav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.content-pane { display: none; }
.content-pane.active { display: block; }
.editor-form { display: grid; gap: 10px; padding: 16px; }
.prose-note { padding: 16px; color: var(--muted); line-height: 1.7; }
.prose-note p { margin-top: 0; }
.list-stack { display: grid; gap: 12px; }
.info-card {
  padding: 14px;
  border-radius: 16px;
  background: rgba(11, 18, 29, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.info-card h4, .info-card p { margin: 0 0 8px; }
.info-card p:last-child { margin-bottom: 0; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

@media (max-width: 1080px) {
  .admin-view { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); }
}

@media (max-width: 860px) {
  .grid-two { grid-template-columns: 1fr; }
  .topbar, .toolbar.split { flex-direction: column; align-items: stretch; }
  .auth-row { grid-template-columns: 1fr; }
}
