/* Produtor — back-office. Sem fontes externas: o painel interno não faz requisições a terceiros. */

:root {
  color-scheme: dark;
  --bg: #0e0d0c; --surface: #161412; --surface-2: #1e1b18;
  --line: rgba(243, 238, 230, .10); --line-2: rgba(243, 238, 230, .18);
  --text: #f4efe7; --muted: #a8a095; --faint: #8c8579;
  --accent: #ffb224; --accent-ink: #1c1200; --accent-text: #ffc255;
  --ok: #62d6b6; --warn: #ffb224; --bad: #ff8f80; --info: #86adff;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 14px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f2ea; --surface: #fffdf9; --surface-2: #f3eee4;
  --line: rgba(28, 22, 14, .11); --line-2: rgba(28, 22, 14, .20);
  --text: #1b1712; --muted: #61594e; --faint: #6f675a;
  --accent-text: #9a5a00; --ok: #0c8a6c; --warn: #a86500; --bad: #c4402f; --info: #2f5fd0;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2 { margin: 0; line-height: 1.15; letter-spacing: -.02em; }
h1 { font-size: 1.7rem; font-weight: 750; }
h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; }
p { margin: 0; }
a { color: var(--accent-text); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }

/* ---- Estrutura ---- */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 22px 16px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.main { padding: 32px clamp(18px, 4vw, 48px) 72px; width: 100%; max-width: 1240px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; padding: 0 8px; }
.brand svg { width: 30px; height: 30px; flex: none; } .brand .accent { fill: var(--accent); }
.brand span { display: grid; font-weight: 800; font-size: 1.25rem; letter-spacing: -.04em; line-height: 1.05; }
.brand small { font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.brand-lg svg { width: 40px; height: 40px; } .brand-lg span { font-size: 1.6rem; }
.side-nav { display: grid; gap: 2px; }
.nav-item { display: block; padding: 9px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 550; }
.nav-item:hover { color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .74rem; font-weight: 700; text-align: center; line-height: 20px; }
.nav-item.on { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.side-foot { margin-top: auto; display: grid; gap: 12px; }
.who { display: grid; padding: 0 8px; min-width: 0; } .who strong { font-weight: 650; } .who span { color: var(--muted); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; }
.side-actions { display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 14px 16px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .side-foot { margin-top: 0; }
  .main { padding-top: 22px; }
}

/* ---- Cabeçalhos, cartões, grades ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.crumb { font-size: .85rem; color: var(--faint); margin-bottom: 4px; } .crumb a { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; margin-top: 18px; }
.card.flush { padding: 0; overflow-x: auto; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; } .card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 800px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin: 6px 0 4px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; display: grid; gap: 2px; }
.stat strong { font-size: 1.9rem; letter-spacing: -.03em; line-height: 1.15; }
.stat-label { font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bar-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); } .bar-row:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 14px; margin: 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.usage { display: grid; gap: 18px; } .usage label { display: block; }
progress { display: block; width: 100%; height: 10px; margin-top: 8px; accent-color: var(--accent); }
.empty { padding: 28px; color: var(--muted); text-align: center; }

/* ---- Tabelas ---- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.table th.right { text-align: right; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--text) 3%, transparent); }
.table-tight th, .table-tight td { padding: 9px 12px; }
.card:not(.flush) .table th:first-child, .card:not(.flush) .table td:first-child { padding-left: 0; }
.card:not(.flush) .table th:last-child, .card:not(.flush) .table td:last-child { padding-right: 0; }

/* ---- Etiquetas e alertas ---- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .74rem; font-weight: 650; vertical-align: middle; margin-left: 4px; border: 1px solid transparent; }
.badge:first-child { margin-left: 0; }
.b-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.b-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.b-bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 15%, transparent); }
.b-info { color: var(--info); background: color-mix(in srgb, var(--info) 15%, transparent); }
.b-muted { color: var(--muted); background: color-mix(in srgb, var(--text) 8%, transparent); }
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; border: 1px solid var(--line-2); }
.a-ok { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); background: color-mix(in srgb, var(--ok) 11%, transparent); }
.a-err { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); background: color-mix(in srgb, var(--bad) 11%, transparent); }
.a-info { border-color: color-mix(in srgb, var(--info) 50%, var(--line)); background: color-mix(in srgb, var(--info) 11%, transparent); }
.secret { padding: 16px 18px; border-radius: 12px; margin-bottom: 14px; border: 1px dashed var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); display: grid; gap: 10px; }
.secret-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.secret code { white-space: pre-line; word-break: break-all; line-height: 1.7; font-size: 1.15rem; font-weight: 700; letter-spacing: .04em; padding: 6px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line-2); user-select: all; }

/* ---- Formulários e botões ---- */
.stack { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; } .field label, .fieldset legend { font-size: .88rem; font-weight: 650; }
.field-narrow { max-width: 260px; }
.hint { font-size: .84rem; color: var(--muted); }
.input { width: 100%; padding: 10px 13px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font: inherit; }
.input::placeholder { color: var(--faint); }
.input-sm { width: 170px; padding: 6px 10px; font-size: .84rem; display: inline-block; margin-right: 4px; }
.input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent); }
textarea.input { resize: vertical; min-height: 90px; }
.form-narrow { max-width: 480px; } .form-wide { max-width: 760px; }
.fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 16px; display: grid; gap: 12px; margin: 0; } .fieldset legend { padding: 0 6px; }
.checks { display: flex; gap: 22px; flex-wrap: wrap; } .check { display: flex; align-items: center; gap: 8px; cursor: pointer; } .check input { accent-color: var(--accent); width: 17px; height: 17px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 16px; } .filters .input { width: auto; min-width: 170px; flex: 1 1 170px; max-width: 320px; }
.inline-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .88rem; } .inline-label .input { min-width: 0; flex: 0 0 auto; width: 160px; }
.inline { display: inline; margin: 0; }
.inline-form { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; } .inline-form .input { max-width: 320px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid transparent; font: 600 .92rem/1.2 var(--font); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.btn-sm { padding: 6px 12px; font-size: .84rem; }
.btn-block { width: 100%; padding: 12px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); } .btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, #fff); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); } .btn-ghost:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.btn-danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 55%, transparent); } .btn-danger:hover { background: color-mix(in srgb, var(--bad) 13%, transparent); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }

/* ---- Acesso e erros ---- */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px; display: grid; gap: 20px; box-shadow: 0 40px 80px -50px rgba(0, 0, 0, .7); }
.auth-card h1 { font-size: 1.5rem; }
.qr { width: 220px; max-width: 100%; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2); background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
.setup-grid { display: grid; grid-template-columns: 220px 1fr; gap: 26px; align-items: start; }
@media (max-width: 700px) { .setup-grid { grid-template-columns: 1fr; } }
.keybox { font-family: var(--mono); font-size: 1.05rem; letter-spacing: .08em; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line-2); display: inline-block; user-select: all; word-break: break-all; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.code-input { font-size: 1.35rem; letter-spacing: .25em; text-align: center; font-family: var(--mono); }
.err-code { font-size: 4rem; font-weight: 800; letter-spacing: -.05em; color: var(--accent-text); line-height: 1; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
