/* Roof King · Mission Control */
:root {
  --bg: #050B24;
  --panel: #0B1640;
  --panel-2: #102055;
  --line: rgba(159, 211, 245, .14);
  --line-2: rgba(159, 211, 245, .28);
  --text: #E8F1FB;
  --dim: #8FA6C8;
  --roof: #3591E0;
  --navy: #1E4BAC;
  --lime: #8FDB5C;
  --lime-pale: #C3EEC5;
  --red: #FF6B6B;
  --amber: #FFC857;
  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --body: "Instrument Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--text); font: 15px/1.5 var(--body);
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 32px 32px,
    radial-gradient(1200px 600px at 80% -10%, rgba(53, 145, 224, .25), transparent 60%),
    var(--bg);
  background-blend-mode: normal, normal, screen, normal;
}
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 900; text-transform: uppercase; letter-spacing: .02em; line-height: 1; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.mono { font-family: var(--mono); letter-spacing: .06em; }
.dim { color: var(--dim); }
.small { font-size: 13px; }
code { font-family: var(--mono); font-size: 13px; background: rgba(255,255,255,.06); padding: 2px 6px; border-radius: 6px; }

.shell { display: grid; grid-template-columns: 200px 1fr; grid-template-rows: auto 1fr auto; height: 100vh; }

