/* Prancheta — fundo preto, traço e letras brancas, visual técnico. */
/* Letra manuscrita (Kalam, SIL OFL 1.1 — fontes/OFL-Kalam.txt), hospedada aqui mesmo */
@font-face { font-family: "Kalam"; font-style: normal; font-weight: 400; font-display: swap; src: url(/prancheta/fontes/kalam-400.woff2) format("woff2"); }
@font-face { font-family: "Kalam"; font-style: normal; font-weight: 700; font-display: swap; src: url(/prancheta/fontes/kalam-700.woff2) format("woff2"); }
:root {
  --fundo: #000; --painel: #0d1014; --painel2: #151a20; --linha: #262d36; --linha2: #36404c;
  --texto: #f3f6fa; --fraco: #8b96a5; --acento: #5ad8ff; --ok: #7ee787; --aviso: #ffd866; --perigo: #ff6b6b;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --manu: "Kalam", "Comic Neue", cursive;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--fundo); color: var(--texto); font: 14px/1.45 var(--sans); }
body { overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
code, kbd { font-family: var(--mono); font-size: .92em; }
kbd { border: 1px solid var(--linha2); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--painel2); }
code { background: var(--painel2); border-radius: 4px; padding: 0 4px; }

/* ---------- login ---------- */
#login { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; background: radial-gradient(circle at 30% 20%, #0b1a24, #000 60%); padding: 16px; }
.login-cartao { width: min(440px, 100%); background: var(--painel); border: 1px solid var(--linha); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-cartao h1 { margin: 0; font: 700 34px/1 var(--sans); letter-spacing: -.02em; }
.login-cartao .sub { margin: 0; color: var(--fraco); }
.gbtn { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border: 0; border-radius: 8px; padding: 10px 14px; font-weight: 600; cursor: pointer; }
.gbtn svg { width: 20px; height: 20px; }
#login-msg { min-height: 1.2em; margin: 0; color: var(--aviso); }
.legal { font-size: 12px; color: var(--fraco); margin: 0; }
.legal a, .voltar { color: var(--acento); }
.voltar { font-size: 13px; }
.langs { display: flex; gap: 2px; }
.langs button { background: transparent; border: 1px solid transparent; color: var(--fraco); border-radius: 6px; padding: 3px 7px; font-size: 12px; cursor: pointer; }
.langs button.on { color: var(--texto); border-color: var(--linha2); }
body.bloqueado #app { visibility: hidden; }

/* ---------- barra ---------- */
#app { position: fixed; inset: 0; display: grid; grid-template-rows: auto auto 1fr; }
#barra { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--linha); background: var(--fundo); flex-wrap: wrap; z-index: 5; }
#nome { background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 5px 8px; font-weight: 600; font-size: 15px; width: min(280px, 40vw); }
#nome:hover, #nome:focus { border-color: var(--linha2); outline: none; }
.btb { background: var(--painel); border: 1px solid var(--linha); border-radius: 7px; padding: 5px 10px; cursor: pointer; white-space: nowrap; }
.btb:hover { border-color: var(--linha2); background: var(--painel2); }
.btb.ia { border-color: #3a3170; color: #c9c2ff; }
.espaco { flex: 1; }
#quem { color: var(--fraco); font-size: 12px; font-family: var(--mono); }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--fraco); font-size: 12px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--fraco); }
.status[data-s="saved"] i { background: var(--ok); }
.status[data-s="saving"] i, .status[data-s="loading"] i { background: var(--aviso); }
.status[data-s="error"] i { background: var(--perigo); }
.status[data-s="readonly"] i { background: var(--acento); }
#faixa { padding: 6px 14px; background: #08202a; color: #bfeeff; font-size: 13px; border-bottom: 1px solid var(--linha); }

/* ---------- palco e tela ---------- */
#barra { grid-row: 1; } #faixa { grid-row: 2; }
#palco { grid-row: 3; position: relative; overflow: hidden; min-height: 0; }
#tela { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: var(--fundo); touch-action: none; user-select: none; -webkit-user-select: none; }
#tela:focus { outline: none; }
#tela.sem-grade #fundo-grade { display: none; }
#tela[data-ferr="mao"], #tela.arrastando-tela { cursor: grab; }
#tela.arrastando-tela:active { cursor: grabbing; }
#tela[data-ferr="ret"], #tela[data-ferr="elipse"], #tela[data-ferr="losango"], #tela[data-ferr="seta"], #tela[data-ferr="linha"], #tela[data-ferr="caneta"], #tela[data-ferr="escrita"], #tela[data-ferr="frame"], #tela[data-ferr="oracle"] { cursor: crosshair; }
#tela[data-ferr="texto"] { cursor: text; }
#tela .el { cursor: move; }
#tela[data-ferr="mao"] .el { cursor: inherit; }
#tela text { font-family: var(--sans); dominant-baseline: middle; }
#tela text:not([fill]) { fill: var(--texto); }
#tela .mono { font-family: var(--mono); }
#tela text.manu, #tela-apr text.manu { font-family: var(--manu); }
#tela .escrevendo { opacity: .55; animation: pulsar 1s ease-in-out infinite alternate; }
@keyframes pulsar { from { opacity: .35; } to { opacity: .8; } }
#tela .res { fill: var(--acento); font-weight: 600; }
#tela .res.err { fill: #6b7480; font-weight: 400; font-style: italic; }
#tela .def { fill: #9fb2c8; }
#tela .ligacao-nome { fill: var(--acento); text-decoration: underline; }
#tela .tema { fill: var(--aviso); }
.alca { fill: #000; stroke: var(--acento); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.alca-especial { fill: var(--acento); stroke: #000; stroke-width: 1; vector-effect: non-scaling-stroke; cursor: ew-resize; }
.sel-caixa { fill: none; stroke: var(--acento); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.marquee { fill: rgba(90, 216, 255, .08); stroke: var(--acento); stroke-width: 1; vector-effect: non-scaling-stroke; }
.guia { stroke: #ff5bd1; stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; }
.alvo-seta { fill: none; stroke: var(--acento); stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; opacity: .8; }

#editor { position: absolute; z-index: 6; background: rgba(0, 0, 0, .85); color: var(--texto); border: 1px solid var(--acento); border-radius: 4px; padding: 2px 4px; resize: none; overflow: hidden; outline: none; white-space: pre; font-family: var(--sans); line-height: 1.3; }

/* ---------- ferramentas ---------- */
#ferramentas { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 4px; background: var(--painel); border: 1px solid var(--linha); border-radius: 12px; padding: 6px; z-index: 4; }
#ferramentas button { width: 38px; height: 38px; display: grid; place-items: center; background: transparent; border: 1px solid transparent; border-radius: 8px; cursor: pointer; color: var(--texto); }
#ferramentas button:hover { background: var(--painel2); }
#ferramentas button.on { background: #0c2c3a; border-color: #1f5f78; color: var(--acento); }
#ferramentas svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#ferramentas .sep { height: 1px; background: var(--linha); margin: 3px 4px; }
body.leitura #ferramentas button:not([data-ferr="selecionar"]):not([data-ferr="mao"]) { display: none; }
body.leitura #ferramentas .sep { display: none; }

.menu { position: absolute; left: 62px; z-index: 7; background: var(--painel); border: 1px solid var(--linha2); border-radius: 10px; padding: 8px; box-shadow: 0 12px 30px rgba(0, 0, 0, .6); max-height: 70vh; overflow: auto; }
.menu h5 { margin: 6px 4px 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--fraco); font-weight: 600; }
.menu .grade-icones { display: grid; grid-template-columns: repeat(4, 74px); gap: 4px; }
.menu .grade-icones button { display: flex; flex-direction: column; align-items: center; gap: 4px; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 2px; cursor: pointer; font-size: 11px; color: var(--fraco); }
.menu .grade-icones button:hover { background: var(--painel2); border-color: var(--linha); color: var(--texto); }
.menu .grade-icones svg { width: 36px; height: 36px; fill: none; stroke: var(--texto); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.menu .itens button { display: block; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 6px; padding: 6px 10px; cursor: pointer; }
.menu .itens button:hover { background: var(--painel2); }

/* ---------- propriedades da seleção ---------- */
#propriedades { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 140px); background: var(--painel); border: 1px solid var(--linha); border-radius: 10px; padding: 5px 6px; }
#propriedades button { min-width: 30px; height: 30px; background: transparent; border: 1px solid transparent; border-radius: 6px; cursor: pointer; padding: 0 6px; font-size: 13px; }
#propriedades button:hover { background: var(--painel2); }
#propriedades button.on { border-color: var(--acento); color: var(--acento); }
#propriedades .cor { width: 22px; height: 22px; min-width: 22px; padding: 0; border-radius: 50%; border: 2px solid transparent; }
#propriedades .cor.on { border-color: #fff; }
#propriedades .sep { width: 1px; height: 22px; background: var(--linha); margin: 0 3px; }
#propriedades svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }

/* ---------- cantos: minimapa e zoom ---------- */
#cantos { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; z-index: 4; }
#minimapa { width: 200px; height: 130px; background: rgba(13, 16, 20, .9); border: 1px solid var(--linha); border-radius: 8px; cursor: pointer; }
.zoom { display: flex; gap: 2px; background: var(--painel); border: 1px solid var(--linha); border-radius: 8px; padding: 3px; }
.zoom button { background: transparent; border: 0; border-radius: 6px; min-width: 30px; height: 28px; cursor: pointer; }
.zoom button:hover { background: var(--painel2); }
.zoom button.on { color: var(--acento); }
#bt-zoom { min-width: 54px; font-family: var(--mono); font-size: 12px; }

/* ---------- apresentação ---------- */
#apresentacao { position: fixed; inset: 0; z-index: 40; background: #000; }
#tela-apr { position: absolute; inset: 0; width: 100%; height: 100%; }
#tela-apr text { font-family: var(--sans); dominant-baseline: middle; }
#tela-apr text:not([fill]) { fill: var(--texto); }
#tela-apr .res { fill: var(--acento); font-weight: 600; }
#laser { position: absolute; inset: 0; pointer-events: none; }
.apr-controles { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; background: rgba(13, 16, 20, .85); border: 1px solid var(--linha); border-radius: 10px; padding: 6px 10px; opacity: .25; transition: opacity .2s; }
.apr-controles:hover { opacity: 1; }
.apr-controles button { background: var(--painel2); border: 1px solid var(--linha); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
#apr-pos { font-family: var(--mono); color: var(--fraco); min-width: 60px; text-align: center; }
.apr-op { font-size: 12px; color: var(--fraco); display: flex; gap: 4px; align-items: center; }

/* ---------- diálogos ---------- */
dialog { background: var(--painel); color: var(--texto); border: 1px solid var(--linha2); border-radius: 12px; padding: 18px 20px; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog.largo { width: min(760px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .65); }
dialog h3 { margin: 0 0 8px; font-size: 18px; }
dialog h4 { margin: 14px 0 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--fraco); }
dialog section + section { border-top: 1px solid var(--linha); margin-top: 10px; }
.nota { color: var(--fraco); font-size: 13px; margin: 4px 0; }
.nota.inline { display: flex; gap: 6px; align-items: center; }
.msg { min-height: 1.3em; font-size: 13px; color: var(--acento); margin: 6px 0; white-space: pre-wrap; }
.msg.erro { color: var(--perigo); }
.linha { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: flex-end; }
.linha.inicio { justify-content: flex-start; }
.linha.entre { justify-content: space-between; }
.radios label { display: flex; gap: 6px; align-items: center; }
.btn { background: var(--painel2); border: 1px solid var(--linha2); border-radius: 7px; padding: 6px 12px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { border-color: #4a5664; }
.btn.primario { background: #0f4a63; border-color: #1d7aa1; }
.btn.perigo { border-color: #7a2a2a; color: #ffb3b3; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=email], input[type=search], textarea, select { width: 100%; background: #07090c; border: 1px solid var(--linha2); border-radius: 7px; padding: 7px 9px; }
textarea { font-family: var(--mono); font-size: 13px; resize: vertical; }
.campo { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--fraco); margin-top: 8px; }
.campo.largo { flex: 1; min-width: 200px; }
.lista { list-style: none; margin: 10px 0 0; padding: 0; max-height: 52vh; overflow: auto; }
.lista li { border-top: 1px solid var(--linha); padding: 9px 2px; }
.lista .topo { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.lista .nm { font-weight: 600; }
.lista .meta { font-size: 12px; color: var(--fraco); }
.lista .aberta { font-size: 11px; color: var(--acento); margin-left: 8px; text-transform: uppercase; letter-spacing: .06em; }
.confirmar { margin-top: 8px; padding: 8px; border: 1px solid #7a2a2a; border-radius: 8px; display: flex; flex-direction: column; gap: 6px; }
.pessoas { list-style: none; padding: 0; margin: 8px 0 0; }
.pessoas li { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--linha); }
.pessoas li span { flex: 1; }
.pessoas select { width: auto; }
.pessoas button { background: transparent; border: 0; color: var(--perigo); cursor: pointer; }
.abas { display: flex; gap: 4px; margin-bottom: 6px; }
.abas button { background: transparent; border: 1px solid var(--linha); border-radius: 7px; padding: 5px 10px; cursor: pointer; color: var(--fraco); }
.abas button.on { color: var(--texto); border-color: var(--acento); }
.ajuda { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 4px 18px; }
.ajuda p { margin: 0 0 6px; font-size: 13px; color: #c9d1db; }
.numeros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0; }
.numeros div { background: var(--painel2); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; }
.numeros b { font-size: 20px; }
.numeros span { font-size: 12px; color: var(--fraco); }
.tabela { max-height: 50vh; overflow: auto; }
.tabela table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela th, .tabela td { text-align: left; padding: 6px; border-bottom: 1px solid var(--linha); }
.pilula { font-size: 11px; border-radius: 10px; padding: 1px 7px; border: 1px solid var(--linha2); }
.pilula.ok { color: var(--ok); }
.pilula.off { color: var(--perigo); }
.confirmar-caixa { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }

#aviso { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s; background: #e9eef4; color: #0b0f14; border-radius: 9px; padding: 9px 14px; display: flex; gap: 12px; align-items: center; z-index: 60; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
#aviso.visivel { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#aviso button { background: transparent; border: 1px solid #0b0f14; border-radius: 6px; padding: 3px 9px; cursor: pointer; color: inherit; }

@media (max-width: 760px) {
  #barra { gap: 4px; }
  #nome { width: 100%; }
  #minimapa { display: none; }
  #ferramentas { top: auto; bottom: 64px; transform: none; flex-direction: row; flex-wrap: wrap; max-width: calc(100% - 24px); }
  #ferramentas .sep { width: 1px; height: auto; margin: 4px 2px; }
  .menu { left: 12px; bottom: 120px; }
}
@media print {
  body > *:not(#impressao) { display: none !important; }
}
#propriedades .fonte-manu { font-family: var(--manu); font-size: 16px; }
