:root {
  --bg: #eef1f6;
  --panel: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --hover: #f6f8fc;
  --hover-forte: #e5e9f2;
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #9ca3af;
  --line: #e2e6ee;
  --line-2: #cfd6e4;
  --line-hover: #b9c2d6;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #e8efff;
  --brand-border: #c7d8ff;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --ok-ink: #047857;
  --ok-line: #a7f3d0;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-ink: #991b1b;
  --danger-line: #fca5a5;
  --warn-bg: #fff7ed;
  --warn-line: #fed7aa;
  --warn-ink: #9a3412;
  --neutral-soft: #f1f5f9;
  --neutral-ink: #475569;
  --toast-bg: #111827;
  --toast-ink: #ffffff;
  --overlay-busy: rgba(255,255,255,.72);
  --fundo-acesso: linear-gradient(160deg, #eef2fb 0%, #e6ebf7 100%);
  /* a folha do documento é sempre branca, nos dois temas:
     o PDF precisa ser visto como ele realmente é */
  --paper: #ffffff;
  --paper-borda: transparent;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.10);
  --shadow-md: 0 4px 12px rgba(16,24,40,.08), 0 2px 4px rgba(16,24,40,.06);
  --shadow-lg: 0 24px 48px -12px rgba(16,24,40,.25);
  --r: 10px;
  color-scheme: light;
}

/* ───────────── Tema escuro ─────────────
   O atributo é aplicado por tema.js antes da primeira pintura;
   "automático" resolve a preferência do sistema e grava o mesmo atributo. */
:root[data-tema="escuro"] {
  --bg: #0f141c;
  --panel: #171d27;
  --surface: #1e2532;
  --surface-2: #232b3a;
  --hover: #2a3342;
  --hover-forte: #333e50;
  --ink: #e8ecf3;
  --ink-2: #a9b4c5;
  --ink-3: #6d798c;
  --line: #29313f;
  --line-2: #3a4455;
  --line-hover: #4c5869;
  --brand: #5a92ff;
  --brand-dark: #7ba8ff;
  --brand-soft: #1a2540;
  --brand-border: #2f4470;
  --ok: #10b981;
  --ok-soft: #12301f;
  --ok-ink: #4ade80;
  --ok-line: #1c5638;
  --danger: #f87171;
  --danger-soft: #37191c;
  --danger-ink: #fca5a5;
  --danger-line: #7c3236;
  --warn-bg: #37260f;
  --warn-line: #7a5314;
  --warn-ink: #fbbf24;
  --neutral-soft: #262e3c;
  --neutral-ink: #9aa6b8;
  --toast-bg: #2b3446;
  --toast-ink: #eef2f8;
  --overlay-busy: rgba(15,20,28,.78);
  --fundo-acesso: linear-gradient(160deg, #131924 0%, #0d1219 100%);
  --paper-borda: #38424f;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,.45), 0 2px 4px rgba(0,0,0,.3);
  --shadow-lg: 0 24px 48px -12px rgba(0,0,0,.65);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* `display:flex` nas regras abaixo venceria o estilo padrão de [hidden] */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ───────────── Topbar ───────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  z-index: 20;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 8px; margin-right: 4px; }
.brand-mark {
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .5px;
  padding: 5px 8px; border-radius: 7px;
}
.brand-name { font-weight: 650; letter-spacing: -.2px; }

.toolbar-group { display: flex; align-items: center; gap: 6px; }
.spacer { flex: 1; }

/* ───────────── Botões ───────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  border-radius: 9px;
  font-size: 13px; font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  transition: background .13s, border-color .13s, transform .06s, box-shadow .13s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--hover); border-color: var(--line-hover); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-save { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-save:hover:not(:disabled) { background: #047857; border-color: #047857; }
.btn-danger { color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger-line); }
.btn-icon { padding: 8px; }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-tiny { padding: 3px 7px; font-size: 13px; line-height: 1.3; border-radius: 7px; }
.link { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }

/* ───────────── Layout ───────────── */
.layout { flex: 1; display: flex; min-height: 0; }

/* ───────────── Sidebar ───────────── */
.sidebar {
  width: 216px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidebar-head { padding: 12px 14px 8px; border-bottom: 1px solid var(--line); }
.sidebar-title { font-weight: 650; font-size: 13px; display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.chip { background: var(--brand-soft); color: var(--brand-dark); border-radius: 20px; padding: 1px 8px; font-size: 11px; font-weight: 650; }
.mini-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); cursor: pointer; user-select: none; }
.mini-check input { accent-color: var(--brand); margin: 0; }

.bulk-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; background: var(--brand-soft);
  border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 600; color: var(--brand-dark);
}
.bulk-actions { display: flex; gap: 3px; margin-left: auto; }

