:root {
  --red: #E4132B; --ink: #2C2C2A; --soft: #5F5E5A; --line: #D3D1C7; --bg: #F7F6F2; --card: #fff;
  --ok: #639922; --wait: #EF9F27; --down: #E4132B; --off: #B4B2A9; --head: #2C2C2A;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #F1EFE8; --soft: #B4B2A9; --line: #444441; --bg: #1B1B19; --card: #262624; --head: #111110; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
a { color: inherit; }
button { font: inherit; font-size: 14px; padding: 7px 14px; border: 0.5px solid var(--off); border-radius: 9px; background: var(--card); color: var(--ink); cursor: pointer; min-height: 38px; }
button:hover:not(:disabled) { border-color: var(--ink); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
button.link { border: 0; background: none; padding: 4px 6px; min-height: 0; text-decoration: underline; color: inherit; }
input, select, textarea { font: inherit; width: 100%; padding: 9px 11px; border: 0.5px solid var(--off); border-radius: 9px; background: var(--card); color: var(--ink); }
label { display: grid; gap: 4px; font-size: 14px; color: var(--soft); }
.card { background: var(--card); border: 0.5px solid var(--line); border-radius: 14px; padding: 16px; }
.narrow { max-width: 460px; display: grid; gap: 12px; }
.hint { color: var(--soft); font-size: 13px; margin: 4px 0; }
.notice { margin: 0; padding: 10px 12px; border-radius: 9px; background: #FAEEDA; color: #633806; font-size: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand i { width: 32px; height: 32px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-style: normal; font-size: 13px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 380px; display: grid; gap: 14px; }

header { display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: var(--head); color: #fff; position: sticky; top: 0; z-index: 5; }
header .brand span { font-size: 15px; }
nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
nav::-webkit-scrollbar { display: none; }
nav a { color: #D3D1C7; text-decoration: none; padding: 7px 12px; border-radius: 8px; white-space: nowrap; font-size: 14px; }
nav a.on { background: #444441; color: #fff; }
.me { font-size: 13px; color: #D3D1C7; white-space: nowrap; }
.me .link { color: #D3D1C7; }
main { max-width: 1040px; margin: 0 auto; padding: 16px; }
h2 { margin: 4px 0 12px; font-size: 20px; }
h3 { margin: 0 0 4px; font-size: 17px; }
h4 { margin: 16px 0 6px; font-size: 14px; }

.office { border-radius: 14px; overflow: hidden; }
.office svg { display: block; width: 100%; height: auto; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.desk { cursor: pointer; outline: none; }
.desk:hover .deskTop, .desk:focus-visible .deskTop { stroke: var(--red); stroke-width: 3; }
@media (prefers-reduced-motion: no-preference) {
  .bob { animation: bob 1.3s ease-in-out infinite; transform-box: fill-box; }
  .blink { animation: blink 1.8s ease-in-out infinite; }
  .air { animation: blink 2.4s ease-in-out infinite; }
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.kpi { background: var(--card); border: 0.5px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; }
.kpi b { font-size: 24px; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--soft); font-size: 13px; }
.kpi small { color: var(--soft); font-size: 12px; margin-top: 2px; }

.sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 10; display: grid; place-items: center; padding: 16px; }
.sheetBody { position: relative; width: 100%; max-width: 620px; max-height: 86vh; overflow: auto; background: var(--card); border-radius: 16px; padding: 18px; }
.close { position: absolute; top: 10px; right: 10px; border: 0; font-size: 22px; line-height: 1; padding: 4px 10px; background: none; }
.sheetHead { display: flex; align-items: center; gap: 10px; padding-right: 36px; }
.now { margin: 8px 0 0; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pill { font-size: 12px; padding: 2px 9px; border-radius: 99px; background: #F1EFE8; color: #444441; white-space: nowrap; }
.pill.ok, .pill.approved { background: #EAF3DE; color: #27500A; }
.pill.wait, .pill.pending, .pill.changes_requested { background: #FAEEDA; color: #633806; }
.pill.down, .pill.rejected { background: #FCEBEB; color: #A60E1F; }
.errors { margin: 4px 0; padding-left: 18px; color: #A60E1F; font-size: 13px; }
table.tasks { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tasks td { padding: 5px 6px; border-top: 0.5px solid var(--line); }
table.tasks tr.failed td { color: #A60E1F; }
.journal ul { padding-left: 18px; font-size: 13px; }

.list { display: grid; gap: 10px; }
.epHead { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 0; margin: 12px 0 0; }
.steps li { border-top: 4px solid var(--line); padding-top: 6px; font-size: 13px; display: grid; }
.steps li small { color: var(--soft); font-size: 12px; }
.steps li.done { border-color: var(--ok); }
.steps li.run { border-color: var(--wait); }
.steps li.wait { border-color: #FAC775; }
.steps li.bad { border-color: var(--down); }
.steps li.skip { border-color: var(--off); }

.reels { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.reel { display: grid; gap: 10px; align-content: start; }
.reel.rejected, .reel.expired { opacity: .6; }
.reelHead { display: flex; align-items: center; gap: 8px; }
.reelHead .hint { margin-left: auto; }
.reel video { width: 100%; aspect-ratio: 9 / 16; max-height: 420px; background: #000; border-radius: 10px; }
.covers { display: flex; gap: 6px; }
.cover { padding: 0; border-radius: 8px; overflow: hidden; position: relative; width: 64px; min-height: 0; border: 2px solid transparent; }
.cover.chosen { border-color: var(--red); }
.cover img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.cover span { position: absolute; left: 3px; bottom: 3px; font-size: 11px; background: rgba(0, 0, 0, .65); color: #fff; padding: 0 5px; border-radius: 5px; }
.caption { white-space: pre-wrap; font-size: 13px; }
.edit { display: grid; gap: 6px; }

.scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--card); border-radius: 12px; overflow: hidden; }
table.data th { text-align: left; font-weight: 600; color: var(--soft); padding: 8px; border-bottom: 0.5px solid var(--line); white-space: nowrap; }
table.data td { padding: 7px 8px; border-top: 0.5px solid var(--line); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr.sum td { font-weight: 600; }
table.data tr.revoked td { color: var(--soft); text-decoration: line-through; }
.add { margin-top: 14px; }
.linkOnce { display: grid; gap: 6px; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #2C2C2A; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 20; max-width: calc(100% - 32px); }
.toast.bad { background: #A60E1F; }

@media (max-width: 719px) {
  header { flex-wrap: wrap; gap: 8px 12px; padding: 10px 12px; }
  nav { order: 3; flex-basis: 100%; }
  .me { margin-left: auto; }
  main { padding: 12px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .sheet { place-items: end stretch; padding: 0; }
  .sheetBody { max-width: none; border-radius: 16px 16px 0 0; max-height: 88vh; }
}
