@font-face {
  font-family: "Archivo";
  src: url("/fonts/Archivo.ttf") format("truetype");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --table: #E4E8EE;   /* the light table everything sits on */
  --sheet: #FBFCFD;   /* panels and forms */
  --mount: #1C232D;   /* dark mount behind creatives */
  --ink: #18202B;
  --mute: #5A6676;
  --rule: #CCD3DC;
  --go: #1F8A5B;      /* approved, published */
  --hold: #B7791F;    /* waiting for you */
  --stop: #C0392B;    /* rejected, failed */
  --cue: #3157D5;     /* scheduled, links, focus */
  --wide: 118%;
  --narrow: 78%;
  --radius: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --table: #12171E;
    --sheet: #1A2029;
    --mount: #0A0E13;
    --ink: #E6EBF1;
    --mute: #97A3B3;
    --rule: #2C3542;
    --go: #3DBE84;
    --hold: #E0A840;
    --stop: #EF6B5E;
    --cue: #7C9BFF;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--table);
  color: var(--ink);
  font: 400 15px/1.5 "Archivo", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--cue); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cue); outline-offset: 2px; }
h1, h2, h3 { font-stretch: var(--wide); line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 750; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
.small { font-size: 13px; color: var(--mute); font-stretch: var(--narrow); }
.error { color: var(--stop); }

.wordmark {
  font-stretch: 125%; font-weight: 800; font-size: 22px; letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none;
}

/* ── Sign in ─────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: min(360px, 100%); display: grid; gap: 10px; }
.login-box .wordmark { font-size: 40px; }
.login-lead { margin: 0 0 12px; color: var(--mute); }

/* ── Shell ───────────────────────────────── */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px;
  padding: 22px 18px; border-right: 1px solid var(--rule);
}
.projects { display: grid; gap: 2px; }
.project-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: var(--radius);
  background: none; text-align: left; cursor: pointer; font-weight: 600;
}
.project-btn[aria-current="true"] { background: var(--sheet); }
.swatch { width: 14px; height: 14px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.nav { display: grid; gap: 1px; }
.nav a {
  display: flex; justify-content: space-between; align-items: baseline; padding: 7px 8px; border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
}
.nav a[aria-current="page"] { background: var(--ink); color: var(--table); }
.count { font-stretch: var(--narrow); font-weight: 700; color: var(--hold); }
.nav a[aria-current="page"] .count { color: inherit; }
.spend { margin-top: auto; font-stretch: var(--narrow); font-size: 13px; color: var(--mute); }
.meter { height: 4px; background: var(--rule); border-radius: 2px; margin: 6px 0; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--go); }
.spend strong { color: var(--ink); font-size: 15px; font-stretch: 100%; }

.main { padding: 26px 34px 80px; min-width: 0; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.head p { margin: 6px 0 0; color: var(--mute); max-width: 62ch; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ── Buttons & fields ────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius);
  border: 1px solid var(--rule); background: var(--sheet); cursor: pointer; font-weight: 600; white-space: nowrap;
  color: var(--ink); text-decoration: none;
}
.btn:hover { border-color: var(--mute); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--table); }
.btn-go { background: var(--go); border-color: var(--go); color: #fff; }
.btn-quiet { background: none; border-color: transparent; color: var(--mute); }
.btn-quiet:hover { color: var(--ink); border-color: var(--rule); }
.btn-stop { color: var(--stop); }
label { font-weight: 600; font-size: 13px; }
input[type="text"], input[type="password"], input[type="url"], input[type="number"], input[type="time"],
input[type="datetime-local"], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
input[type="color"] { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); }
.field { display: grid; gap: 5px; }
.hint { font-size: 12.5px; color: var(--mute); font-stretch: var(--narrow); }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 14px; }

