@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg:     #0e1116;
  --panel:  #161b23;
  --raised: #1c222c;
  --line:   #262e3a;
  --line-2: #333d4c;
  --text:   #dfe6ee;
  --mute:   #7a8798;
  --dim:    #5b6779;

  --live:   #34d399;
  --stale:  #fbbf24;
  --dead:   #f4506e;
  --accent: #38bdf8;
  --accent-ink: #06202e;

  --r: 8px;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Chrome ────────────────────────────────────────────────── */
.bar {
  display: flex; align-items: center; gap: 30px;
  padding: 0 22px; height: 54px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.mark {
  font-family: var(--mono);
  font-size: 13px; font-weight: 600; letter-spacing: .2em;
  color: var(--text); text-decoration: none;
}
.mark span { color: var(--accent); }
.mark.big { font-size: 17px; letter-spacing: .26em; }

.bar nav { display: flex; gap: 4px; margin-right: auto; }
.bar nav a {
  padding: 6px 13px; border-radius: 6px;
  color: var(--mute); font-weight: 500; text-decoration: none;
}
.bar nav a:hover { background: var(--raised); color: var(--text); }
.bar nav a.on { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.out { color: var(--dim); font-size: 13px; }

main { max-width: 1500px; margin: 0 auto; padding: 26px 22px 70px; }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 20px; flex-wrap: wrap; margin-bottom: 22px;
}
h1 { font-size: 25px; font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
     color: var(--mute); margin-bottom: 14px; }
.crumb { font-size: 12px; color: var(--dim); margin-bottom: 3px; }
.muted { color: var(--mute); }
.muted.small { font-size: 12.5px; margin-top: 10px; }
.muted.small b { color: var(--text); font-weight: 600; }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); }
.strong { font-weight: 600; color: var(--text); }

.flash {
  padding: 10px 14px; margin-bottom: 18px;
  background: rgba(56,189,248,.08);
  border: 1px solid rgba(56,189,248,.28);
  border-radius: var(--r);
  color: #bae6fd;
}
.flash.warn { background: rgba(251,191,36,.08); border-color: rgba(251,191,36,.3); color: #fde68a; }
.err {
  padding: 9px 12px; border-radius: 6px;
  background: rgba(244,80,110,.1); border: 1px solid rgba(244,80,110,.35);
  color: #fda4b4; font-size: 13px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 18px;
}
.empty { text-align: center; padding: 70px 20px; color: var(--mute); }
.empty p { margin-bottom: 14px; }

/* ── Status tally ──────────────────────────────────────────── */
.tally {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--mute);
  font-family: var(--mono);
}
.tally b { color: var(--text); font-weight: 600; }
.tally .pip { margin-left: 8px; }
.tally .pip:first-child { margin-left: 0; }
.clock {
  margin-left: 12px; padding-left: 12px;
  border-left: 1px solid var(--line-2); color: var(--dim);
}

.pip {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--dim); flex: none; display: inline-block;
}
.pip.live  { background: var(--live);  box-shadow: 0 0 0 3px rgba(52,211,153,.16); animation: beat 2.4s ease-in-out infinite; }
.pip.stale { background: var(--stale); box-shadow: 0 0 0 3px rgba(251,191,36,.16); }
.pip.dead, .pip.never { background: var(--dead); box-shadow: 0 0 0 3px rgba(244,80,110,.16); }
.pip.off   { background: var(--dim); }
@keyframes beat { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .pip.live { animation: none; } }

