/* Format Control — matchday operations console.
   Design: a floodlit pitch at night. Brand green is the "live" signal, used
   structurally (pitch lines, the live pulse) rather than as a lone accent.
   Display type: Manrope (heavy). UI/body: DM Sans. Numerals are tabular, like a scoreboard. */

:root {
  --pitch: #0c120e;          /* deep pitch night, green-tinted */
  --pitch-2: #0a0f0c;
  --surface: #141d17;        /* raised panels */
  --surface-2: #1a251e;
  --line: #273530;           /* hairline, like pitch markings at low light */
  --line-soft: #1e2a23;
  --green: #19c25b;          /* brand, nudged brighter for dark */
  --green-ink: #06230f;      /* text on green */
  --green-dim: #128a42;
  --green-glow: rgba(25, 194, 91, 0.18);
  --text: #eaf1ec;
  --muted: #8a9a8f;
  --muted-2: #637066;
  --warn: #ffcb2e;
  --danger: #e5484d;
  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 1200px;
  --sans: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  --display: "Manrope", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 600px at 78% -10%, rgba(25, 194, 91, 0.08), transparent 60%),
    var(--pitch);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- App frame ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.rail {
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--pitch) 0%, var(--pitch-2) 100%);
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand b { font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: -0.2px; }
.brand span { display: block; font-size: 11px; color: var(--muted-2); margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav button {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  background: transparent; border: 0; color: var(--muted);
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.nav button:hover { background: var(--surface); color: var(--text); }
.nav button.on { background: var(--surface); color: var(--text); }
.nav button.on .dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-glow); }
.nav .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: none; }
.nav .count {
  margin-left: auto; font-size: 11px; color: var(--muted-2);
  background: var(--surface-2); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums;
}
.rail-foot { margin-top: auto; font-size: 11px; color: var(--muted-2); line-height: 1.6; }
.rail-foot button { background: 0; border: 0; color: var(--muted); cursor: pointer; padding: 0; font-size: 11px; text-decoration: underline; }

/* ---------- Main ---------- */
.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 28px; border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--pitch) 86%, transparent);
  backdrop-filter: blur(10px);
}
.topbar h1 { font-family: var(--display); font-weight: 800; font-size: 20px; margin: 0; letter-spacing: -0.3px; }
.topbar .sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.live {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 var(--green-glow); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(25,194,91,.4); } 70% { box-shadow: 0 0 0 9px rgba(25,194,91,0); } 100% { box-shadow: 0 0 0 0 rgba(25,194,91,0); } }
@media (prefers-reduced-motion: reduce) { .live i { animation: none; } }
.spacer { flex: 1; }

.content { padding: 24px 28px 64px; max-width: var(--maxw); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  padding: 9px 14px; font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.04s;
}
.btn:hover { border-color: var(--muted-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--green); color: var(--green-ink); border-color: transparent; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); background: transparent; }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* ---------- Status strip (hero of Social) ---------- */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; margin-bottom: 22px; }
.stat { background: var(--surface); padding: 18px 20px; }
.stat .k { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.stat .v { font-family: var(--display); font-weight: 800; font-size: 34px; letter-spacing: -1px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 14px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.stat.good .v { color: var(--green); }

/* ---------- Segmented ---------- */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 7px 15px; border-radius: 999px; font-size: 13px; font-weight: 500; cursor: pointer; }
.seg button.on { background: var(--surface-2); color: var(--text); }

/* ---------- Post grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-top: 18px; }
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card .media { aspect-ratio: 4 / 5; background: var(--pitch-2); position: relative; display: grid; place-items: center; overflow: hidden; }
.card .media img { width: 100%; height: 100%; object-fit: cover; }
.card .media .ph { color: var(--muted-2); font-size: 12px; }
.badge { position: absolute; top: 10px; left: 10px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.3px; padding: 4px 9px; border-radius: 999px; background: color-mix(in srgb, var(--pitch) 70%, transparent); backdrop-filter: blur(6px); color: var(--text); }
.badge.ready { color: var(--green); }
.badge.posted { color: var(--muted); }
.card .body { padding: 14px 15px 15px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.card .ttl { font-family: var(--display); font-weight: 700; font-size: 15.5px; letter-spacing: -0.2px; }
.card .meta { font-size: 11.5px; color: var(--muted-2); }
.card .cap { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 11px; color: var(--green); background: var(--green-glow); border-radius: 6px; padding: 2px 7px; }
.card .row { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }

/* ---------- Gate ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate .panel { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 18px; padding: 30px; }
.gate .brand { margin-bottom: 20px; }
.gate h2 { font-family: var(--display); font-weight: 800; margin: 0 0 6px; font-size: 20px; }
.gate p { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }
.gate code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 12px; }
.field { width: 100%; background: var(--pitch-2); border: 1px solid var(--line); color: var(--text); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; margin-bottom: 12px; font-family: var(--sans); }
.field:focus { outline: none; border-color: var(--green); }
.err { color: var(--danger); font-size: 13px; margin: 0 0 14px; }

/* ---------- Misc states ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty b { display: block; font-family: var(--display); color: var(--text); font-size: 16px; margin-bottom: 6px; }
.skeleton { height: 290px; border-radius: var(--radius); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 200% 100%; animation: sh 1.3s infinite; }
@keyframes sh { to { background-position: -200% 0; } }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 999; max-width: 360px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; font-size: 13px; box-shadow: 0 12px 40px rgba(0,0,0,.4); }
.toast.ok { border-color: color-mix(in srgb, var(--green) 50%, var(--line)); }
.toast.bad { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }
.soon { display: inline-block; font-size: 11px; color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line)); border-radius: 999px; padding: 2px 9px; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(4,8,6,.6); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal { width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.modal .mh { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: var(--surface); }
.modal .mh b { font-family: var(--display); font-size: 16px; }
.modal .mb { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.modal .slides { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.modal .slides img { width: 100%; border-radius: 10px; border: 1px solid var(--line-soft); }
.modal pre { white-space: pre-wrap; word-break: break-word; font-family: var(--sans); font-size: 13px; color: var(--text); background: var(--pitch-2); border: 1px solid var(--line-soft); border-radius: 10px; padding: 14px; margin: 0; }
.x { margin-left: auto; background: 0; border: 0; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: column; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav .count { display: none; }
  .rail-foot { display: none; }
  .content { padding: 18px 16px 48px; }
  .topbar { padding: 16px; }
}