.thumbs { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 9px; }

.thumb {
  position: relative;
  border: 2px solid transparent;
  border-radius: var(--r);
  background: var(--surface-2);
  padding: 6px;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, opacity .12s;
}
.thumb:hover { border-color: var(--line-2); }
.thumb.current { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.thumb.checked { background: var(--brand-soft); }
.thumb.dragging { opacity: .35; }
.thumb.drop-before { box-shadow: 0 -3px 0 0 var(--brand); }
.thumb.drop-after  { box-shadow: 0 3px 0 0 var(--brand); }

.thumb-canvas-wrap {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 5px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  min-height: 60px;
}
.thumb canvas { display: block; max-width: 100%; height: auto; }
.thumb-bar { display: flex; align-items: center; gap: 5px; margin-top: 6px; }
.thumb-num { font-size: 11px; font-weight: 650; color: var(--ink-2); }
.thumb-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-left: 1px; }
.thumb-acts { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.thumb:hover .thumb-acts, .thumb.current .thumb-acts { opacity: 1; }
.thumb-acts button {
  border: 0; background: transparent; cursor: pointer;
  font-size: 12px; line-height: 1; padding: 3px 4px; border-radius: 5px; color: var(--ink-2);
}
.thumb-acts button:hover { background: var(--hover-forte); color: var(--ink); }
.thumb-acts button.del:hover { background: var(--danger-soft); color: var(--danger); }
.thumb-check { position: absolute; top: 10px; left: 10px; accent-color: var(--brand); z-index: 2; }

/* ───────────── Workspace ───────────── */
.workspace { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.tools {
  display: flex; align-items: center; gap: 3px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.tools-spacer { flex: 1; }
.tool {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent; background: transparent;
  padding: 7px 11px; border-radius: 9px;
  font: inherit; font-size: 13px; font-weight: 550; color: var(--ink-2);
  cursor: pointer; transition: background .12s, color .12s;
}
.tool:hover { background: var(--surface-2); color: var(--ink); }
.tool.active { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand-border); }
.zoom { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
#zoomLabel { min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }

/* Painel de propriedades */
.props {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-size: 12px; color: var(--ink-2);
}
.props .grp { display: flex; align-items: center; gap: 6px; }
.props label { font-weight: 600; }
.props input[type="number"] { width: 58px; padding: 4px 6px; border: 1px solid var(--line-2); border-radius: 6px; font: inherit; }
.props input[type="range"] { width: 90px; accent-color: var(--brand); }
.props select { padding: 4px 6px; border: 1px solid var(--line-2); border-radius: 6px; font: inherit; background: var(--surface); color: var(--ink); }
.props .sep { width: 1px; height: 18px; background: var(--line-2); }

.swatches { display: flex; gap: 5px; }
.swatch {
  width: 22px; height: 22px; border-radius: 6px; cursor: pointer;
  background: var(--c); border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px var(--line-2);
}
.swatch.active { box-shadow: 0 0 0 2px var(--brand); }

/* ───────────── Área do documento ───────────── */
.canvas-area { flex: 1; overflow: auto; position: relative; padding: 26px; display: flex; justify-content: center; }

.empty { margin: auto; text-align: center; max-width: 420px; color: var(--ink-2); }
.empty-art svg { width: 64px; height: 64px; stroke: var(--ink-3); stroke-width: 1.2; margin-bottom: 12px; }
.empty h2 { font-size: 19px; color: var(--ink); margin: 0 0 8px; font-weight: 650; }
.empty p { margin: 0 0 18px; line-height: 1.55; }

.page-stage { margin: auto; }
.page-wrap {
  position: relative;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
  border-radius: 3px;
  line-height: 0;
}
.page-wrap canvas { display: block; border-radius: 3px; }
.overlay { position: absolute; inset: 0; line-height: normal; }
.overlay.tool-text   { cursor: text; }
.overlay.tool-sign,
.overlay.tool-image,
.overlay.tool-check  { cursor: copy; }
.overlay.tool-rect,
.overlay.tool-blur,
.overlay.tool-draw   { cursor: crosshair; }

.page-nav { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px 0 4px; font-size: 12px; color: var(--ink-2); }

/* ───────────── Anotações ───────────── */
.ann { position: absolute; box-sizing: border-box; }
.ann.selected { outline: 1.5px solid var(--brand); outline-offset: 1px; }
.ann:not(.locked) { cursor: move; }

.ann-text {
  white-space: pre;
  font-family: Helvetica, Arial, sans-serif;
  transform-origin: 0 0;
  padding: 0; margin: 0;
  outline-offset: 2px;
}
.ann-text[contenteditable="true"] { cursor: text; outline: 1.5px solid var(--brand); background: rgba(255,255,255,.6); }
/* vale para ann-image, ann-sign, ann-check e ann-draw — a imagem precisa
   acompanhar a caixa, senão fica no tamanho natural e ignora o redimensionamento */
.ann > img, .ann > svg { width: 100%; height: 100%; display: block; pointer-events: none; }
.ann-rect { border-radius: 1px; }

/* área de desfoque ainda sendo desenhada */
.ann-blur.drafting {
  background: rgba(37, 99, 235, .16);
  border: 1.5px dashed var(--brand);
  backdrop-filter: blur(4px);
}
.brush-cursor {
  position: absolute; border-radius: 50%;
  border: 1.5px solid var(--brand); background: rgba(37, 99, 235, .12);
  pointer-events: none; transform: translate(-50%, -50%); z-index: 5;
}
.warn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink);
  padding: 3px 8px; border-radius: 7px; font-size: 12px;
}
.props .mini-check { font-weight: 600; color: var(--ink-2); }

.handle {
  position: absolute; width: 11px; height: 11px;
  background: var(--panel); border: 1.5px solid var(--brand); border-radius: 3px;
  right: -6px; bottom: -6px; cursor: nwse-resize;
}
/* alças de eixo único: esticam só a largura ou só a altura */
.handle-e { right: -6px; bottom: auto; top: 50%; margin-top: -5.5px; cursor: ew-resize; }
.handle-s { bottom: -6px; right: auto; left: 50%; margin-left: -5.5px; cursor: ns-resize; }
.ann-del {
  position: absolute; top: -11px; right: -11px;
  width: 21px; height: 21px; border-radius: 50%;
  background: var(--danger); color: #fff; border: 2px solid var(--panel);
  font-size: 11px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}

/* ───────────── Modal ───────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(17,24,39,.5);
  display: flex; align-items: center; justify-content: center; z-index: 60;
  padding: 20px; backdrop-filter: blur(2px);
}
.modal {
  background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 620px; max-height: 92vh; overflow: auto;
}
.modal-head { display: flex; align-items: center; padding: 16px 18px 10px; }
.modal-head h3 { margin: 0; font-size: 16px; flex: 1; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px 18px; border-top: 1px solid var(--line); margin-top: 6px; }

.tabs { display: flex; gap: 2px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.tab {
  border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-3);
  padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); }
.tab-panel { display: none; padding: 16px 18px 6px; }
.tab-panel.active { display: block; }

.pad-wrap { position: relative; }
#signPad {
  width: 100%; height: 190px;
  border: 2px dashed var(--line-2); border-radius: 10px;
  background: repeating-linear-gradient(0deg, #fff, #fff 24px, #f1f4f9 24px, #f1f4f9 25px);
  touch-action: none; cursor: crosshair; display: block;
}
.pad-hint { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-size: 12px; color: #9ca3af; pointer-events: none; }
.row { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.range { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.range input { accent-color: var(--brand); }

.input-lg { width: 100%; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 9px; font: inherit; font-size: 15px; }
.input-lg:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.font-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.font-choice {
  border: 1.5px solid var(--line-2); background: #fff; border-radius: 9px;
  padding: 10px; cursor: pointer; font-size: 26px; min-height: 58px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  color: var(--ink); white-space: nowrap;
}
.font-choice.active { border-color: var(--brand); background: var(--brand-soft); }

.drop-zone { border: 2px dashed var(--line-2); border-radius: 10px; padding: 26px; text-align: center; color: var(--ink-2); }
.drop-zone.over { border-color: var(--brand); background: var(--brand-soft); }
.drop-zone p { margin: 0 0 6px; }
.drop-zone small { color: var(--ink-3); }
.preview { margin-top: 12px; text-align: center; background: #fff; border-radius: 9px; padding: 12px; }
.preview img { max-width: 100%; max-height: 130px; }

.saved-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.saved-item { position: relative; border: 1.5px solid var(--line-2); border-radius: 9px; padding: 10px; background: #fff; cursor: pointer; min-height: 66px; display: flex; align-items: center; justify-content: center; }
.saved-item.active { border-color: var(--brand); background: var(--brand-soft); }
.saved-item img { max-width: 100%; max-height: 52px; }
.saved-item .rm { position: absolute; top: 3px; right: 5px; border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 13px; }
.saved-item .rm:hover { color: var(--danger); }
.muted { color: var(--ink-3); font-size: 13px; text-align: center; }

/* ───────────── Diversos ───────────── */
.drop-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(37,99,235,.14); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
.drop-overlay div {
  background: var(--panel); padding: 22px 34px; border-radius: 14px;
  border: 2.5px dashed var(--brand); font-size: 17px; font-weight: 650; color: var(--brand-dark);
  box-shadow: var(--shadow-lg);
}

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--toast-bg); color: var(--toast-ink); padding: 11px 18px; border-radius: 10px;
  font-size: 13px; z-index: 80; box-shadow: var(--shadow-lg); max-width: 80vw;
}
.toast.err { background: var(--danger); }

