:root {
  --bg: #f5f6f8; --surface: #ffffff; --ink: #111827; --muted: #6b7280; --line: #e3e6eb;
  --field: #ffffff; --primary: #1d3a6e; --primary-hover: #16305c; --on-primary: #ffffff;
  --focus: rgba(29, 58, 110, .22); --danger: #b42318; --danger-bg: #fdf1f0;
  --ok: #17663a; --ok-bg: #edf7f0; --pending: #8a5a00; --pending-bg: #fdf5e3; --head: #f9fafb;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116; --surface: #161b22; --ink: #e6e9ee; --muted: #949dab; --line: #2a313b;
    --field: #0e1116; --primary: #5b8def; --primary-hover: #74a0f5; --on-primary: #0b1220;
    --focus: rgba(91, 141, 239, .3); --danger: #f1857b; --danger-bg: #2c1716;
    --ok: #6fcf97; --ok-bg: #14261b; --pending: #e3b44f; --pending-bg: #2a2212; --head: #1a2029;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .inner {
  max-width: 1040px; margin: 0 auto; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.brand svg { width: 28px; height: 28px; flex: none; }
.tag {
  font-size: 12px; font-weight: 500; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px;
}

main { max-width: 1040px; margin: 0 auto; padding: 32px 16px 64px; }
main.narrow { max-width: 472px; }
h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.02em; margin: 0 0 6px; font-weight: 650; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
.lead { color: var(--muted); margin: 0 0 24px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.card.pad { padding: 24px; }
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}

label { display: block; font-size: 13px; font-weight: 500; margin: 0 0 6px; }
label .opt { color: var(--muted); font-weight: 400; }
input {
  width: 100%; height: 42px; padding: 0 12px; font: inherit; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: 8px;
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder { color: var(--muted); opacity: .75; }
input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.field { margin-bottom: 16px; }
.help { color: var(--muted); font-size: 13px; margin: 6px 0 0; }

button {
  font: inherit; font-weight: 550; height: 42px; padding: 0 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--primary); background: var(--primary); color: var(--on-primary);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
button:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
button:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--focus); }
button:disabled { opacity: .5; cursor: default; }
button.wide { width: 100%; }
button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
button.secondary:hover:not(:disabled) { background: var(--head); border-color: var(--line); }
button.link {
  height: auto; padding: 4px 8px; background: transparent; border-color: transparent;
  color: var(--danger); font-weight: 500; font-size: 13px;
}
button.link:hover:not(:disabled) { background: var(--danger-bg); border-color: transparent; }
button svg { width: 16px; height: 16px; flex: none; }

.notice { border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 0 0 16px; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.err { background: var(--danger-bg); color: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 24px; font-weight: 650; letter-spacing: -.02em; line-height: 1.3; font-variant-numeric: tabular-nums; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.search { flex: 1 1 220px; max-width: 320px; height: 36px; }
.toolbar button, .card-head button { height: 36px; font-size: 14px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--head);
  padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.name { font-weight: 550; overflow-wrap: anywhere; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.date { color: var(--muted); white-space: nowrap; }
td.act { text-align: right; width: 1%; }
.badge { display: inline-block; font-size: 12px; font-weight: 550; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge.new { background: var(--pending-bg); color: var(--pending); }
.badge.done { background: var(--ok-bg); color: var(--ok); }
.empty { color: var(--muted); text-align: center; padding: 40px 16px; margin: 0; }
.foot { color: var(--muted); font-size: 13px; text-align: center; margin: 24px 0 0; }

@media (max-width: 620px) {
  main { padding-top: 24px; }
  h1 { font-size: 21px; }
  .card.pad { padding: 20px 16px; }
  .col-date { display: none; }
  th, td { padding-left: 12px; padding-right: 12px; }
  .stat { padding: 12px; }
  .stat .v { font-size: 20px; }
  .search { max-width: none; }
  .actions { width: 100%; }
  .actions button { flex: 1; }
}
.stats .card { margin-top: 0; }

/* Reel Ready */
.drop {
  display: block; border: 1.5px dashed var(--line); border-radius: 10px; padding: 32px 16px; margin: 0 0 20px;
  text-align: center; cursor: pointer; background: var(--head); font-weight: 400; font-size: 15px;
  transition: border-color .12s, background .12s;
}
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--primary); }
.drop strong { display: block; font-weight: 600; margin-bottom: 2px; overflow-wrap: anywhere; }
.drop span { color: var(--muted); font-size: 13px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.seg label { margin: 0; }
.seg input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.seg span {
  display: block; text-align: center; padding: 9px 8px; border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; font-size: 14px; font-weight: 500; line-height: 1.3;
}
.seg small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.seg input:checked + span { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px var(--focus); }
.bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 12px 0 8px; }
.bar i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.report { margin: 0; font-size: 14px; }
.report div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); }
.report div:first-child { border-top: 0; }
.report dt { color: var(--muted); }
.report dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
a.button {
  display: flex; align-items: center; justify-content: center; height: 42px; border-radius: 8px;
  background: var(--primary); color: var(--on-primary); font-weight: 550; text-decoration: none;
}
a.button:hover { background: var(--primary-hover); }
video { width: 100%; max-height: 420px; background: #000; border-radius: 8px; margin: 0 0 16px; display: block; }
.stack > * + * { margin-top: 12px; }
#formats { grid-template-columns: repeat(2, 1fr); }
