/* Видеопостер — оформление панели.
   Токены объявлены один раз; тёмная тема переопределяет только их. Светлая живёт на
   голом :root, поэтому ни один цвет не существует исключительно внутри media-запроса. */

:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f1efe9;
  --dropzone: #fbfaf7;
  --border: #e2dfd6;
  --border-strong: #cfcbc0;
  --thumb: #e7e4dc;
  --ink: #171613;
  --ink-2: #56534b;
  --ink-3: #86827a;
  --accent: #b4501e;
  --on-accent: #fffdf9;
  --blue: #1f5f8b;
  --amber: #9a6510;
  --green: #1c6b4d;
  --red: #a32c22;
  --tint-wait: #edebe5;
  --tint-up: #e4eef5;
  --tint-proc: #f6eddc;
  --tint-done: #e2f0ea;
  --tint-error: #f7e6e3;
  --radius: 12px;
  --font: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --display: 'Manrope', var(--font);
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #131418;
    --surface: #1b1d22;
    --surface-2: #22252b;
    --dropzone: #1f2228;
    --border: #31353d;
    --border-strong: #3c414a;
    --thumb: #262a31;
    --ink: #eceae4;
    --ink-2: #a9a59c;
    --ink-3: #7c7870;
    --accent: #d9743f;
    --on-accent: #171613;
    --blue: #7fb2dc;
    --amber: #dca84a;
    --green: #6cc39c;
    --red: #e58c7e;
    --tint-wait: #24262b;
    --tint-up: #1e2a33;
    --tint-proc: #2e2718;
    --tint-done: #17281f;
    --tint-error: #2e1c19;
  }
}

:root[data-theme='dark'] {
  --bg: #131418;
  --surface: #1b1d22;
  --surface-2: #22252b;
  --dropzone: #1f2228;
  --border: #31353d;
  --border-strong: #3c414a;
  --thumb: #262a31;
  --ink: #eceae4;
  --ink-2: #a9a59c;
  --ink-3: #7c7870;
  --accent: #d9743f;
  --on-accent: #171613;
  --blue: #7fb2dc;
  --amber: #dca84a;
  --green: #6cc39c;
  --red: #e58c7e;
  --tint-wait: #24262b;
  --tint-up: #1e2a33;
  --tint-proc: #2e2718;
  --tint-done: #17281f;
  --tint-error: #2e1c19;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--blue); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.2px; margin: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-2); }
.small { font-size: 12px; }
.grow { flex-grow: 1; }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.wrap { flex-wrap: wrap; }

/* ------------------------------------------------------------------ каркас */

header.top {
  height: 64px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: inherit; }
.brand span { font-family: var(--display); font-weight: 800; font-size: 16px; }
.mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 800; font-size: 13px;
}

nav.tabs {
  height: 48px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
nav.tabs a {
  padding: 0 14px 10px;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
nav.tabs a.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }

main { padding: 22px 24px 40px; max-width: 1360px; }
.page-title { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

/* ----------------------------------------------------------------- элементы */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
/* Прокрутка широкой таблицы живёт внутри карточки: иначе вбок едет вся страница,
   и на телефоне пропадают и статусы, и кнопки. */
.card.flush { padding: 0; overflow-x: auto; }
.card.flush table { min-width: 680px; }
.card + .card { margin-top: 14px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 10px; border-radius: 8px;
  background: var(--surface-2); color: var(--ink-2);
  font-size: 12px;
}
.pill .mono { color: var(--ink); font-size: 13px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 9px; border-radius: 8px;
  font-family: var(--mono); font-size: 11px;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.wait  { background: var(--tint-wait);  color: var(--ink-2); }
.chip.up    { background: var(--tint-up);    color: var(--blue); }
.chip.proc  { background: var(--tint-proc);  color: var(--amber); }
.chip.done  { background: var(--tint-done);  color: var(--green); }
.chip.error { background: var(--tint-error); color: var(--red); }

button, .btn {
  height: 38px; padding: 0 16px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--ink);
  font-family: var(--font); font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; cursor: pointer;
}
button:hover, .btn:hover { border-color: var(--border-strong); }
button.primary, .btn.primary {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent);
}
button.danger { background: var(--red); color: var(--on-accent); border-color: var(--red); }
button.link {
  height: auto; padding: 0; border: none; background: none;
  color: var(--blue); text-decoration: underline;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

input[type='text'], input[type='number'], input[type='datetime-local'], select, textarea {
  padding: 8px 11px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--ink);
  font-family: var(--font); font-size: 13px;
}
textarea { resize: vertical; line-height: 1.5; }
label { display: flex; gap: 8px; align-items: center; }
label.stack { flex-direction: column; align-items: stretch; gap: 6px; }
label.stack > span:first-child { font-size: 13px; font-weight: 600; }
input[type='checkbox'], input[type='radio'] { width: 16px; height: 16px; accent-color: var(--accent); }

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: 14px;
  background: var(--dropzone);
  padding: 28px;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  text-align: center;
}
.dropzone.hot { border-color: var(--accent); background: var(--surface-2); }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2);
  background: var(--surface-2); padding: 10px 14px;
}
td { padding: 12px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
tr:first-child td { border-top: none; }

.thumb {
  width: 44px; height: 78px; border-radius: 8px;
  background: var(--thumb); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3);
}

.banner {
  padding: 11px 14px; border-radius: 10px;
  background: var(--tint-error); color: var(--red);
  margin-bottom: 14px;
}
.note { font-size: 12px; color: var(--ink-3); line-height: 1.45; }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.bar { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; display: flex; }
.bar > span { background: var(--accent); }

.login {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px;
}
.login .card { width: 380px; }

@media (max-width: 900px) {
  .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  main { padding: 16px; }
}

@media (max-width: 760px) {
  /* Шапка перестаёт быть одной строкой, а не выталкивает себя за экран. */
  header.top {
    height: auto;
    min-height: 56px;
    padding: 10px 14px;
    flex-wrap: wrap;
    row-gap: 8px;
  }
  header.top .pill { font-size: 11px; padding: 4px 8px; }
  nav.tabs { overflow-x: auto; }
  .login .card { width: auto; max-width: 380px; }
  /* Боковая колонка карточки ролика встаёт над содержимым, а не жмётся в полоску. */
  main > .row { flex-wrap: wrap; }
  main > .row > .card { width: 100% !important; }
}
