/* =====================================================================
   VERUM DIGITAL DOSSIER — estilos
   Mobile first · sem dependências externas (Google Fonts opcional)
   ===================================================================== */

:root {
  --bg: #0A0E1A;
  --bg-2: #0F1526;
  --surface: #141B2E;
  --surface-2: #1A2238;
  --surface-3: #212B45;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #EEF2FA;
  --text-2: #A9B3C9;
  --text-3: #6F7A94;
  --accent: #4F7CFF;
  --accent-2: #6D92FF;
  --accent-soft: rgba(79, 124, 255, 0.14);
  --ok: #2ECC8A;
  --ok-soft: rgba(46, 204, 138, 0.14);
  --warn: #F5B544;
  --warn-soft: rgba(245, 181, 68, 0.14);
  --bad: #FF5C6C;
  --bad-soft: rgba(255, 92, 108, 0.14);
  --wa: #25D366;
  --gold: #E7B84B;            /* VERUM na marca — dourado legível sobre o fundo escuro */
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Sora', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* Tema claro (modo cliente) */
.theme-paper {
  --bg: #F3F5F9;
  --bg-2: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F6F8FC;
  --surface-3: #ECF0F7;
  --line: rgba(10, 14, 26, 0.08);
  --line-2: rgba(10, 14, 26, 0.16);
  --text: #0A0E1A;
  --text-2: #4A5570;
  --text-3: #7C8699;
  --accent: #2B5DFF;
  --accent-2: #1F4BE0;
  --accent-soft: rgba(43, 93, 255, 0.10);
  --shadow: 0 8px 24px rgba(10, 14, 26, 0.08);
  /* O dourado do tema escuro some sobre o branco: aqui vai um tom mais fechado. */
  --gold: #8F6B05;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body.theme-paper { background: var(--bg); }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 0.95rem; }
p { margin: 0; }
a { color: var(--accent-2); }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: 15px; }
::selection { background: var(--accent); color: #fff; }
.mono { font-family: var(--font-mono); font-size: 0.85em; }
.muted { color: var(--text-2); }
.small { font-size: 0.82rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Layout ---------- */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .container { display: flex; align-items: center; gap: 12px; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; letter-spacing: 0.02em; font-size: 0.95rem; text-decoration: none; color: var(--text); }
/* O ícone da marca tem arte própria (3D): sem fundo gradiente atrás dele. */
.brand .mark { width: 28px; height: 28px; display: grid; place-items: center; flex: none; }
.brand .mark img, .auth-logo .mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* "DIGITAL DOSSIER" fica no peso da marca; "VERUM" é o dourado que diferencia. */
.brand span.gold, .auth-logo h1 span.gold { color: var(--gold); }
.spacer { flex: 1; }
main { flex: 1; padding: 20px 0 calc(40px + var(--safe-b)); }
.page-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.page-head .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-title { font-size: 1.5rem; }
.eyebrow { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 0.9rem;
  cursor: pointer; text-decoration: none; min-height: 40px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--bad); border-color: rgba(255, 92, 108, 0.35); background: var(--bad-soft); }
.btn.danger:hover { background: rgba(255, 92, 108, 0.22); }
.btn.wa { background: rgba(37, 211, 102, 0.14); border-color: rgba(37, 211, 102, 0.35); color: var(--wa); }
.btn.wa:hover { background: rgba(37, 211, 102, 0.24); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { padding: 6px 10px; min-height: 32px; font-size: 0.82rem; }
.btn.block { width: 100%; }
.btn.icon { padding: 8px; width: 38px; min-height: 38px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Campos ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--text-2); }
.input, .textarea, .select {
  width: 100%; padding: 11px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* Placeholder discreto: é só exemplo, não pode competir com o texto digitado. */
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: .5; }
/* Campo de senha com botão de olho sobreposto à direita. */
.pw-field { position: relative; display: flex; }
.pw-field .input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 0; background: transparent; color: var(--text-3);
  border-radius: var(--radius-sm); cursor: pointer; padding: 0;
}
.pw-toggle:hover { color: var(--text); background: var(--surface-3); }
.pw-toggle svg { width: 18px; height: 18px; display: block; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.textarea.editor { min-height: 46vh; font-size: 15px; }
.select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.help { font-size: 0.78rem; color: var(--text-3); }
.error-text { color: var(--bad); font-size: 0.85rem; margin-top: 4px; }
.form-error { background: var(--bad-soft); color: var(--bad); border: 1px solid rgba(255,92,108,.3); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.88rem; margin-bottom: 14px; }
.form-ok { background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(46,204,138,.3); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.88rem; margin-bottom: 14px; }

/* Upload */
.dropzone {
  border: 1.5px dashed var(--line-2); border-radius: var(--radius); padding: 22px 14px; text-align: center;
  background: var(--bg-2); cursor: pointer; transition: border-color .15s, background .15s; color: var(--text-2);
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone strong { color: var(--text); }
.dropzone input { display: none; }
.dropzone .picked { margin-top: 8px; font-size: 0.85rem; color: var(--ok); word-break: break-all; }

/* Toggle */
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.toggle .t-label { font-weight: 600; font-size: 0.92rem; }
.toggle .t-help { font-size: 0.78rem; color: var(--text-3); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track { position: absolute; inset: 0; background: var(--surface-3); border-radius: 26px; transition: background .15s; cursor: pointer; border: 1px solid var(--line-2); }
.switch .track::after { content: ''; position: absolute; width: 20px; height: 20px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:disabled + .track { opacity: .5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.pad-lg { padding: 20px; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.folder-card { display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: border-color .15s, transform .1s; }
.folder-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.folder-card .f-head { display: flex; gap: 10px; align-items: flex-start; }
.folder-card .f-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); display: grid; place-items: center; font-size: 20px; flex: none; }
.folder-card.sub .f-icon { background: var(--surface-3); }
.folder-card .f-name { font-family: var(--font-head); font-weight: 600; font-size: 1rem; line-height: 1.3; word-break: break-word; }
.folder-card .f-desc { color: var(--text-2); font-size: 0.88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.folder-card .f-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 0.78rem; color: var(--text-3); }
.folder-card .f-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.02em; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.accent { background: var(--accent-soft); color: var(--accent-2); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Documentos (canvas) ---------- */
.section { margin-bottom: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-head h2 { display: flex; align-items: center; gap: 10px; }
.doc-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .doc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.doc-card {
  min-width: 0;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); cursor: pointer; transition: border-color .15s, background .15s;
  user-select: none; -webkit-user-select: none;
}
.doc-card:hover { border-color: var(--line-2); background: var(--surface-2); }
.doc-card.dragging { opacity: .4; }
.doc-card.drop-before { box-shadow: -3px 0 0 var(--accent); }
.doc-card .d-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center; font-size: 20px; flex: none; }
.doc-card .d-body { min-width: 0; flex: 1; }
.doc-card .d-name { font-weight: 600; font-size: 0.95rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-card .d-meta { font-size: 0.76rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-card .d-handle { color: var(--text-3); cursor: grab; padding: 4px; flex: none; touch-action: none; }
.doc-card .d-handle svg { width: 16px; height: 16px; }
.empty { text-align: center; color: var(--text-3); padding: 28px 14px; border: 1px dashed var(--line-2); border-radius: var(--radius); font-size: 0.9rem; }

/* Barra do link */
.link-bar { display: flex; flex-direction: column; gap: 10px; }
.link-box { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 8px 10px; min-width: 0; }
.link-box .url { font-family: var(--font-mono); font-size: 0.8rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.link-box.off .url { text-decoration: line-through; color: var(--text-3); }
@media (min-width: 720px) { .link-bar { flex-direction: row; align-items: center; } .link-box { flex: 1; } }

/* Progresso */
.progress { display: flex; flex-direction: column; gap: 6px; }
.progress .bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--ok)); border-radius: 99px; transition: width .3s; }
.progress .label { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-2); }
.progress .label b { color: var(--text); font-family: var(--font-head); }

/* Peças */
.part-group { margin-bottom: 18px; }
.part-group h3 { margin-bottom: 8px; color: var(--text-2); font-size: 0.78rem; letter-spacing: .1em; text-transform: uppercase; }
.part { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; }
.part .p-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.part .p-label { font-weight: 600; font-size: 0.93rem; }
.part .p-body { display: flex; flex-direction: column; gap: 8px; }
.part .p-file { display: flex; align-items: center; gap: 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.part .p-file .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface-3); flex: none; cursor: zoom-in; }
.part .p-file .thumb.pdf { display: grid; place-items: center; font-size: 20px; }
.part .p-file .name { flex: 1; min-width: 0; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part .p-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 0.76rem; color: var(--text-3); }
.part .p-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status-select { padding: 6px 30px 6px 10px; font-size: 0.8rem; font-weight: 600; border-radius: 999px; min-height: 30px; width: auto; }
.status-select.pending { color: var(--text-2); }
.status-select.sent { color: var(--warn); border-color: rgba(245,181,68,.4); }
.status-select.checked { color: var(--ok); border-color: rgba(46,204,138,.4); }
.status-select.rejected { color: var(--bad); border-color: rgba(255,92,108,.4); }
.radio-row { display: flex; gap: 8px; }
.radio-pill { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; font-weight: 600; font-size: 0.88rem; }
.radio-pill input { accent-color: var(--accent); }
.radio-pill.positive.on { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.radio-pill.negative.on { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.vis-toggle { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--text-2); }

/* Histórico */
.audit { display: flex; flex-direction: column; gap: 0; }
.audit-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.83rem; }
.audit-item:last-child { border-bottom: 0; }
.audit-item .when { color: var(--text-3); font-family: var(--font-mono); font-size: 0.74rem; flex: none; width: 110px; }
.audit-item .what { flex: 1; color: var(--text-2); }
.audit-item .what b { color: var(--text); font-weight: 600; }

/* ---------- Modais ---------- */
.modal-root { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(4, 7, 15, 0.7); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); padding: 0; animation: fade .15s; }
.modal { width: 100%; max-width: 640px; max-height: 94vh; background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px 20px 0 0; display: flex; flex-direction: column; animation: up .2s; box-shadow: var(--shadow); }
.modal.wide { max-width: 980px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.05rem; }
.modal-body { padding: 16px; overflow: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.modal-foot { padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (min-width: 640px) {
  .modal-root { align-items: center; padding: 20px; }
  .modal { border-radius: 18px; max-height: 90vh; }
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes up { from { transform: translateY(20px); opacity: 0 } to { transform: none; opacity: 1 } }

/* Seletor de tipo */
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
/* `color` explícito: sem ele o botão herda o preto padrão do navegador e some no fundo escuro. */
.type-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); cursor: pointer; font-weight: 600; font-size: 0.82rem; text-align: center; transition: border-color .15s, background .15s, color .15s; }
/* Emojis de cor própria não respondem a `color` — o filtro clareia os mais escuros (📎 🖼 ₿). */
.type-opt .ico { font-size: 22px; filter: brightness(1.35); }
.type-opt.on, .type-opt:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.theme-paper .type-opt .ico { filter: none; }

/* Fila do modal "Adicionar documentos" */
.queue-head { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.queue { display: flex; flex-direction: column; gap: 8px; }
.q-empty { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 16px 14px; text-align: center; color: var(--text-3); font-size: 0.84rem; }
.q-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--bg-2); }
.q-item.saving { opacity: .7; }
.q-item.done { border-color: rgba(46,204,138,.4); background: var(--ok-soft); }
.q-item.error { border-color: rgba(255,92,108,.4); background: var(--bad-soft); }
.q-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; font-size: 17px; flex: none; }
.q-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.q-body .input { padding: 7px 10px; font-size: 0.88rem; font-weight: 600; }
.q-meta { font-size: 0.76rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-meta.bad { color: var(--bad); white-space: normal; font-weight: 500; }
.q-actions { display: flex; align-items: center; gap: 6px; flex: none; padding-top: 2px; }

/* Visualizadores */
.viewer-frame { width: 100%; height: 70vh; border: 0; border-radius: var(--radius-sm); background: #fff; }
.viewer-img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: var(--radius-sm); cursor: zoom-in; background: var(--bg-2); }
.viewer-text { white-space: pre-wrap; word-break: break-word; line-height: 1.65; font-size: 15px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; min-height: 160px; }
.viewer-file { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px; text-align: center; background: var(--bg-2); border-radius: var(--radius-sm); }
.viewer-file .big { font-size: 46px; }
.kv { display: grid; grid-template-columns: 1fr; gap: 10px; }
.kv .k { font-size: 0.72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.kv .v { font-size: 0.95rem; word-break: break-all; }
.kv .v.addr { font-family: var(--font-mono); font-size: 0.86rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; }
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-soft); border: 1px solid rgba(245,181,68,.3); color: var(--warn); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 0.84rem; font-weight: 500; }
/* Aviso da seção de peças: ocupa a largura toda e empurra o botão de ação para a direita. */
.notice.warn, .notice.ok { align-items: center; margin-bottom: 12px; }
.notice.warn > span, .notice.ok > span { flex: 1; min-width: 0; line-height: 1.45; }
.notice.warn .btn { flex: none; }
.notice.ok { background: var(--ok-soft); border-color: rgba(46,204,138,.3); color: var(--ok); }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.92); display: grid; place-items: center; overflow: auto; cursor: zoom-out; animation: fade .15s; }
/* X fixo no canto: fechar precisa ser óbvio para quem só recebeu o link. */
.lightbox-close { position: fixed; top: 14px; right: 14px; z-index: 61; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.55); color: #fff; cursor: pointer; }
.lightbox-close:hover { background: rgba(0,0,0,.8); }
.lightbox-close svg { width: 20px; height: 20px; }
/* PDF e arquivo sem preview no mesmo modo ampliado: o cursor não é zoom-out dentro deles. */
.lightbox .fs-frame { width: min(1100px, 94vw); height: 94vh; border: 0; border-radius: var(--radius-sm); background: #fff; cursor: default; }
.lightbox .fs-file { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 32px; text-align: center; background: var(--surface); color: var(--text); border-radius: var(--radius); max-width: 92vw; cursor: default; }
.lightbox .fs-file .big { font-size: 46px; }
.lightbox img { max-width: 96vw; max-height: 96vh; object-fit: contain; }
.lightbox.zoomed { place-items: start center; cursor: zoom-out; }
.lightbox.zoomed img { max-width: none; max-height: none; width: 180vw; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; text-align: center; }
.auth-logo .mark { width: 64px; height: 64px; display: grid; place-items: center; }
.auth-logo h1 { font-size: 1.25rem; letter-spacing: .04em; }
.auth-logo p { color: var(--text-3); font-size: 0.85rem; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: 0.85rem; }
.auth-links a { color: var(--text-2); text-decoration: none; cursor: pointer; }
.auth-links a:hover { color: var(--text); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--surface-3); color: var(--text); border: 1px solid var(--line-2); border-radius: 12px; padding: 11px 14px; font-size: 0.88rem; box-shadow: var(--shadow); animation: up .2s; display: flex; gap: 8px; align-items: center; }
.toast.ok { border-color: rgba(46,204,138,.5); }
.toast.bad { border-color: rgba(255,92,108,.5); }

/* ---------- Público ---------- */
.public-head { padding: 26px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.public-head .eyebrow { margin-bottom: 8px; }
.public-head h1 { font-size: 1.6rem; margin-bottom: 6px; }
.public-head .desc { color: var(--text-2); max-width: 720px; }
.public-foot { text-align: center; color: var(--text-3); font-size: 0.78rem; padding: 30px 0 10px; }
.readonly-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 600; color: var(--text-2); background: var(--surface-3); padding: 4px 10px; border-radius: 999px; }
.unavailable { text-align: center; padding: 60px 20px; }
.unavailable .big { font-size: 48px; margin-bottom: 12px; }

/* ---------- Utilidades ---------- */
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-3) 50%, var(--surface) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); height: 90px; }
@keyframes sk { from { background-position: 200% 0 } to { background-position: -200% 0 } }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg) } }
.preview-banner { background: var(--accent-soft); color: var(--accent-2); border-bottom: 1px solid var(--line); font-size: 0.78rem; text-align: center; padding: 6px 12px; font-weight: 600; }

@media print {
  .topbar, .btn, .modal-foot, .toasts, .preview-banner { display: none !important; }
  body { background: #fff; color: #000; }
}
