:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1c1e21;
  --muted: #65676b;
  --line: #e2e4e8;
  --accent: #7c3aed;
  --accent-dark: #6d28d9;
  --danger: #d92d20;
  --ok: #12805c;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: #1f1b2d;
  color: #fff;
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar .muted { color: #b9b3c7; }
.topnav { display: flex; gap: 8px; }

.spacer { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); font-size: 13px; }
code { background: #eee; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

main { max-width: 1200px; margin: 0 auto; padding: 20px; }

.center { display: flex; justify-content: center; padding-top: 60px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.auth-inline { display: flex; align-items: center; gap: 6px; }
.auth-inline[hidden] { display: none; }
.auth-inline input {
  width: 130px;
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.btn-compact { padding: 5px 10px; font-size: 12px; }
.row-btns { display: flex; gap: 8px; margin-top: 12px; }
.row-btns .btn { flex: 1; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { background: #f0f1f4; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-google {
  background: #fff; border: 1px solid #dadce0; font-weight: 600; color: #3c4043;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-google:hover { background: #f8faff; border-color: #c6d4f5; }
.google-g { width: 18px; height: 18px; flex: none; }
.btn-small { padding: 5px 10px; font-size: 12px; }

.banner {
  background: #fdeceb;
  color: #8f1d14;
  border-bottom: 1px solid #f5c6c0;
  padding: 10px 20px;
  font-size: 13px;
  white-space: pre-wrap;
}

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; }
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.chip.active { background: #1f1b2d; color: #fff; border-color: #1f1b2d; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.season-card { display: flex; flex-direction: column; gap: 10px; }
.thumb {
  height: 120px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2d2350, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px;
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.season-card h3 { margin: 0; font-size: 16px; }
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8eaf0;
  color: #444;
}
.badge.active { background: #dcf5e9; color: var(--ok); }
.badge.upcoming { background: #e7e9ff; color: #3b4bd8; }
.badge.hidden { background: #fdeceb; color: var(--danger); }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }

.edit-grid { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .edit-grid { grid-template-columns: 1fr; } }

.journey-chap { margin: 10px 0; padding: 12px; }
.journey-chap .field { margin-bottom: 10px; }
.journey-chap > label { display: block; font-weight: 600; font-size: 13px; margin: 8px 0 6px; }
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field .count {
  font-weight: 400; color: var(--muted); font-size: 12px;
  background: #eef0f3; border-radius: 999px; padding: 1px 8px; margin-left: 4px;
}
.field input[type="text"], .field input[type="datetime-local"], .field select {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.order-list { list-style: none; margin: 0 0 8px; padding: 0; }
.order-item {
  display: flex; align-items: center; gap: 8px;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
.order-val { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-btns button {
  border: 1px solid var(--line); background: #fff; border-radius: 6px;
  width: 26px; height: 26px; cursor: pointer; font-size: 12px; line-height: 1;
}
.order-btns button:disabled { opacity: 0.35; cursor: default; }
.order-list .empty { color: var(--muted); font-size: 13px; padding: 4px 0; }
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; padding: 8px 10px; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; }

.preview { position: sticky; top: 16px; }
.preview h3 { margin-top: 0; }
.preview dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.preview dt { color: var(--muted); }
.preview dd { margin: 0; }

.danger {
  margin-top: 24px;
  border: 1px solid #f5c6c0;
  background: #fff7f6;
  border-radius: var(--radius);
  padding: 16px;
}
.danger h3 { margin: 0 0 8px; color: var(--danger); font-size: 15px; }
.danger .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.danger input { padding: 8px 10px; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 16, 32, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal { background: #fff; border-radius: 12px; padding: 20px; width: 420px; max-width: 92vw; }
.modal h2 { margin: 0 0 12px; font-size: 18px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #1f1b2d; color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 14px;
  z-index: 60;
}

#alerts { margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
#alerts:empty { display: none; }
.alerts-title { margin: 0 0 2px; font-size: 15px; }
.alert {
  display: flex; gap: 12px; align-items: center;
  border-left: 4px solid var(--accent);
}
.alert-icon { font-size: 24px; }
.alert-body { flex: 1; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.info-box {
  background: #f0eafd; border: 1px solid #d9c9f5;
  border-radius: 8px; padding: 10px 14px;
  font-size: 13px; margin-bottom: 16px;
}
.info-box ul { margin: 6px 0 0; padding-left: 18px; }

#watcher-log { margin-bottom: 16px; }
#watcher-log:empty { display: none; }
.watcher-card { font-size: 13px; }
.watcher-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.watcher-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.watcher-errors { margin-top: 8px; }
.watcher-errors ul { margin: 4px 0 0; padding-left: 18px; }
.watcher-errors li { font-family: monospace; font-size: 12px; word-break: break-all; }
.watcher-articles { margin-top: 8px; }
.watcher-articles ul { margin: 4px 0 0; padding-left: 18px; max-height: 220px; overflow-y: auto; }
.watcher-articles li { font-size: 13px; margin-bottom: 3px; }
.watcher-articles a { color: var(--accent-dark); text-decoration: none; }
.watcher-articles a:hover { text-decoration: underline; }
.cache-body { max-height: 400px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; font-size: 12px; }
.sugg-evidence { margin: 6px 0 0; padding-left: 18px; font-size: 12px; }
.card-facts { font-size: 12px; color: var(--muted); margin-top: 4px; }
.sugg-line { font-size: 12px; margin-top: 4px; }
