:root {
  --bg: #0f1412;
  --panel: #1a221e;
  --text: #e8efe9;
  --muted: #9aab9f;
  --accent: #c4a574;
  --accent-2: #3d7a5f;
  --danger: #c45c4a;
  --border: rgba(232, 239, 233, 0.12);
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Instrument Serif", Georgia, serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(61, 122, 95, 0.25), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(196, 165, 116, 0.18), transparent 50%),
    var(--bg);
  min-height: 100vh;
}
a { color: var(--accent); }
.admin-body .topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  background: rgba(15, 20, 18, 0.85);
  z-index: 10;
}
.brand {
  font-family: var(--display);
  font-size: 1.6rem;
  color: var(--text);
  text-decoration: none;
}
.topnav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover { color: var(--text); }
.container { width: min(1100px, calc(100% - 2rem)); margin: 1.5rem auto 3rem; }
.page-head { margin-bottom: 1.25rem; }
.page-head h1, .wizard h2, .auth-card h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 2.2rem;
  margin: 0.2rem 0 0.4rem;
}
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono { font-family: ui-monospace, monospace; }
.break { word-break: break-all; }
.panel {
  background: rgba(26, 34, 30, 0.9);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
  margin-bottom: 0.85rem;
}
.stack { display: grid; gap: 0.85rem; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.gap { gap: 0.75rem; }
.grow { flex: 1; }
.mt { margin-top: 1.25rem; }
.mb { margin-bottom: 1rem; }
label { display: grid; gap: 0.35rem; font-size: 0.92rem; }
input, select, textarea, button {
  font: inherit;
}
input, select, textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #101613;
  color: var(--text);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  background: linear-gradient(135deg, var(--accent), #a88655);
  color: #1a140c;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-secondary { background: #243029; color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.linkish {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
}
.flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}
.flash-ok { background: rgba(61, 122, 95, 0.25); border: 1px solid rgba(61, 122, 95, 0.5); }
.flash-err { background: rgba(196, 92, 74, 0.2); border: 1px solid rgba(196, 92, 74, 0.45); }
.banner {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: rgba(196, 165, 116, 0.15);
  border: 1px solid rgba(196, 165, 116, 0.35);
  margin-bottom: 1rem;
}
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-card {
  width: min(440px, 100%);
  background: rgba(26, 34, 30, 0.95);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}
.auth-brand {
  font-family: var(--display);
  font-size: 2.4rem;
  margin: 0 0 1rem;
  text-align: center;
}
.checklist { list-style: none; padding: 0; }
.checklist li { padding: 0.4rem 0; }
.checklist .ok { color: #8fd6ae; }
.checklist .bad { color: #f0a090; }
.grid.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 0.5rem 0.35rem; border-bottom: 1px solid var(--border); }
.dim { opacity: 0.5; }
.check { display: flex; align-items: center; gap: 0.5rem; }
.check input { width: auto; }
details summary { cursor: pointer; }
.cal-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto auto auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.icon-preview,
.cal-src-icon {
  display: inline-flex;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text);
  flex-shrink: 0;
}
.icon-preview svg,
.cal-src-icon svg,
.cal-icon-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.inline { display: inline; }
.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}
.countdown-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.countdown-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #101613;
}
.countdown-item.dragging {
  opacity: 0.55;
}
.countdown-item.drag-over {
  border-color: var(--accent);
}
.cd-handle {
  cursor: grab;
  color: var(--muted);
  user-select: none;
  letter-spacing: -0.15em;
  padding: 0.25rem 0.15rem;
  font-size: 1rem;
}
.countdown-item:active .cd-handle { cursor: grabbing; }
.cd-edit-form {
  display: grid;
  grid-template-columns: minmax(8rem, 1.4fr) auto auto auto;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.cd-edit-form input[type="text"],
.cd-edit-form input[type="date"] {
  margin: 0;
}
.cd-meta {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  white-space: nowrap;
  font-size: 0.85rem;
  color: var(--muted);
}
.cd-status.cd-visible {
  color: #8fd6ae;
  font-weight: 600;
}

.font-picker {
  position: relative;
  width: min(100%, 22rem);
}
.font-picker-trigger {
  width: 100%;
  text-align: left;
  appearance: none;
  background: #101613;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 2rem 0.55rem 0.75rem;
  font-size: 1.05rem;
  line-height: 1.3;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% - 2px), calc(100% - 9px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.font-picker.is-open .font-picker-trigger {
  border-color: rgba(196, 165, 116, 0.55);
}
.font-picker-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 16rem;
  overflow: auto;
  background: #121916;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  padding: 0.25rem;
  display: none;
  gap: 0.15rem;
}
.font-picker.is-open .font-picker-menu {
  display: grid;
}
.font-picker-menu[hidden] {
  display: none !important;
}
.font-picker-option {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-radius: 7px;
  font-size: 1.08rem;
  line-height: 1.3;
  cursor: pointer;
}
.font-picker-option:hover,
.font-picker-option.is-active {
  background: rgba(196, 165, 116, 0.16);
}

@media (max-width: 700px) {
  .cal-row { grid-template-columns: 1fr; }
  .countdown-item {
    grid-template-columns: auto 1fr;
  }
  .cd-edit-form {
    grid-template-columns: 1fr;
  }
}