/* ── The wall ──────────────────────────────────────────────── */
.wall {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.tile.s-dead, .tile.s-never { border-color: rgba(244,80,110,.4); }
.tile.s-stale { border-color: rgba(251,191,36,.35); }
.tile.s-off { opacity: .5; }

.tile-top {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-bottom: 1px solid var(--line);
}
.code {
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  letter-spacing: .04em; color: var(--text);
}
.tile-top .grp { margin-left: auto; font-size: 11px; color: var(--dim); }

.screen {
  aspect-ratio: 16 / 9; background: #05070a;
  display: grid; place-items: center; overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.screen img { width: 100%; height: 100%; object-fit: cover; }
.ph {
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  color: var(--dim);
}
.ph.sm { display: grid; place-items: center; width: 46px; height: 30px;
         background: #05070a; border-radius: 3px; flex: none; }

.now {
  padding: 8px 12px 6px; font-size: 12.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.meta {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px;
  padding: 0 12px 10px; font-size: 11.5px;
}
.meta dt { color: var(--dim); }
.meta dd { font-family: var(--mono); color: var(--mute); text-align: right; }

.tile-foot {
  display: flex; gap: 6px; margin-top: auto;
  padding: 9px 12px; border-top: 1px solid var(--line);
  background: var(--raised);
}

/* ── Tags ──────────────────────────────────────────────────── */
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 99px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .03em;
  background: var(--raised); color: var(--mute);
  border: 1px solid var(--line-2);
  vertical-align: middle;
}
.tag.ok   { background: rgba(52,211,153,.1);  color: #6ee7b7; border-color: rgba(52,211,153,.3); }
.tag.warn { background: rgba(251,191,36,.1);  color: #fcd34d; border-color: rgba(251,191,36,.3); }
.tag.off  { background: rgba(244,80,110,.1);  color: #fda4b4; border-color: rgba(244,80,110,.3); }
.tag.idle { background: transparent; color: var(--dim); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 14px; border-radius: 6px;
  border: 1px solid var(--line-2); background: var(--raised); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: #232b37; border-color: #414d5f; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: #7dd3fc; border-color: #7dd3fc; }
.btn.primary:disabled { opacity: .4; cursor: not-allowed; }
.btn.tiny { padding: 4px 9px; font-size: 11.5px; }
.btn.ghost { background: transparent; }
.btn.danger { color: #fda4b4; border-color: rgba(244,80,110,.3); background: transparent; }
.btn.danger:hover { background: rgba(244,80,110,.12); border-color: rgba(244,80,110,.5); }

.switch {
  width: 34px; height: 19px; padding: 2px; border-radius: 99px;
  background: var(--raised); border: 1px solid var(--line-2);
  cursor: pointer; display: block;
}
.switch span {
  display: block; width: 13px; height: 13px; border-radius: 50%;
  background: var(--dim); transition: transform .14s, background .14s;
}
.switch.on { background: rgba(52,211,153,.18); border-color: rgba(52,211,153,.45); }
.switch.on span { background: var(--live); transform: translateX(15px); }
.ib { display: inline-block; }

/* ── Forms ─────────────────────────────────────────────────── */
label { display: block; font-size: 12px; color: var(--mute); }
label.check { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 13px; padding-top: 16px; }
input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line-2);
  border-radius: 6px; padding: 7px 9px;
  width: 100%; margin-top: 3px;
}
input[type=checkbox] { width: auto; margin: 0; accent-color: var(--accent); }
input:focus, select:focus { border-color: var(--accent); outline: none; }
input::placeholder { color: #4a5567; }

.row-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row-form label { flex: 1 1 150px; min-width: 120px; }
.row-form button { flex: none; }

.inline { padding: 5px 7px; font-size: 12.5px; margin: 0; }
.inline.url { font-size: 11px; color: var(--mute); }

/* ── Tables ────────────────────────────────────────────────── */
.grid { width: 100%; border-collapse: collapse; }
.grid th {
  text-align: left; padding: 7px 9px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dim); border-bottom: 1px solid var(--line-2);
}
.grid td { padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid tr.is-off { opacity: .45; }
.grid .mid { text-align: center; }
.grid .acts { white-space: nowrap; text-align: right; }
.grid .acts > * { margin-left: 4px; }
.loop .slide { display: flex; align-items: center; gap: 8px; min-width: 190px; }
.loop .slide img { width: 46px; height: 30px; object-fit: cover; border-radius: 3px; flex: none; }
.loop .slide span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; font-size: 12.5px; }
.loop .dates { display: flex; gap: 4px; min-width: 300px; }
.loop .dates input { font-size: 11px; }

/* ── Chips ─────────────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.chip, .chips .code {
  padding: 3px 9px; border-radius: 5px;
  background: var(--raised); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--mute);
}
.reach { margin: -10px 0 18px; }

/* ── Media library ─────────────────────────────────────────── */
.drop {
  display: grid; place-items: center; gap: 4px;
  padding: 34px; margin-bottom: 12px;
  border: 1.5px dashed var(--line-2); border-radius: var(--r);
  background: var(--bg); cursor: pointer; text-align: center;
  transition: border-color .14s, background .14s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: rgba(56,189,248,.05); }
.drop b { color: var(--text); font-size: 14px; }
.drop span { color: var(--dim); font-size: 12px; }

.picked { list-style: none; margin-bottom: 12px; }
.picked li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 5px 9px; border-bottom: 1px solid var(--line); font-size: 12.5px;
}

.lib { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.asset {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
  display: flex; flex-direction: column;
}
.asset-img {
  position: relative; aspect-ratio: 16/9; background: #05070a;
  display: grid; place-items: center; overflow: hidden;
}
.asset-img img, .asset-img video { width: 100%; height: 100%; object-fit: cover; }
.badge {
  position: absolute; top: 6px; left: 6px;
  padding: 1px 6px; border-radius: 4px;
  background: rgba(0,0,0,.7); border: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 9px; letter-spacing: .1em; color: var(--mute);
}
.badge.ok { background: rgba(52,211,153,.85); color: #05271b; border: 0; font-weight: 600; }
.asset figcaption, .asset .cap { padding: 8px 10px; display: grid; gap: 3px; }
.asset figcaption b, .asset .cap b {
  font-size: 12.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.asset figcaption span { font-size: 11px; }
.asset figcaption .tag { justify-self: start; margin-top: 2px; }
.asset-act { padding: 0 10px 10px; margin-top: auto; }

.lib.pick .asset { cursor: pointer; position: relative; }
.lib.pick .asset input[type=checkbox] {
  position: absolute; top: 7px; right: 7px; z-index: 2;
  width: 17px; height: 17px;
}
.lib.pick .asset:has(:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.lib.pick .asset.used { opacity: .55; }

/* ── Login ─────────────────────────────────────────────────── */
.login-page { display: grid; place-items: center; min-height: 100vh; }
.login {
  width: min(360px, 92vw); display: grid; gap: 13px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 32px 28px;
}
.login .mark { justify-self: center; }
.login .sub {
  justify-self: center; margin-top: -6px; margin-bottom: 6px;
  font-size: 12px; color: var(--dim);
}
.login .btn { margin-top: 4px; }

@media (max-width: 700px) {
  .bar { gap: 14px; padding: 0 14px; }
  .bar nav a { padding: 6px 9px; font-size: 13px; }
  main { padding: 18px 14px 60px; }
  .grid { display: block; overflow-x: auto; white-space: nowrap; }
}