.busy {
  position: fixed; inset: 0; z-index: 90;
  background: var(--overlay-busy); backdrop-filter: blur(2px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  font-size: 14px; color: var(--ink-2); font-weight: 550;
}
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line-2); border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────── Telas de entrar / sair ───────────── */

body.tela-acesso {
  display: block;
  overflow: auto;
  background: var(--fundo-acesso);
  padding: 40px 20px;
}
.cartao-acesso {
  max-width: 380px; margin: 4vh auto;
  background: var(--panel); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 30px 28px 24px;
}
.cartao-acesso h1 { font-size: 19px; margin: 0 0 6px; text-align: center; }
.cartao-acesso .sub { color: var(--ink-2); font-size: 13px; line-height: 1.55; margin: 0 0 20px; text-align: center; }
.form { display: flex; flex-direction: column; gap: 13px; }
.campo { display: flex; flex-direction: column; gap: 5px; }
.campo span { font-size: 12px; font-weight: 650; color: var(--ink-2); }
.campo input {
  padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 9px;
  font: inherit; font-size: 15px; width: 100%;
}
.campo input:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.campo-codigo { letter-spacing: 9px; text-align: center; font-size: 22px !important; font-variant-numeric: tabular-nums; }
.btn-bloco { justify-content: center; width: 100%; padding: 11px; font-size: 14px; text-decoration: none; }
.bloco-centro { display: block; margin: 2px auto 0; font-size: 12.5px; }
.aviso-suave { background: var(--brand-soft); color: var(--brand-dark); border-radius: 9px; padding: 10px 12px; font-size: 12.5px; margin: 0; line-height: 1.5; }
.msg { margin-top: 14px; padding: 10px 12px; border-radius: 9px; font-size: 13px; line-height: 1.45; }
.msg.erro { background: var(--danger-soft); color: var(--danger-ink); border: 1px solid var(--danger-line); }
.msg.ok { background: var(--ok-soft); color: var(--ok-ink); border: 1px solid var(--ok-line); }
.rodape-acesso { text-align: center; margin: 20px 0 0; font-size: 12.5px; }
.rodape-acesso a { color: var(--ink-3); text-decoration: none; }
.rodape-acesso a:hover { color: var(--brand); }