/* ── The proof wall ──────────────────────── */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 34px 26px; align-items: start; }
.proof { min-width: 0; }
.mount {
  position: relative; background: var(--mount); border-radius: 3px; overflow: hidden;
  border-top: 4px solid var(--brand, var(--rule));
}
.mount.reel { aspect-ratio: 9 / 16; }
.mount.carousel, .mount.post { aspect-ratio: 4 / 5; }
.mount video, .mount img.single { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--mount); }
.strip { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.strip img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: contain; scroll-snap-align: start; }
.slide-count {
  position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 10px; background: rgba(0, 0, 0, .6);
  color: #fff; font-size: 12px; font-stretch: var(--narrow); pointer-events: none;
}
.pending { position: absolute; inset: 0; display: grid; place-content: center; gap: 10px; padding: 18px; text-align: center; color: #C8D0DA; }
.pending .hookline { font-stretch: var(--wide); font-weight: 700; font-size: 19px; color: #fff; line-height: 1.15; }
.bar-loop { width: 120px; height: 3px; margin: 0 auto; background: rgba(255, 255, 255, .15); overflow: hidden; border-radius: 2px; }
.bar-loop i { display: block; width: 40%; height: 100%; background: #fff; animation: loop 1.6s ease-in-out infinite; }
@keyframes loop { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .bar-loop i { animation: none; width: 100%; opacity: .5; } }

.proof-body { padding-top: 12px; display: grid; gap: 8px; }
.proof-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--mute); font-stretch: var(--narrow); }
.status { font-weight: 700; }
.status.review, .status.render_failed { color: var(--hold); }
.status.approved { color: var(--cue); }
.status.published { color: var(--go); }
.status.failed, .status.rejected { color: var(--stop); }
.hook { font-stretch: var(--wide); font-weight: 700; font-size: 17px; line-height: 1.2; margin: 0; }
.caption-peek { margin: 0; color: var(--mute); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.judge { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; font-stretch: var(--narrow); align-items: center; }
.judge dt { color: var(--mute); }
.judge dd { margin: 0; display: flex; align-items: center; gap: 8px; }
.score { flex: 1; height: 4px; background: var(--rule); border-radius: 2px; overflow: hidden; max-width: 110px; }
.score i { display: block; height: 100%; background: var(--ink); }
.flag-bad { color: var(--stop); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border: 1px solid var(--rule); border-radius: 14px; font-size: 13px; cursor: pointer; user-select: none; }
.chip input { accent-color: var(--ink); margin: 0; }
.note { font-size: 13px; color: var(--stop); background: color-mix(in srgb, var(--stop) 8%, transparent); padding: 6px 8px; border-radius: var(--radius); overflow-wrap: anywhere; }
.reject-box { display: grid; gap: 6px; }

/* ── Lists (schedule, published, research, runs) ── */
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); }
.rows { display: grid; }
.row { display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--rule); }
.row:first-child { border-top: 0; }
.thumb { width: 72px; aspect-ratio: 4 / 5; object-fit: cover; background: var(--mount); border-radius: 3px; display: block; }
.thumb.reel { aspect-ratio: 9 / 16; }
.row h3 { font-stretch: 100%; font-size: 15px; }
.day { margin: 26px 0 8px; font-stretch: var(--wide); font-weight: 700; }
.day:first-child { margin-top: 0; }
.stats { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--mute); font-stretch: var(--narrow); }
.stats b { color: var(--ink); font-stretch: 100%; font-size: 15px; }
.links { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--mute); font-stretch: var(--narrow); padding: 8px 12px; border-bottom: 1px solid var(--rule); }
td { padding: 9px 12px; border-top: 1px solid var(--rule); vertical-align: top; }
tr:first-child td { border-top: 0; }
td.num, th.num { text-align: right; }
.rel { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.rel .score { max-width: 70px; }
.signal-title { font-weight: 600; }
.signal-title a { color: var(--ink); text-decoration: none; }
.signal-title a:hover { text-decoration: underline; }

/* ── Forms (project, settings) ───────────── */
.form { display: grid; gap: 26px; max-width: 880px; }
.form-section { display: grid; gap: 14px; padding: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.colors { display: flex; flex-wrap: wrap; gap: 14px; }
.colors .field { grid-template-columns: auto; justify-items: start; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.shot { display: grid; gap: 6px; }
.shot img { width: 100%; aspect-ratio: 9 / 19.5; object-fit: cover; object-position: top; border-radius: 4px; background: var(--mount); }
.shot-name { font-size: 12.5px; font-weight: 700; font-stretch: var(--narrow); display: flex; justify-content: space-between; align-items: center; }
.logo-preview { width: 72px; height: 72px; border-radius: 16px; object-fit: cover; background: #fff; border: 1px solid var(--rule); }
.conn { display: grid; grid-template-columns: 12px 120px 1fr; gap: 10px; align-items: baseline; padding: 6px 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--stop); align-self: center; }
.dot.ok { background: var(--go); }
.slot-row { display: flex; gap: 8px; align-items: center; }
.slot-row select { width: auto; }
.slot-row input { width: 130px; }

.empty { padding: 36px 0; text-align: left; max-width: 520px; }
.empty h2 { margin-bottom: 8px; }
.empty p { color: var(--mute); margin: 0 0 16px; }

/* ── Drawer (edit) ───────────────────────── */
.drawer { position: fixed; inset: 0; z-index: 20; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(10, 14, 19, .45); }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(620px, 100%); overflow-y: auto;
  background: var(--sheet); border-left: 1px solid var(--rule); padding: 24px; display: grid; gap: 18px; align-content: start;
}
.beat { display: grid; grid-template-columns: 1fr 1fr 150px; gap: 8px; align-items: start; }
.beat textarea { min-height: 60px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; max-width: min(560px, calc(100% - 32px));
  background: var(--ink); color: var(--table); padding: 10px 16px; border-radius: var(--radius); font-weight: 600;
}
.toast.bad { background: var(--stop); color: #fff; }

/* ── Phone ───────────────────────────────── */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .rail {
    position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 14px;
    padding: 12px 16px; background: var(--table); border-right: 0; border-bottom: 1px solid var(--rule);
  }
  .projects { display: flex; flex: 1; overflow-x: auto; }
  .project-btn { width: auto; }
  .spend { margin: 0; flex-basis: 100%; display: flex; gap: 10px; align-items: center; }
  .spend .meter { flex: 1; margin: 0; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; overflow-x: auto; gap: 0;
    background: var(--sheet); border-top: 1px solid var(--rule); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .nav a { flex: 1 1 0; min-width: 0; justify-content: center; gap: 3px; padding: 8px 2px; font-size: 12.5px; }
  .main { padding: 18px 16px 110px; }
  .wall { grid-template-columns: 1fr; gap: 30px; }
  .mount.reel { max-height: 78vh; margin: 0 auto; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .beat { grid-template-columns: 1fr; }
  .row { grid-template-columns: 56px 1fr; }
  .row > .actions { grid-column: 1 / -1; }
  .thumb { width: 56px; }
  table { font-size: 13px; }
  .hide-sm { display: none; }
}
