:root {
  --bg: #0b0f14;
  --panel: #121822;
  --line: #1f2937;
  --muted: #94a3b8;
  --text: #e5e7eb;
  --accent: #22c55e;
  --accent-dim: #22c55e18;
  --danger: #f87171;
  --blue: #9db2ff;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: inherit; text-decoration: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 16px; }

/* ── Navbar ────────────────────────────────────────────── */
.navbar { background: var(--panel); border-bottom: 1px solid var(--line); }
.nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; }
.brand-badge {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent-dim);
  border: 1px solid #22c55e55; color: var(--accent); display: flex; align-items: center;
  justify-content: center; font-size: .7rem; font-weight: 900;
}
.nav-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 10px; font-size: 1.1rem; }
.chip {
  padding: 6px 12px; border-radius: 8px; font-size: .82rem; font-weight: 600;
  background: #1a2535; border: 1px solid var(--line); color: var(--blue); cursor: pointer;
}
.chip.muted { color: var(--muted); background: transparent; border-color: transparent; }
.chip.danger { background: #2a1111; border-color: #E12D2D; color: #f87171; }
.chip.danger:hover { background: #E12D2D; color: #fff; }

@media (max-width: 780px) {
  .nav-toggle { display: block; }
  .nav-right { display: none; width: 100%; flex-direction: column; align-items: stretch; margin-top: 10px; }
  html.nav-open .nav-right { display: flex; }
  .nav-inner { flex-wrap: wrap; }
}

/* ── Generic ───────────────────────────────────────────── */
.page-title { font-size: 1.4rem; font-weight: 800; margin: 4px 0 16px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 9px;
  background: var(--accent); color: #052e16; font-weight: 800; font-size: .9rem;
  border: none; cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary {
  display: inline-flex; align-items: center; padding: 10px 18px; border-radius: 9px;
  background: #1a2535; border: 1px solid var(--line); color: var(--text); font-weight: 700; font-size: .9rem;
}
.btn-edit {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 8px;
  font-size: .82rem; font-weight: 600; background: #1a2535; border: 1px solid var(--line); color: var(--muted);
}
.btn-edit:hover { border-color: #4d6fa8; color: var(--blue); }

.mini-btn {
  padding: 5px 11px; border-radius: 6px; font-size: .78rem; font-weight: 700;
  background: #1a2535; border: 1px solid var(--line); color: var(--blue); cursor: pointer;
}
.mini-btn-danger { background: #2a1111; border-color: #E12D2D; color: #f87171; }
.mini-btn-danger:hover { background: #E12D2D; color: #fff; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: .88rem; margin-bottom: 14px; }
.alert-error { background: #2a1111; border: 1px solid #E12D2D; color: #f87171; }
.alert-ok { background: #112a16; border: 1px solid #22c55e; color: #22c55e; }

.empty-state {
  padding: 40px 20px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 10px;
}

/* ── Login ─────────────────────────────────────────────── */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at top, #16202e 0%, #0b0f14 60%);
}
.login-box {
  width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px 26px; text-align: center;
}
.login-badge {
  width: 52px; height: 52px; border-radius: 12px; margin: 0 auto 14px;
  background: var(--accent-dim); border: 1px solid #22c55e55; color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 900;
}
.login-title { margin: 0 0 2px; font-size: 1.2rem; font-weight: 800; }
.login-sub { margin: 0 0 18px; color: var(--muted); font-size: .85rem; }
.login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-form .f { display: flex; flex-direction: column; gap: 5px; font-size: .8rem; color: var(--muted); }
.login-form input {
  padding: 9px 11px; border-radius: 8px; background: #0a0f16; border: 1px solid var(--line);
  color: var(--text); font-size: .92rem;
}
.login-form .btn-primary { margin-top: 6px; width: 100%; justify-content: center; }

/* ── Events grid / cards ───────────────────────────────── */
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.event-card {
  display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; transition: border-color .15s;
}
.event-card:hover { border-color: #2a3a4a; }
.event-card-top { margin-bottom: 8px; }
.event-card-title { margin: 0 0 8px; font-size: 1.05rem; font-weight: 700; }
.event-card-meta { display: flex; flex-direction: column; gap: 3px; font-size: .8rem; color: var(--muted); }

.st-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  font-size: .68rem; font-weight: 800; letter-spacing: .07em;
  border: 1px solid #22c55e55; background: var(--accent-dim); color: var(--accent);
}
.st-pill-archived { border-color: #4a556755; background: #4a556718; color: var(--muted); }
.st-pill-sm { font-size: .65rem; padding: 3px 9px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: lp 2s infinite; }
@keyframes lp { 0%,100%{ box-shadow:0 0 0 0 #22c55e88; } 50%{ box-shadow:0 0 0 5px #22c55e00; } }

/* ── Event detail ──────────────────────────────────────── */
.ev-hero {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 12px; padding: 18px 20px 16px; margin-bottom: 14px; overflow: hidden;
}
.ev-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ev-title-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ev-title { margin: 0; font-size: 1.5rem; font-weight: 800; line-height: 1.15; }
.ev-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.ev-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; background: #0a0f16;
  border: 1px solid var(--line); border-radius: 8px; font-size: .81rem; color: var(--muted); white-space: nowrap;
}
.ev-chip b { color: var(--text); font-weight: 600; }
.ev-desc { font-size: .86rem; color: var(--muted); line-height: 1.6; padding-top: 10px; border-top: 1px solid var(--line); white-space: pre-wrap; }

.ev-layout { display: flex; gap: 14px; align-items: flex-start; }
.ev-main { flex: 1 1 auto; min-width: 0; }
.ev-aside { width: 380px; flex: 0 0 380px; }

.streams-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stream-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stream-card-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: #0a0f16; border-bottom: 1px solid var(--line); font-size: .85rem; font-weight: 600; }
.sdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: #f59e0b; transition: background .3s; }
.sdot.ok { background: var(--accent); animation: lp 2s infinite; }
.video-wrap { position: relative; width: 100%; padding-top: 56.25%; background: #000; overflow: hidden; }
.video-wrap > div { position: absolute; inset: 0; width: 100%; height: 100%; }
.no-streams { padding: 40px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; }

.stream-card-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-btn {
  background: none; border: none; color: var(--muted); font-size: 1.05rem; line-height: 1; cursor: pointer;
  padding: 4px 7px; border-radius: 6px; flex-shrink: 0;
}
.fs-btn:hover { color: var(--text); background: #1a2535; }

.stream-offline {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); text-align: center; background: #000;
}
.offline-icon { font-size: 2.2rem; opacity: .55; }
.offline-title { font-weight: 700; color: var(--text); font-size: .95rem; }
.offline-sub { font-size: .8rem; color: var(--muted); }
.stream-player { background: #000; }

.stream-card.card-fullscreen {
  position: fixed; inset: 0; z-index: 9999; border-radius: 0; border: none;
  display: flex; flex-direction: column; background: #000;
}
.stream-card.card-fullscreen .video-wrap { flex: 1 1 auto; padding-top: 0; }
.stream-card.card-fullscreen .stream-card-head { flex: 0 0 auto; }
body.no-scroll { overflow: hidden; }

@media (max-width: 960px) {
  .ev-layout { flex-direction: column; }
  .ev-aside { width: 100%; flex: 1 1 auto; }
  .streams-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .container { padding: 10px; }
  .ev-title { font-size: 1.2rem; }
}

.sidebar-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sidebar-tabs { display: flex; border-bottom: 1px solid var(--line); }
.stab {
  flex: 1; padding: 10px; font-size: .78rem; font-weight: 700; text-align: center; text-transform: uppercase;
  letter-spacing: .06em; cursor: pointer; color: var(--muted); background: transparent; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.stab.active { color: var(--text); border-bottom-color: var(--accent); }
.stab-pane { display: none; }
.stab-pane.active { display: block; }
#map { height: 300px; }
.windy-frame { width: 100%; height: 320px; border: 0; display: block; }

/* ── Admin form ────────────────────────────────────────── */
.admin-form { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; max-width: 760px; }
.eg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 8px; }
.eg .h { grid-column: span 2; }
.eg .f-full { grid-column: 1/-1; }
@media (max-width: 700px) { .eg { grid-template-columns: 1fr 1fr; } .eg .h { grid-column: span 2; } }
@media (max-width: 480px) { .eg { grid-template-columns: 1fr; } .eg .h { grid-column: span 1; } }
.f { display: flex; flex-direction: column; gap: 5px; font-size: .8rem; color: var(--muted); }
.f input, .f textarea {
  padding: 9px 11px; border-radius: 8px; background: #0a0f16; border: 1px solid var(--line);
  color: var(--text); font-size: .9rem; font-family: inherit;
}
.section-title { font-size: 1rem; font-weight: 700; margin: 20px 0 4px; }
.hint { font-size: .78rem; color: var(--muted); margin: 0 0 10px; }
.hint code { background: #0a0f16; padding: 1px 5px; border-radius: 4px; }

.stream-row { display: flex; gap: 8px; margin-bottom: 8px; }
.stream-row input {
  flex: 1; padding: 8px 10px; border-radius: 7px; background: #0a0f16; border: 1px solid var(--line);
  color: var(--text); font-size: .87rem;
}
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ── Admin table ───────────────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; font-size: .85rem; border-bottom: 1px solid var(--line); }
.admin-table th { color: var(--muted); font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; background: #0a0f16; }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }
