/* "Cinematic Dark", o design system da Mandrill Filmes (mandrill-frontend/design.md). */
@font-face { font-family:"Inter"; font-weight:400; font-display:swap; src:url("fonts/inter-Regular.woff2") format("woff2"); }
@font-face { font-family:"Inter"; font-weight:600; font-display:swap; src:url("fonts/inter-SemiBold.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --page:#101110; --card:#171918; --sunken:#0C0D0C; --inner:#262A28; --border:#454D47;
  --title:#FFF0DB; --text:#BFC9C2; --muted:#6C746E;
  --orange:#FE6A0F; --orange-hover:#FF853D; --mint:#65E7A3; --mint-hover:#86EFB5; --red:#FF4B4B; --amber:#FEA00F;
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
html { scrollbar-color:var(--inner) var(--sunken); scrollbar-width:thin; }
body { margin:0; min-height:100vh; background:var(--page); color:var(--text); font:400 14px/1.45 "Inter", system-ui, sans-serif; -webkit-font-smoothing:antialiased; }
h1, h2, h3, p, dl, dd, fieldset { margin:0; padding:0; border:0; }
h1 { color:var(--title); font-size:32px; font-weight:600; line-height:40px; letter-spacing:-1.2px; overflow-wrap:anywhere; }
h2 { color:var(--title); font-size:16px; font-weight:600; line-height:20px; margin-bottom:16px; }
h3, th, legend { color:var(--muted); font-size:12px; font-weight:600; line-height:16px; }
strong { font-weight:600; }
button { font:inherit; color:inherit; background:none; border:0; padding:0; cursor:pointer; }
button:disabled { opacity:.5; cursor:default; }
:focus-visible { outline:2px solid var(--orange); outline-offset:2px; }
svg { display:block; flex:none; }
.wrap { width:100%; max-width:1224px; margin:0 auto; padding:0 24px; }
.sub, .muted { color:var(--muted); }
.sub { margin-top:4px; }
.hint { color:var(--muted); font-size:12px; line-height:18px; }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }

/* Botões */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:40px; padding:0 16px; border:1px solid transparent; border-radius:4px; font-weight:600; white-space:nowrap; transition:background-color .15s, border-color .15s, color .15s; }
.btn.primary { background:var(--orange); color:var(--sunken); }
.btn.primary:hover:not(:disabled) { background:var(--orange-hover); }
.btn.ghost { border-color:var(--border); }
.btn.ghost:hover:not(:disabled) { color:var(--title); border-color:var(--muted); background:var(--card); }
.btn.approve { background:var(--mint); color:var(--sunken); }
.btn.approve:hover:not(:disabled) { background:var(--mint-hover); }
.btn.reject { border-color:var(--red); color:var(--red); }
.btn.reject:hover:not(:disabled) { background:rgb(255 75 75 / .12); }
.btn.add { border-radius:41px; background:var(--sunken); border-color:var(--inner); padding-left:8px; }
.btn.add svg { width:24px; height:24px; padding:4px; border-radius:50%; background:var(--mint); color:var(--sunken); }
.btn.add:hover { background:var(--inner); }
.btn.wide { width:100%; min-height:48px; }
.link { display:inline-flex; align-items:center; gap:8px; color:var(--muted); font-weight:600; margin-bottom:16px; }
.link:hover { color:var(--title); }

/* Campos */
.field { margin-top:16px; min-width:0; }
legend { padding:0; }
.field > label, legend { display:block; color:var(--muted); font-size:12px; font-weight:400; margin-bottom:6px; }
input:not([type=radio]):not([type=checkbox]), textarea { font:inherit; width:100%; min-height:48px; padding:12px; border:1px solid transparent; border-radius:4px; background:var(--inner); color:var(--text); transition:border-color .15s; }
textarea { resize:vertical; }
input::placeholder { color:var(--muted); }
input:hover, textarea:hover { border-color:var(--muted); }
input:focus, textarea:focus { border-color:var(--orange); outline:none; }
input.code { font-size:18px; letter-spacing:8px; font-variant-numeric:tabular-nums; }
.alert { margin-top:16px; padding:10px 12px; border-radius:4px; background:rgb(255 75 75 / .1); color:var(--red); }

/* Entrada */
.gate { min-height:100vh; display:grid; place-items:center; padding:24px; }
.gate-card { width:100%; max-width:860px; display:grid; grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); background:var(--card); border:1px solid var(--inner); border-radius:5px; overflow:hidden; animation:rise .4s ease-out; }
.gate-card.single { max-width:460px; grid-template-columns:minmax(0,1fr); }
.gate-form { padding:40px; }
.gate-form > .field:first-child { margin-top:0; }
.gate-form .sub { margin-bottom:24px; overflow-wrap:anywhere; }
.gate-form .btn { margin:24px 0 16px; }
.gate-art { background:var(--sunken); }
.gate-art.qr { padding:40px 32px; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:12px; }
.gate-art.qr h2 { margin:0; }
.gate-art.qr img { width:200px; height:200px; border-radius:5px; margin:8px 0; }
code { font:600 12px/18px ui-monospace, Menlo, monospace; color:var(--title); overflow-wrap:anywhere; user-select:all; }
@keyframes rise { from { opacity:0; transform:translateY(16px); } }

