/* ==========================================================================
   Stardust — estilos
   Paleta irmã do Imaginarium: carvão e grafite com azul de destaque e um
   "espectro" (ciano → azul → violeta → magenta → laranja) como assinatura.
   Modo escuro (padrão) e claro; a aparência Nebulosa fica em nebulosa-skin.css.
   ========================================================================== */
:root {
  --bg0: #17181b; --bg1: #1e1f22; --bg2: #27292d; --bg3: #313439; --bg4: #3b3f45; --bg5: #474c54;
  --line: #121315; --line-soft: #383b41;
  --text: #d6d9de; --text-dim: #9da2ab; --text-faint: #6f747d;
  --accent: #4d8fd6; --accent-strong: #3577c0; --accent-soft: rgba(77, 143, 214, .2); --accent-ink: #ffffff;
  --ok: #5fc48b; --danger: #d9655e; --warn: #e3b341;
  --spectrum: linear-gradient(90deg, #19c6f5, #4f6bff 28%, #a244f5 52%, #f23fb0 76%, #ff8a2b);
  --ui-font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", "Noto Sans", Ubuntu, Roboto, sans-serif;
  --cell-font: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
  --radius: 8px; --radius-s: 6px;
  --shadow: 0 14px 40px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 0, 0, .55);
  /* planilha */
  --sheet: #1c1d21; --sheet-ink: #e4e6ea; --sheet-grid: #2c2f35;
  --hdr: #222428; --hdr-ink: #8e94a0; --hdr-sel: #2a3a50; --hdr-sel-ink: #a9cdf5;
  --sel: #4d8fd6; --sel-fill: rgba(77, 143, 214, .16); --freeze: #6f7785;
  --chart-bg: #222428; --chart-ink: #e4e6ea; --chart-ink2: #9da2ab; --chart-grid: rgba(255, 255, 255, .08);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg0: #e9ebf0; --bg1: #f7f8fa; --bg2: #ffffff; --bg3: #eef0f4; --bg4: #e2e6ed; --bg5: #d3d8e1;
  --line: #d3d7df; --line-soft: #dfe3ea;
  --text: #22262e; --text-dim: #5b6170; --text-faint: #8c93a1;
  --accent: #2f74c0; --accent-strong: #235f9f; --accent-soft: rgba(47, 116, 192, .13); --accent-ink: #ffffff;
  --shadow: 0 14px 40px rgba(30, 40, 60, .18), 0 0 0 1px rgba(30, 40, 60, .1);
  --sheet: #ffffff; --sheet-ink: #1b1d24; --sheet-grid: #e3e6ec;
  --hdr: #f3f4f7; --hdr-ink: #6b7280; --hdr-sel: #dce9f8; --hdr-sel-ink: #1d4f91;
  --sel: #2f74c0; --sel-fill: rgba(47, 116, 192, .12); --freeze: #9aa3b2;
  --chart-bg: #ffffff; --chart-ink: #222631; --chart-ink2: #5b6170; --chart-grid: rgba(120, 130, 150, .2);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg0: #e9ebf0; --bg1: #f7f8fa; --bg2: #ffffff; --bg3: #eef0f4; --bg4: #e2e6ed; --bg5: #d3d8e1;
    --line: #d3d7df; --line-soft: #dfe3ea; --text: #22262e; --text-dim: #5b6170; --text-faint: #8c93a1;
    --accent: #2f74c0; --accent-strong: #235f9f; --accent-soft: rgba(47, 116, 192, .13);
    --shadow: 0 14px 40px rgba(30, 40, 60, .18), 0 0 0 1px rgba(30, 40, 60, .1);
    --sheet: #ffffff; --sheet-ink: #1b1d24; --sheet-grid: #e3e6ec; --hdr: #f3f4f7; --hdr-ink: #6b7280; --hdr-sel: #dce9f8; --hdr-sel-ink: #1d4f91;
    --sel: #2f74c0; --sel-fill: rgba(47, 116, 192, .12); --freeze: #9aa3b2;
    --chart-bg: #ffffff; --chart-ink: #222631; --chart-ink2: #5b6170; --chart-grid: rgba(120, 130, 150, .2);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg0); color: var(--text); font: 13px/1.4 var(--ui-font); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

#app { display: grid; grid-template-rows: auto auto auto 1fr auto; height: 100%; min-height: 0; }

/* ---------- topo ---------- */
#topo { display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 8px; background: var(--bg1); position: relative; min-height: 46px; }
#topo::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--spectrum); opacity: .85; }
.marca { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 8px 4px 4px; border-radius: var(--radius); color: var(--text); flex: none; }
.marca:hover { background: var(--bg3); }
.marca .nome { font-weight: 700; font-size: 16px; letter-spacing: .2px; background: var(--spectrum); -webkit-background-clip: text; background-clip: text; color: transparent; }
.marca .nb-by { color: var(--text-dim); }
#menus { display: flex; gap: 1px; margin-left: 4px; }
#menus button { background: none; border: 0; padding: 6px 10px; border-radius: var(--radius-s); color: var(--text-dim); font-size: 13px; }
#menus button:hover, #menus button[aria-expanded="true"] { background: var(--bg3); color: var(--text); }
.doc { flex: 1; min-width: 80px; display: flex; align-items: center; justify-content: center; gap: 8px; }
#docNome { background: transparent; border: 1px solid transparent; border-radius: var(--radius-s); padding: 4px 8px; text-align: center; min-width: 60px; width: min(320px, 100%); font-weight: 600; color: var(--text); }
#docNome:hover { border-color: var(--line-soft); }
#docNome:focus { border-color: var(--accent); background: var(--bg2); outline: none; }
.estado { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.estado.sujo { color: var(--warn); }
.acoes { display: flex; align-items: center; gap: 4px; }
.ib { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-s); background: none; border: 0; color: var(--text-dim); padding: 0; }
.ib:hover { background: var(--bg3); color: var(--text); }
.ib:disabled { opacity: .35; pointer-events: none; }
.bt { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: var(--radius-s); background: var(--bg3); border: 1px solid var(--line-soft); color: var(--text); white-space: nowrap; }
.bt:hover { background: var(--bg4); }
.bt.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.bt.pri:hover { background: var(--accent-strong); }
.bt.perigo { background: transparent; border-color: var(--danger); color: var(--danger); }
.bt i, .bt svg { pointer-events: none; }

/* ---------- barra de ferramentas (cápsulas) ---------- */
#ferramentas { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 10px; background: var(--bg0); border-bottom: 1px solid var(--line); }
.grp { display: flex; align-items: center; gap: 1px; background: var(--bg2); border: 1px solid var(--line-soft); border-radius: 10px; padding: 2px; }
.grp .tb { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 28px; height: 28px; padding: 0 6px; border: 0; background: none; border-radius: 7px; color: var(--text-dim); font-size: 12.5px; }
.grp .tb:hover { background: var(--bg4); color: var(--text); }
.grp .tb[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
:root[data-theme="light"] .grp .tb[aria-pressed="true"] { color: var(--accent-strong); }
.grp .tb.txt { font-weight: 600; }
.grp .tb .barra { display: block; width: 16px; height: 3px; border-radius: 2px; margin-top: -2px; }
.grp .tb.cor { flex-direction: column; gap: 1px; }
.grp .tb.seta { min-width: 16px; padding: 0 2px; }
.grp select { height: 28px; background: transparent; border: 0; border-radius: 7px; padding: 0 4px; color: var(--text); font-size: 12.5px; }
.grp select:hover { background: var(--bg4); }
#tbFonte { width: 104px; } #tbTam { width: 50px; } #tbFormato { width: 118px; }
.grp select option { background: var(--bg2); color: var(--text); }
.grp .sep { width: 1px; height: 18px; background: var(--line-soft); margin: 0 3px; }
.grp.destaque { background: linear-gradient(var(--bg2), var(--bg2)) padding-box, var(--spectrum) border-box; border: 1px solid transparent; }
.grp.destaque .tb { color: var(--text); }
.ferr-spacer { flex: 1; }

/* ---------- barra de fórmulas ---------- */
#formula { display: flex; align-items: stretch; gap: 6px; padding: 6px 10px; background: var(--bg0); }
.caixanome input { width: 96px; height: 30px; background: var(--bg2); border: 1px solid var(--line-soft); border-radius: 15px; padding: 0 12px; text-align: center; font-weight: 600; color: var(--text); }
.caixanome input:focus { border-color: var(--accent); outline: none; }
.fx { width: 34px; height: 30px; border-radius: 15px; border: 1px solid var(--line-soft); background: var(--bg2); color: var(--accent); font-style: italic; font-weight: 700; font-family: Georgia, serif; font-size: 15px; }
.fx:hover { background: var(--bg4); }
.fbarwrap { flex: 1; position: relative; min-width: 0; }
#fbar { width: 100%; min-height: 30px; max-height: 120px; resize: none; background: var(--bg2); border: 1px solid var(--line-soft); border-radius: 15px; padding: 6px 14px; color: var(--text); font: 13px/1.35 var(--cell-font); overflow: auto; display: block; }
#fbar:focus { border-color: var(--accent); outline: none; }
#dicaSintaxe { position: absolute; left: 10px; top: calc(100% + 4px); z-index: 60; background: var(--bg2); border: 1px solid var(--line-soft); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--text-dim); box-shadow: var(--shadow); max-width: min(520px, 90vw); }
#dicaSintaxe b { color: var(--text); }
#dicaSintaxe .arg-on { color: var(--accent); font-weight: 700; }

/* ---------- corpo: grade + painel ---------- */
#corpo { display: flex; min-height: 0; background: var(--bg0); padding: 0 10px 0; gap: 8px; }
#grade { position: relative; flex: 1; min-width: 0; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 10px 10px 0 0; background: var(--sheet); outline: none; }
#grade .gc { position: absolute; left: 0; top: 0; }
#grade .gs { position: absolute; inset: 0; overflow: auto; }
#grade .gsz { pointer-events: none; }
#grade .glayer { position: absolute; overflow: hidden; pointer-events: none; }
#grade .ged { position: absolute; z-index: 5; resize: none; border: 2px solid var(--sel); border-radius: 0; padding: 2px 4px; margin: 0; outline: none; opacity: 0; pointer-events: none; overflow: hidden; white-space: pre; line-height: 1.25; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
#grade .ged.on { opacity: 1; pointer-events: auto; }
#grade .ged.on.longe { opacity: 0; pointer-events: none; }
/* [Nebulosa] comentário da célula (ao passar o mouse) e janelas de regras */
.notapop { position: absolute; z-index: 9; max-width: 260px; background: #fffbe0; color: #2b2a1c; border: 1px solid #e3d78a; border-left: 3px solid #e5484d; padding: 6px 10px; border-radius: 8px; font-size: 12.5px; line-height: 1.4; pointer-events: none; box-shadow: var(--shadow); white-space: pre-wrap; word-break: break-word; }
.notapop b { display: block; font-size: 11.5px; margin-bottom: 2px; }
.regras { display: flex; flex-direction: column; gap: 6px; max-height: 210px; overflow: auto; margin: 4px 0 0; padding: 0; list-style: none; }
.regras li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line-soft); border-radius: 10px; font-size: 13px; }
.regras li .amostra { flex: none; width: 54px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 600; border: 1px solid var(--line-soft); }
.regras li .txt { flex: 1; min-width: 0; }
.regras li .txt small { display: block; color: var(--text-faint); }
.regras .vazio { color: var(--text-faint); font-size: 13px; border-style: dashed; }
.amostras { display: flex; flex-wrap: wrap; gap: 6px; }
.amostras button { border: 2px solid transparent; border-radius: 8px; padding: 5px 10px; font: 600 12.5px var(--ui-font, inherit); cursor: pointer; }
.amostras button[aria-pressed="true"] { border-color: var(--accent, #a778ff); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #a778ff) 30%, transparent); }
.listaval { max-height: 260px; overflow: auto; min-width: 160px; }
.sizetip { position: absolute; z-index: 9; background: var(--bg1); color: var(--text); border: 1px solid var(--line-soft); padding: 3px 8px; border-radius: 6px; font-size: 12px; pointer-events: none; box-shadow: var(--shadow); }
.chart { position: absolute; left: 0; top: 0; pointer-events: auto; border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .28); border: 1px solid var(--line-soft); background: var(--chart-bg); overflow: visible; cursor: move; }
.chart canvas { display: block; border-radius: 10px; }
.chart .h { position: absolute; width: 10px; height: 10px; background: var(--bg2); border: 2px solid var(--accent); border-radius: 50%; display: none; }
.chart.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.chart.sel .h { display: block; }
.chart .nw { left: -6px; top: -6px; cursor: nwse-resize; } .chart .ne { right: -6px; top: -6px; cursor: nesw-resize; }
.chart .sw { left: -6px; bottom: -6px; cursor: nesw-resize; } .chart .se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.chart .n { left: calc(50% - 5px); top: -6px; cursor: ns-resize; } .chart .s { left: calc(50% - 5px); bottom: -6px; cursor: ns-resize; }
.chart .w { top: calc(50% - 5px); left: -6px; cursor: ew-resize; } .chart .e { top: calc(50% - 5px); right: -6px; cursor: ew-resize; }

#painel { width: 300px; flex: none; display: flex; flex-direction: column; background: var(--bg1); border: 1px solid var(--line-soft); border-radius: 10px 10px 0 0; min-height: 0; }
#painel[hidden] { display: none; }
.pabas { display: flex; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line-soft); }
.pabas button[role=tab] { flex: 1; background: none; border: 0; padding: 6px; border-radius: 7px; color: var(--text-dim); font-weight: 600; }
.pabas button[aria-selected="true"] { background: var(--bg3); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.pcorpo { flex: 1; overflow: auto; padding: 10px 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.pcorpo h4 { margin: 6px 0 0; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-faint); }
.pcorpo p { margin: 0; color: var(--text-dim); }
.campo { display: flex; flex-direction: column; gap: 4px; }
.campo label, .campo > span { font-size: 12px; color: var(--text-dim); }
.in, select.in, textarea.in { height: 30px; background: var(--bg2); border: 1px solid var(--line-soft); border-radius: var(--radius-s); padding: 0 8px; color: var(--text); width: 100%; }
textarea.in { height: auto; padding: 6px 8px; }
.in:focus { border-color: var(--accent); outline: none; }
.linha { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.linha > .in { flex: 1; }
.chk { display: flex; gap: 8px; align-items: center; color: var(--text); cursor: pointer; }
.chk input { accent-color: var(--accent); width: 15px; height: 15px; }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line-soft); border-radius: 8px; padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 6px; color: var(--text-dim); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.tipos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tipos button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 6px; background: var(--bg2); border: 1px solid var(--line-soft); border-radius: 8px; color: var(--text-dim); font-size: 11px; }
.tipos button svg { width: 26px; height: 26px; }
.tipos button[aria-pressed="true"] { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.flist { display: flex; flex-direction: column; gap: 1px; }
.flist button { text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 6px; color: var(--text); display: flex; flex-direction: column; gap: 1px; }
.flist button small { color: var(--text-faint); font-size: 11.5px; }
.flist button:hover, .flist button.on { background: var(--bg3); }
.fdet { background: var(--bg2); border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.fdet code { font-family: var(--cell-font); color: var(--accent); font-size: 13px; word-break: break-word; }
.vazio { color: var(--text-faint); text-align: center; padding: 20px 8px; }

/* ---------- rodapé ---------- */
#rodape { display: flex; align-items: center; gap: 10px; padding: 0 10px 6px; background: var(--bg0); min-height: 40px; }
.abaswrap { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; padding-top: 6px; border-top: 1px solid var(--line-soft); }
#abas { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; min-width: 0; padding: 2px; }
.aba { position: relative; display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line-soft); color: var(--text-dim); white-space: nowrap; font-size: 12.5px; }
.aba:hover { color: var(--text); background: var(--bg3); }
.aba[aria-selected="true"] { color: var(--text); background: linear-gradient(var(--bg3), var(--bg3)) padding-box, var(--spectrum) border-box; border-color: transparent; font-weight: 600; }
.aba .cor { width: 8px; height: 8px; border-radius: 50%; }
.aba.arrastando { opacity: .5; }
.aba input { width: 110px; background: var(--bg2); border: 1px solid var(--accent); border-radius: 6px; padding: 1px 6px; color: var(--text); }
#status { display: flex; gap: 14px; color: var(--text-dim); font-size: 12px; white-space: nowrap; padding-top: 6px; }
#status b { color: var(--text); font-weight: 600; }
#status .modo { color: var(--accent); }
.zoom { display: flex; align-items: center; gap: 2px; padding-top: 6px; }
.zoom input { width: 90px; accent-color: var(--accent); }
#zoomTxt { width: 42px; text-align: right; color: var(--text-dim); font-size: 12px; }

/* ---------- menus suspensos ---------- */
#menupop { position: fixed; z-index: 80; min-width: 230px; max-width: min(340px, 94vw); max-height: 80vh; overflow: auto; background: var(--bg2); border: 1px solid var(--line-soft); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; }
#menupop button.mi { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 6px; color: var(--text); font-size: 13px; }
#menupop button.mi:hover, #menupop button.mi:focus-visible { background: var(--accent-soft); outline: none; }
#menupop button.mi kbd { margin-left: auto; font: 11.5px var(--ui-font); color: var(--text-faint); }
#menupop button.mi .ico { width: 16px; display: grid; place-items: center; color: var(--text-dim); }
#menupop button.mi:disabled { opacity: .4; }
#menupop hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 6px; }
#menupop .mh { padding: 6px 10px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-faint); }
.paleta { padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.paleta .cores { display: grid; grid-template-columns: repeat(10, 20px); gap: 3px; }
.paleta .cores button { width: 20px; height: 20px; border-radius: 4px; border: 1px solid rgba(128, 128, 128, .35); padding: 0; }
.paleta .cores button:hover { transform: scale(1.15); border-color: var(--accent); }
.paleta .lnk { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 6px 4px; color: var(--text); border-radius: 6px; text-align: left; }
.paleta .lnk:hover { background: var(--bg3); }
.filtrobox { padding: 8px; display: flex; flex-direction: column; gap: 6px; width: 260px; }
.filtrobox .lista { max-height: 240px; overflow: auto; background: var(--bg1); border: 1px solid var(--line-soft); border-radius: 6px; padding: 4px; display: flex; flex-direction: column; }
.filtrobox .lista label { display: flex; gap: 6px; align-items: center; padding: 3px 4px; border-radius: 4px; cursor: pointer; }
.filtrobox .lista label:hover { background: var(--bg3); }

/* ---------- autocompletar ---------- */
#autoc { position: fixed; z-index: 85; background: var(--bg2); border: 1px solid var(--line-soft); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; min-width: 240px; max-height: 260px; overflow: auto; }
#autoc button { display: flex; flex-direction: column; width: 100%; text-align: left; background: none; border: 0; padding: 5px 8px; border-radius: 5px; color: var(--text); }
#autoc button small { color: var(--text-faint); font-size: 11.5px; }
#autoc button.on { background: var(--accent-soft); }

/* ---------- janelas ---------- */
#modal { position: fixed; inset: 0; z-index: 90; background: rgba(8, 9, 12, .55); display: grid; place-items: center; padding: 16px; }
#modal[hidden] { display: none; }
.dlg { background: var(--bg1); border: 1px solid var(--line-soft); border-radius: 14px; box-shadow: var(--shadow); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; overflow: hidden; }
.dlg.larga { width: min(760px, 100%); }
.dlg header { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; position: relative; }
.dlg header::after { content: ''; position: absolute; left: 16px; right: 16px; bottom: 0; height: 1px; background: var(--line-soft); }
.dlg header h2 { margin: 0; font-size: 16px; flex: 1; }
.dlg .corpo { padding: 14px 16px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.dlg footer { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 16px 14px; flex-wrap: wrap; }
.dlg footer .esq { margin-right: auto; }
.formatos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.formatos label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; background: var(--bg2); border: 1px solid var(--line-soft); border-radius: 8px; cursor: pointer; }
.formatos label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.formatos input { margin-top: 3px; accent-color: var(--accent); }
.formatos b { display: block; font-size: 13px; }
.formatos small { color: var(--text-dim); font-size: 11.5px; }
.formatos .ext { font-family: var(--cell-font); color: var(--accent); font-weight: 700; margin-right: 4px; }
.abasdlg { display: flex; gap: 2px; border-bottom: 1px solid var(--line-soft); padding: 0 16px; }
.abasdlg button { background: none; border: 0; padding: 8px 12px; color: var(--text-dim); border-bottom: 2px solid transparent; }
.abasdlg button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.grade2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.lista-cat { display: flex; flex-direction: column; gap: 1px; background: var(--bg2); border: 1px solid var(--line-soft); border-radius: 8px; padding: 4px; max-height: 260px; overflow: auto; }
.lista-cat button { text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 5px; color: var(--text); }
.lista-cat button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.exemplo { background: var(--sheet); color: var(--sheet-ink); border: 1px solid var(--line-soft); border-radius: 6px; padding: 8px 10px; font-family: var(--cell-font); min-height: 34px; }
.bordas-pre { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.bordas-pre button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; background: var(--bg2); border: 1px solid var(--line-soft); border-radius: 8px; color: var(--text-dim); font-size: 11.5px; }
.bordas-pre button:hover { border-color: var(--accent); color: var(--text); }
.kbds { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kbds kbd { font: 12px var(--ui-font); background: var(--bg3); border: 1px solid var(--line-soft); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.sobre { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sobre img { width: 72px; height: 72px; }
.sobre h3 { margin: 0; font-size: 22px; background: var(--spectrum); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sobre p { margin: 0; color: var(--text-dim); max-width: 440px; }
.sobre .nb-rodape { color: var(--text-faint); font-size: 12px; }

/* ---------- aviso rápido ---------- */
#toast { position: fixed; left: 50%; bottom: 60px; transform: translate(-50%, 20px); background: var(--bg3); color: var(--text); border: 1px solid var(--line-soft); border-radius: 10px; padding: 9px 14px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .25s; z-index: 120; max-width: min(92vw, 520px); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.erro { border-color: var(--danger); }

/* ---------- telas estreitas ---------- */
@media (max-width: 1360px) { .grp.destaque .tb span { display: none; } [data-cmd="tachado"], [data-cmd="milhar"] { display: none !important; } }
@media (max-width: 1100px) { .bt span { display: none; } .bt { padding: 0 8px; } }
@media (max-width: 900px) {
  #menus button { padding: 6px 7px; }
  .doc { display: none; }
  #painel { position: absolute; right: 10px; top: 150px; bottom: 50px; z-index: 30; box-shadow: var(--shadow); }
  #status { display: none; }
}
@media (max-width: 640px) {
  #ferramentas { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  .grp { flex: none; }
  .acoes .bt[data-cmd="aparencia"], .acoes .bt[data-cmd="abrir"] { display: none; }
  .marca .nb-by, .marca .nome { display: none; }
  #menus { overflow-x: auto; }
  .zoom input { display: none; }
  .formatos, .grade2 { grid-template-columns: 1fr; }
}
@media print { body { overflow: visible; } }