/* ───────────── Acervo ───────────── */

.conta-btn { display: inline-flex; align-items: center; gap: 7px; }
.conta-email { font-size: 11px; color: var(--ink-3); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lista-arqs { display: flex; flex-direction: column; gap: 9px; max-height: 52vh; overflow-y: auto; }
.arq {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
  display: flex; align-items: center; gap: 12px; background: var(--surface);
}
.arq:hover { border-color: var(--line-2); background: var(--surface-2); }
.arq-info { flex: 1; min-width: 0; }
.arq-nome { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arq-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.arq-acoes { display: flex; gap: 5px; flex-shrink: 0; }
.selo {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .3px;
}
.selo-editado { background: var(--ok-soft); color: var(--ok-ink); }
.selo-original { background: var(--neutral-soft); color: var(--neutral-ink); }
.vazio-acervo { text-align: center; color: var(--ink-3); padding: 26px 10px; font-size: 13px; line-height: 1.6; }

/* campos de formulário acompanham o tema (sem isso ficam brancos no escuro) */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], textarea, select {
  background: var(--surface);
  color: var(--ink);
}
input::placeholder { color: var(--ink-3); }

/* a folha branca precisa de contorno para não “flutuar” no fundo escuro */
.page-wrap { outline: 1px solid var(--paper-borda); outline-offset: 0; }
.thumb-canvas-wrap { border-color: var(--line-2); }

/* botão de tema */
.btn-tema { padding: 8px; }
.btn-tema svg { width: 17px; height: 17px; }

@media (max-width: 760px) {
  .sidebar { width: 148px; }
  .tool span { display: none; }
  .brand-name { display: none; }
}

/* Áreas que representam papel (quadro de assinatura, amostras de fonte,
   pré-visualizações) seguem claras mesmo no tema escuro: a tinta é escura
   e precisa ser vista como sairá no PDF. */
:root[data-tema="escuro"] .font-choice { color: #111827; }
:root[data-tema="escuro"] .font-choice.active { background: #eef4ff; border-color: var(--brand); }
:root[data-tema="escuro"] .saved-item.active { background: #eef4ff; }
:root[data-tema="escuro"] #signPad { border-color: #cfd6e4; }
:root[data-tema="escuro"] .drop-zone { border-color: var(--line-2); }