/* top bar */
.bar { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: rgba(5, 11, 36, .8); backdrop-filter: blur(10px); }
.bar-brand { display: flex; align-items: center; gap: 14px; }
.bar-brand img { height: 46px; }
.bar-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--lime); }
.bar h1 { font-size: 30px; }
.bar-status { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13px; background: rgba(255,255,255,.03); white-space: nowrap; }
.chip.link { text-decoration: none; color: var(--text); }
.chip.link:hover { border-color: var(--lime); }
.led { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); box-shadow: 0 0 0 0 transparent; }
.led.ok { background: var(--lime); box-shadow: 0 0 10px var(--lime); animation: blink 2.4s infinite; }
.led.warn { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.led.bad { background: var(--red); box-shadow: 0 0 10px var(--red); }
@keyframes blink { 50% { opacity: .45; } }

/* left rail */
.rail { border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 6px; background: rgba(5, 11, 36, .6); }
.rail-btn { all: unset; cursor: pointer; display: flex; gap: 10px; align-items: center; padding: 11px 12px; border-radius: 10px; font-weight: 600; color: var(--dim); }
.rail-btn:hover { color: var(--text); background: rgba(255,255,255,.04); }
.rail-btn[aria-current="page"] { color: var(--text); background: var(--panel-2); box-shadow: inset 3px 0 0 var(--lime); }
.rail-ico { width: 20px; text-align: center; color: var(--lime); }
.rail-stats { margin-top: auto; display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.stat b { display: block; font-family: var(--display); font-size: 34px; line-height: 1; }
.stat span { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }

.main { overflow: auto; padding: 18px; }
.view[hidden] { display: none; }

/* panels */
.panel { background: rgba(11, 22, 64, .86); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { font-size: 22px; }
.narrow { max-width: 860px; }

.updates { display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; gap: 14px; align-items: start; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2); background: transparent; color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .15s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--text); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.lime { background: var(--lime); color: #0B1640; border-color: var(--lime); }
.btn.lime:hover:not(:disabled) { background: #a8e87e; }
.btn.danger { color: var(--red); border-color: rgba(255,107,107,.4); }
.btn.danger:hover { background: rgba(255,107,107,.1); border-color: var(--red); }
.btn.big { min-height: 48px; padding: 0 22px; font-size: 16px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* list */
.search { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,.2); margin-bottom: 10px; }
.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: calc(100vh - 290px); overflow: auto; }
.post-item { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: grid; grid-template-columns: 56px 1fr; gap: 10px; padding: 8px; border-radius: 12px; border: 1px solid transparent; background: rgba(255,255,255,.025); }
.post-item:hover { border-color: var(--line-2); }
.post-item[aria-current="true"] { border-color: var(--lime); background: rgba(143,219,92,.06); }
.post-thumb { width: 56px; height: 56px; border-radius: 9px; background: var(--panel-2) center / cover no-repeat; display: grid; place-items: center; font-size: 11px; color: var(--dim); }
.post-title { font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-sub { font-family: var(--mono); font-size: 11px; color: var(--dim); margin-top: 3px; }
.pill { display: inline-block; font: 600 10px/1 var(--mono); letter-spacing: .1em; padding: 4px 6px; border-radius: 5px; margin-right: 4px; text-transform: uppercase; }
.pill.live { background: rgba(143,219,92,.18); color: var(--lime); }
.pill.draft { background: rgba(255,200,87,.15); color: var(--amber); }
.pill.feat { background: rgba(53,145,224,.2); color: #9FD3F5; }
.pill.dirty { background: rgba(255,255,255,.08); color: var(--text); }

/* editor */
.empty { padding: 40px 12px; display: grid; gap: 10px; max-width: 520px; }
.empty h3 { font-size: 30px; }
.edit { display: grid; grid-template-columns: 1fr; gap: 14px; }
.edit[hidden] { display: none; }
.edit-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fld { display: grid; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.fld > span, .fld > legend { font-family: var(--mono); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--lime-pale); display: flex; justify-content: space-between; padding: 0; margin-bottom: 2px; }
.fld em { font-style: normal; text-transform: none; letter-spacing: 0; }
.fld input, .fld textarea, .video-row input {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, .25); color: var(--text);
}
.fld input:focus, .fld textarea:focus, .video-row input:focus { outline: none; border-color: var(--lime); box-shadow: 0 0 0 3px rgba(143,219,92,.18); }
.fld textarea { resize: vertical; min-height: 96px; }
input[type="date"] { color-scheme: dark; }

.toggles { display: flex; gap: 18px; flex-wrap: wrap; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.toggle input { position: absolute; opacity: 0; }
.toggle span { width: 40px; height: 22px; border-radius: 999px; background: rgba(255,255,255,.15); position: relative; transition: background .2s; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked + span { background: var(--lime); }
.toggle input:checked + span::after { transform: translateX(18px); }
.toggle input:focus-visible + span { outline: 2px solid var(--lime); outline-offset: 2px; }

.svc-chips, .seg { display: flex; flex-wrap: wrap; gap: 6px; }
.svc-chips button, .seg button { all: unset; cursor: pointer; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13.5px; font-weight: 500; }
.svc-chips button[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--lime); color: #0B1640; border-color: var(--lime); font-weight: 600; }
.svc-chips button:focus-visible, .seg button:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

.drop { position: relative; display: block; padding: 22px; border: 1.5px dashed var(--line-2); border-radius: 12px; text-align: center; color: var(--dim); cursor: pointer; transition: border-color .15s, background .15s; }
.drop strong { color: var(--text); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop.over { border-color: var(--lime); background: rgba(143,219,92,.06); }

.ba-slots { display: grid; grid-template-columns: 110px 110px 1fr; gap: 10px; align-items: center; margin-top: 10px; }
.slot { border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: grid; gap: 4px; }
.slot span { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.slot-img { aspect-ratio: 4 / 3; border-radius: 6px; background: rgba(255,255,255,.04) center / cover no-repeat; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.ph { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: rgba(0,0,0,.2); display: grid; }
.ph-img { aspect-ratio: 4 / 3; background: var(--panel-2) center / cover no-repeat; position: relative; }
.ph-img .tag { position: absolute; left: 6px; top: 6px; font: 600 10px/1 var(--mono); letter-spacing: .1em; padding: 4px 6px; border-radius: 5px; background: var(--lime); color: #0B1640; text-transform: uppercase; }
.ph input { border: 0; border-top: 1px solid var(--line); background: transparent; padding: 7px 8px; font-size: 12.5px; border-radius: 0; }
.ph-actions { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); }
.ph-actions button { all: unset; cursor: pointer; text-align: center; padding: 7px 0; font-size: 12px; color: var(--dim); }
.ph-actions button:hover { color: var(--text); background: rgba(255,255,255,.05); }
.ph-actions button.on { color: var(--lime); }
.ph-actions button.del:hover { color: var(--red); }

.video-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }

.edit-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* preview card — mirrors the website card */
.card-preview { background: #FBFCFE; color: #0E1A3D; border-radius: 18px; overflow: hidden; }
.card-preview .m { aspect-ratio: 4 / 3; background: linear-gradient(160deg, #13225A, #0B1640) center / cover no-repeat; position: relative; display: grid; place-items: center; }
.card-preview .m img.ph-logo { width: 60%; }
.card-preview .b { padding: 14px 16px 18px; display: grid; gap: 6px; }
.card-preview .meta { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: #739CAD; }
.card-preview h4 { margin: 0; font-family: var(--display); font-weight: 900; text-transform: uppercase; font-size: 26px; line-height: .95; }
.card-preview p { font-size: 14px; color: #3C4A6B; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-preview .tags { display: flex; gap: 5px; flex-wrap: wrap; }
.card-preview .tags span { font-size: 11.5px; font-weight: 600; color: #1E4BAC; background: #EAF4FC; padding: 4px 8px; border-radius: 999px; }
.card-preview .badges { position: absolute; left: 10px; top: 10px; display: flex; gap: 5px; }
.card-preview .badges span { font: 600 11px/1 var(--body); padding: 6px 8px; border-radius: 999px; background: rgba(6,13,41,.8); color: #fff; }
.card-preview .badges span.ba { background: var(--lime); color: #0B1640; }

/* site + connection */
.site-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.site-form .wide, .edit .wide { grid-column: 1 / -1; }
.conn-box { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.conn-box[hidden] { display: none; }

/* publish bar */
.publish { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); background: rgba(5, 11, 36, .92); }
.pending { font-family: var(--mono); font-size: 13px; color: var(--dim); white-space: nowrap; }
.pending.has { color: var(--amber); }
.publish-right { display: flex; gap: 10px; }
.console { margin: 0; font: 12px/1.5 var(--mono); color: var(--lime-pale); max-height: 62px; overflow: auto; white-space: pre-wrap; }
.small-console { margin-top: 14px; max-height: 160px; }
.console .err { color: var(--red); }

@media (max-width: 1280px) {
  .updates { grid-template-columns: 300px minmax(0, 1fr); }
  .preview-panel { grid-column: 2; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto; height: auto; min-height: 100vh; }
  .rail { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .rail-stats { display: none; }
  .updates { grid-template-columns: 1fr; }
  .preview-panel { grid-column: auto; }
  .post-list { max-height: 260px; }
  .row, .site-form { grid-template-columns: 1fr; }
  .publish { grid-template-columns: 1fr; position: sticky; bottom: 0; }
  .bar { flex-direction: column; align-items: flex-start; }
  .bar-status { justify-content: flex-start; }
  .ba-slots { grid-template-columns: 1fr 1fr; }
  .ba-slots p { grid-column: 1 / -1; }
}
.empty[hidden] { display: none; }
.list-panel .panel-head h2 { font-size: 19px; }
.list-panel .panel-head .btn { white-space: nowrap; }

/* ---------- admin login ---------- */
.login { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; overflow: auto;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 32px 32px,
    radial-gradient(900px 500px at 50% 0%, rgba(53,145,224,.35), transparent 65%),
    radial-gradient(700px 400px at 100% 100%, rgba(143,219,92,.12), transparent 60%),
    var(--bg); }
.login[hidden] { display: none; }
.login-card { width: min(460px, 100%); display: grid; gap: 14px; padding: 32px; border-radius: 22px; background: rgba(11,22,64,.88); border: 1px solid var(--line-2); box-shadow: 0 40px 120px -40px rgba(0,0,0,.7); }
.login-logo { height: 70px; justify-self: start; }
.login-card h1 { font-size: 44px; }
.key-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.login-err { color: var(--red); font-size: 14px; min-height: 1em; }
.login-err:empty { display: none; }
.help { border-top: 1px solid var(--line); padding-top: 12px; }
.help summary { cursor: pointer; color: var(--lime-pale); font-weight: 600; }
.help ol { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 6px; color: var(--dim); }
.help a { color: var(--lime); }
.help b { color: var(--text); }
.adv { display: grid; gap: 10px; margin-top: 12px; }
button.chip { font: inherit; font-size: 13px; color: var(--text); cursor: pointer; }