/* Topo */
.top { border-bottom:1px solid var(--inner); background:var(--page); position:sticky; top:0; z-index:5; }
.top-row { display:flex; align-items:stretch; gap:40px; min-height:64px; }
.logo { display:flex; align-items:center; color:var(--title); font-size:16px; font-weight:600; }
.tabs { display:flex; gap:24px; flex:1; }
.tabs button { position:relative; display:flex; align-items:center; gap:8px; color:var(--muted); font-weight:600; }
.tabs button:hover { color:var(--text); }
.tabs button[aria-current] { color:var(--text); }
.tabs button[aria-current]::after { content:""; position:absolute; inset:auto 0 -1px; height:2px; background:var(--orange); }
.count { min-width:20px; padding:0 6px; border-radius:999px; background:var(--orange); color:var(--sunken); font-size:12px; line-height:18px; text-align:center; }
.who { display:flex; align-items:center; gap:16px; min-width:0; }
.who-text { text-align:right; line-height:18px; min-width:0; }
.who-text strong { display:block; color:var(--title); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:200px; }
.who-text span { color:var(--muted); font-size:12px; }

/* Páginas */
main { padding-top:40px !important; padding-bottom:64px !important; }
.page-head { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:24px; }
.card { background:var(--card); border:1px solid var(--inner); border-radius:5px; padding:24px; }
.card.accent { border-left:2px solid var(--orange); }
.tools { display:flex; align-items:center; gap:8px; }
.btn.square { width:40px; padding:0; }
#refresh:disabled svg { animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* Select */
.select { position:relative; }
.select-button { display:flex; align-items:center; gap:10px; width:240px; min-height:40px; padding:0 12px; border:1px solid transparent; border-radius:4px; background:var(--inner); text-align:left; font-weight:600; transition:border-color .15s; }
.select-button:hover { border-color:var(--muted); }
.select-button[aria-expanded=true] { border-color:var(--orange); }
.select-button > span:first-child { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.select small { color:var(--muted); font-size:12px; font-variant-numeric:tabular-nums; }
.select-button small { color:var(--orange); }
.chevron { color:var(--muted); transition:transform .15s; }
[aria-expanded=true] .chevron { transform:rotate(180deg); }
.select-list { position:absolute; z-index:4; top:calc(100% + 4px); right:0; width:100%; max-height:320px; overflow-y:auto; margin:0; padding:4px; list-style:none; background:var(--inner); border:1px solid var(--border); border-radius:4px; }
.select-list li { display:flex; align-items:center; gap:10px; min-height:40px; padding:0 10px; border-radius:4px; cursor:pointer; }
.select-list li > span { flex:1; min-width:0; overflow-wrap:anywhere; }
.select-list li:hover, .select-list li:focus { background:var(--card); color:var(--title); outline:none; }
.select-list li[aria-selected=true] { color:var(--orange); }
.select-list li[aria-selected=true] small { color:inherit; }

/* Tabelas */
.table-card { padding:0; overflow-x:auto; margin-top:0; }
.alert + .table-card { margin-top:16px; }
table { width:100%; border-collapse:collapse; }
th, td { text-align:left; padding:12px 16px; border-bottom:1px solid var(--inner); vertical-align:middle; }
th:first-child, td:first-child { padding-left:24px; }
th:last-child, td:last-child { padding-right:24px; }
tbody tr:last-child td { border-bottom:0; }
td { height:64px; }
.end { text-align:right; }
td strong { color:var(--title); display:block; overflow-wrap:anywhere; }
td small { color:var(--muted); font-size:12px; display:block; overflow-wrap:anywhere; }
td.end { white-space:nowrap; font-variant-numeric:tabular-nums; }
tr.open { cursor:pointer; transition:background-color .15s; }
tr.open:hover { background:var(--inner); }
tr.open:focus-visible { outline-offset:-2px; }
tr.off td > * { opacity:.5; }
.late { color:var(--amber); }
.row-actions { display:inline-flex; gap:4px; }
.icon-btn { display:inline-grid; place-items:center; width:36px; height:36px; border-radius:4px; color:var(--muted); }
.icon-btn:hover { background:var(--inner); color:var(--title); }
.icon-btn.danger:hover { color:var(--red); }
.empty { display:flex; flex-direction:column; align-items:center; gap:4px; padding:56px 24px; text-align:center; color:var(--muted); }
.empty > span { display:grid; place-items:center; width:56px; height:56px; border-radius:50%; background:var(--inner); color:var(--mint); margin-bottom:12px; }
.empty strong { color:var(--title); font-size:16px; }

/* Etiquetas */
.badges { display:flex; flex-wrap:wrap; gap:6px; }
.tag { display:inline-flex; align-items:center; padding:3px 10px; border:1px solid; border-radius:999px; font-size:12px; line-height:16px; white-space:nowrap; }
.tag.ok { color:var(--mint); border-color:rgb(101 231 163 / .35); background:rgb(101 231 163 / .07); }
.tag.bad { color:var(--red); border-color:rgb(255 75 75 / .4); background:rgb(255 75 75 / .08); }
.tag.warn { color:var(--amber); border-color:rgb(254 160 15 / .4); background:rgb(254 160 15 / .08); }
.tag.plain { color:var(--text); border-color:var(--border); }
.tag.brand { color:var(--orange); border-color:rgb(254 106 15 / .45); background:rgb(254 106 15 / .08); }

/* Caso */
.case-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.25fr); gap:16px; align-items:start; }
.stack { display:grid; gap:16px; min-width:0; }
.case-grid > .stack:first-child { position:sticky; top:80px; }
video { display:block; width:100%; max-height:60vh; border-radius:4px; background:#000; }
.moves { display:grid; gap:16px; margin-top:16px; }
.steps { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; color:var(--muted); }
.steps span { display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border-radius:4px; background:var(--inner); color:var(--text); font-size:12px; line-height:16px; }
.steps i { color:var(--muted); font-style:normal; }
#mirror { margin-top:12px; }
dl { display:grid; grid-template-columns:auto minmax(0,1fr); gap:10px 24px; }
dt { color:var(--muted); }
dd { color:var(--text); text-align:right; overflow-wrap:anywhere; }
dl.claimed { grid-template-columns:1fr 1fr; gap:16px 24px; }
dl.claimed div:first-child { grid-column:1/-1; }
dl.claimed dt { font-size:12px; }
dl.claimed dd { text-align:left; color:var(--title); font-size:18px; font-weight:600; line-height:24px; font-variant-numeric:tabular-nums; }
.docs { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.doc { position:relative; border-radius:4px; overflow:hidden; background:var(--sunken); border:1px solid var(--inner); cursor:zoom-in; aspect-ratio:8/5; }
.doc:hover { border-color:var(--muted); }
.doc img { display:block; width:100%; height:100%; object-fit:contain; }
.doc span { position:absolute; left:8px; bottom:8px; padding:2px 8px; border-radius:4px; background:rgb(12 13 12 / .8); font-size:12px; }
.match { margin-top:20px; }
.match-row { display:flex; justify-content:space-between; margin-bottom:8px; }
.match-row strong { color:var(--title); }
meter { display:block; width:100%; height:6px; border:0; border-radius:999px; background:var(--inner); overflow:hidden; appearance:none; }
meter::-webkit-meter-inner-element { display:block; }
meter::-webkit-meter-bar { height:6px; border:0; border-radius:999px; background:var(--inner); }
meter::-webkit-meter-optimum-value { background:var(--mint); border-radius:999px; }
meter::-webkit-meter-suboptimum-value, meter::-webkit-meter-even-less-good-value { background:var(--red); border-radius:999px; }
meter::-moz-meter-bar { background:var(--mint); }
meter:-moz-meter-sub-optimum::-moz-meter-bar, meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background:var(--red); }
#facts { margin-top:20px; padding-top:20px; border-top:1px solid var(--inner); }
#decision-card .field { margin-top:0; }
.actions { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:16px; }
.actions .btn { min-height:48px; }

/* Janelas */
dialog { color:inherit; border:0; padding:0; margin:auto; }
dialog::backdrop { background:rgb(0 0 0 / .6); }
.modal { width:90vw; max-width:520px; max-height:90vh; background:var(--card); border:1px solid var(--inner); border-radius:8px; }
.modal-head { padding:24px 24px 0; }
.modal-head h2 { margin:0; font-size:20px; line-height:28px; }
.modal-body { padding:8px 24px 24px; }
.modal-foot { display:flex; justify-content:flex-end; gap:12px; padding:16px 24px; border-top:1px solid var(--inner); }
.alert.strip { margin:0; border-radius:0; padding:12px 24px; }
.field > .choice { display:flex; gap:12px; padding:12px; border:1px solid var(--inner); border-radius:4px; cursor:pointer; margin:8px 0 0; }
.choice:hover { border-color:var(--border); }
.choice:has(:checked) { border-color:var(--orange); background:rgb(254 106 15 / .06); }
.choice strong { display:block; color:var(--title); }
.choice small { color:var(--muted); font-size:12px; }
input[type=radio], input[type=checkbox] { accent-color:var(--orange); width:16px; height:16px; margin:2px 0 0; flex:none; }
.chips { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.chips label { display:inline-flex; align-items:center; gap:8px; min-height:36px; padding:0 14px; border:1px solid var(--inner); border-radius:999px; cursor:pointer; }
.chips label:has(:checked) { border-color:var(--orange); color:var(--orange); }
.chips input { margin:0; }
.copy { display:flex; gap:8px; margin:16px 0 12px; }
.copy .btn { min-height:48px; }
.confirm { width:90vw; max-width:430px; padding:36px; border-radius:8px; background:var(--card); text-align:center; }
.confirm-icon { display:grid; place-items:center; width:85px; height:85px; margin:0 auto 32px; border-radius:50%; background:var(--inner); color:var(--orange); }
.confirm-icon svg { width:38px; height:38px; }
.confirm.danger .confirm-icon { color:var(--red); }
.confirm h2 { color:var(--text); }
.confirm p { color:var(--muted); font-size:16px; margin-bottom:32px; overflow-wrap:anywhere; }
.confirm-actions { display:flex; justify-content:center; gap:16px; }
.pill { padding:14px 28px; border:1px solid var(--border); border-radius:999px; font-size:11px; font-weight:600; line-height:16px; text-transform:uppercase; }
.pill:hover:not(:disabled) { color:var(--title); }
.pill.yes { background:var(--orange); border-color:var(--orange); color:var(--sunken); }
.pill.yes:hover:not(:disabled) { background:var(--orange-hover); color:var(--sunken); }
.confirm.danger .pill.yes { background:var(--red); border-color:var(--red); }
.viewer { width:100vw; height:100vh; max-width:none; max-height:none; background:rgb(0 0 0 / .94); overflow:auto; }
.viewer[open] { display:flex; }
.viewer img { margin:auto; max-width:100%; max-height:100%; object-fit:contain; cursor:zoom-in; }
/* Tamanho real: a imagem passa do tamanho da tela e a área rola. */
.viewer.zoomed img { max-width:none; max-height:none; cursor:zoom-out; }
.viewer .btn { position:fixed; top:16px; right:16px; background:var(--card); }
.toast { position:fixed; left:50%; bottom:24px; transform:translateX(-50%); z-index:20; max-width:90vw; padding:12px 20px; border:1px solid var(--border); border-radius:4px; background:var(--inner); color:var(--title); animation:rise-toast .2s ease-out; }
.update { position:fixed; right:24px; bottom:24px; z-index:15; display:flex; align-items:center; gap:24px; width:max-content; max-width:min(520px, calc(100vw - 32px)); padding:16px 20px; border:1px solid var(--border); border-left:2px solid var(--orange); border-radius:5px; background:var(--inner); animation:rise-toast .2s ease-out; }
.update strong { color:var(--title); }
.update p { margin-top:2px; font-size:12px; line-height:18px; }
@keyframes rise-toast { from { opacity:0; } }

@media (max-width:900px) {
  .top-row { flex-wrap:wrap; gap:0 16px; padding-top:8px; }
  .logo { flex:1; min-height:48px; }
  .tabs { order:3; flex-basis:100%; min-height:44px; overflow-x:auto; }
  .case-grid { grid-template-columns:minmax(0,1fr); }
  .case-grid > .stack:first-child { position:static; }
}
@media (max-width:640px) {
  .wrap { padding:0 16px; }
  main { padding-top:24px !important; }
  h1 { font-size:24px; line-height:32px; letter-spacing:-.6px; }
  .card { padding:16px; }
  .table-card { padding:0; }
  .page-head { flex-direction:column; align-items:flex-start; gap:16px; }
  .update { right:16px; bottom:16px; flex-direction:column; align-items:stretch; gap:12px; width:calc(100vw - 32px); }
  .tools, .select { width:100%; }
  .select-button { width:100%; }
  .btn.square { flex:none; }
  .who-text { display:none; }
  .gate { padding:0; }
  .gate-card, .gate-card.single { max-width:none; grid-template-columns:minmax(0,1fr); border:0; min-height:100vh; align-content:center; }
  .gate-form { padding:24px; }
  /* O QR vem antes do formulário que pede o código. */
  .gate-art.qr { order:-1; padding:24px; }
  /* Tabela vira lista: cada linha, um bloco. */
  thead { display:none; }
  tbody tr { display:grid; gap:8px; padding:16px; border-bottom:1px solid var(--inner); }
  tbody tr:last-child { border-bottom:0; }
  td, td:first-child, td:last-child { display:block; height:auto; padding:0; border:0; }
  td.end { text-align:left; }
  .copy { flex-direction:column; }
  dl.claimed { grid-template-columns:1fr; }
}
@media (prefers-reduced-motion:reduce) { * { animation:none !important; transition:none !important; } }
