/* ============================================================
   PSEUDO-IDE — style.css  v3.0
   ============================================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-app: #0f1117;
  --bg-editor: #13151f;
  --bg-console: #0d0f16;
  --bg-panel: #1a1d28;
  --bg-header: #1e2130;
  --bg-hover: #252840;
  --bg-modal: #161924;
  --bg-tab: #12141e;
  --border: #2a2d40;
  --border-light: #353850;
  --text: #d2d6e8;
  --text-muted: #5a6080;
  --text-dim: #8890b0;
  --accent: #7c83ff;
  --accent-dim: #4a50c8;
  --accent-glow: rgba(124, 131, 255, 0.15);
  --green: #4ade80;
  --green-dim: rgba(74, 222, 128, 0.15);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.12);
  --syn-type: #7dd3fc;
  --syn-ctrl: #c084fc;
  --syn-fn: #86efac;
  --syn-val: #f9a8d4;
  --syn-str: #fca5a1;
  --syn-num: #fdba74;
  --syn-cmt: #4b5280;
  --syn-op: #e879f9;
  --syn-import: #93c5fd;
  --font-code: "JetBrains Mono", "Fira Code", "Courier New", monospace;
  --font-ui: "Outfit", "Segoe UI", sans-serif;
  --radius: 6px;
  --header-h: 50px;
  --meta-h: 32px;
  /* Tamanho do editor. Numeros de linha e camadas de realce leem daqui,
     para que continuem alinhados em qualquer tamanho — e para que o
     controle Aa- / Aa+ do celular mexa em tudo de uma vez. */
  --ed-font: 13.5px;
  --ed-lh: 1.65;
  --barra-mob: 54px;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #2e3250;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #404670;
}

html,
body {
  height: 100%;
  background: var(--bg-app);
  color: var(--text);
  font-family: var(--font-ui);
  overflow: hidden;
}
button {
  cursor: pointer;
  border: none;
  font-family: var(--font-ui);
  font-size: 13px;
  border-radius: var(--radius);
  transition: all 150ms ease;
}
code {
  font-family: var(--font-code);
  font-size: 12px;
  background: #1e2135;
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  color: #fcd34d;
}

/* ---- Header ---- */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 120;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-logo {
  display: block;
  height: 28px;
  width: auto;
  flex-shrink: 0;
}
.app-logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}
.app-title {
  font-size: 13px;
  font-weight: 700;
  color: #c8ccf0;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.app-sub {
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}
.header-center {
  flex: 0 1 auto;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  font-family: var(--font-code);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: flex-end;
}

/* ---- Header dropdown menus ---- */
.hdr-dd {
  position: relative;
}
.hdr-dd-trigger {
  gap: 5px !important;
}
.hdr-dd-arrow {
  transition: transform 0.15s;
  flex-shrink: 0;
  opacity: 0.6;
}
.hdr-dd.hdr-dd-open .hdr-dd-arrow {
  transform: rotate(180deg);
}
.hdr-dd-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  background: #1a1d2e;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  padding: 4px;
  z-index: 200;
}
.hdr-dd.hdr-dd-open .hdr-dd-menu {
  display: block;
}
.hdr-dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-ui);
  white-space: nowrap;
}
.hdr-dd-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.hdr-dd-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ---- Special header buttons ---- */
.btn-professor {
  color: #fbbf24 !important;
}
.btn-debug {
  color: var(--green) !important;
}
.btn-icon {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 5px 12px;
  font-size: 12px;
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-light);
}
.btn-run {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: #fff;
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 0 18px var(--accent-glow);
}
.btn-run:hover {
  background: #6870f0;
  box-shadow: 0 0 28px rgba(124, 131, 255, 0.35);
  transform: translateY(-1px);
}
.btn-run:active {
  transform: translateY(0);
}
#btn-autosave,
#nb-btn-autosave {
  font-size: 11px;
  color: var(--text-muted);
  border-color: transparent;
}
#btn-autosave.as-on,
#nb-btn-autosave.as-on {
  color: var(--green);
}
#btn-autosave:hover,
#nb-btn-autosave:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-light);
}
.btn-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.btn-group .btn-icon {
  border: none;
  border-radius: 0;
  border-right: 1px solid var(--border);
}
.btn-group .btn-icon:last-child {
  border-right: none;
}
#btn-autosave.active {
  color: var(--green);
}

/* ---- Metadata bar ---- */
#metadata-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  background: linear-gradient(
    90deg,
    rgba(124, 131, 255, 0.07),
    rgba(124, 131, 255, 0.02)
  );
  border-bottom: 1px solid var(--border);
  padding: 5px 18px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-code);
  flex-shrink: 0;
}
#metadata-bar.hidden {
  display: none;
}
.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.meta-item.meta-name .meta-val {
  color: #c8ccf0;
  font-weight: 600;
}
.meta-item.meta-version .meta-val {
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
}
.meta-item.meta-desc .meta-val {
  color: var(--text-dim);
  font-style: italic;
}
.meta-item svg {
  opacity: 0.5;
  flex-shrink: 0;
}
.meta-sep {
  color: var(--border-light);
  user-select: none;
}

/* ---- Main layout ---- */
#main-layout {
  display: flex;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}
section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#editor-panel {
  flex: 1.3;
  min-width: 280px;
  background: var(--bg-editor);
}
#console-panel {
  flex: 1;
  min-width: 220px;
  background: var(--bg-console);
}

/* ---- Resizer ---- */
#resizer {
  width: 5px;
  background: var(--border);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 150ms;
  position: relative;
}
#resizer::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 1px;
  height: 40px;
  background: var(--border-light);
  border-radius: 1px;
}
#resizer:hover,
#resizer.dragging {
  background: var(--accent-dim);
}

/* ---- Panel tab ---- */
.panel-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tab);
  border-bottom: 1px solid var(--border);
  padding: 7px 16px;
  font-size: 12px;
  color: var(--text-muted);
  user-select: none;
  flex-shrink: 0;
  font-family: var(--font-code);
}
.tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 5px var(--accent);
}
.tab-dot-console {
  background: var(--green);
  box-shadow: 0 0 5px var(--green);
}
.exec-status {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
}
.exec-status.ok {
  color: var(--green);
  background: var(--green-dim);
}
.exec-status.error {
  color: var(--red);
  background: var(--red-dim);
}

/* ---- Editor ---- */
#editor-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  background: var(--bg-editor);
}

#line-numbers {
  min-width: 56px;
  padding: 16px 6px 16px 4px;
  text-align: right;
  color: var(--text-muted);
  font-family: var(--font-code);
  font-size: var(--ed-font);
  line-height: var(--ed-lh);
  user-select: none;
  overflow: hidden;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-editor);
}
.ln-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  /* Casa exatamente com a altura de linha do editor: em em, a conta
     usaria a fonte dos numeros, e a diferenca acumulava linha a linha. */
  height: calc(var(--ed-font) * var(--ed-lh));
  padding-right: 2px;
}
.ln-num {
  min-width: 22px;
  text-align: right;
  font-size: 0.9em;
}

/* ---- Fold arrows ---- */
.fold-arrow {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 2px;
  opacity: 0.5;
  transition:
    opacity 150ms,
    color 150ms;
  flex-shrink: 0;
}
.fold-arrow:hover {
  opacity: 1;
  color: var(--accent);
}
.fold-arrow.folded {
  color: var(--accent);
  opacity: 0.8;
}

#editor-wrapper {
  position: relative;
  flex: 1;
  overflow: hidden;
}
/* Regra genérica para ocultar elementos com classe .hidden */
.hidden {
  display: none;
}

/* As quatro camadas do editor ficam sobrepostas, preenchendo #editor-wrapper */
#highlight-layer,
#error-layer,
#warning-layer,
#code-editor {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 16px 16px 14px;
  font-family: var(--font-code);
  font-size: var(--ed-font);
  line-height: var(--ed-lh);
  tab-size: 4;
  white-space: pre;
  border: none;
  margin: 0;
  overflow: scroll;
  min-width: 100%;
}
#highlight-layer {
  pointer-events: none;
  z-index: 1;
  color: var(--text);
  background: transparent;
  overflow: hidden;
}
#code-editor {
  z-index: 3;
  color: transparent;
  background: transparent;
  caret-color: var(--accent);
  outline: none;
  resize: none;
  width: 100%;
  height: 100%;
}
#code-editor::selection {
  background: rgba(124, 131, 255, 0.25);
  color: transparent;
}
/* Camada de erros (sublinhado ondulado vermelho) */
#error-layer {
  pointer-events: none;
  z-index: 2;
  color: transparent;
  background: transparent;
}
.error-squiggle {
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-color: #f87171;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
/* Camada de avisos do linter (sublinhado ondulado amarelo) */
#warning-layer {
  pointer-events: none;
  z-index: 2;
  color: transparent;
  background: transparent;
  overflow: hidden;
}
.warning-squiggle {
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-color: #fbbf24;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
/* Destaque no número da linha */
.ln-row.has-error .ln-num {
  color: #f87171;
  font-weight: bold;
}
.ln-row.has-warning .ln-num {
  color: #fbbf24;
}

/* ---- Console ---- */
#console-saida {
  flex: 1;
  padding: 12px 16px;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.6;
  overflow-y: auto;
  overflow-x: hidden;
}
.console-placeholder {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}
.placeholder-icon {
  color: var(--accent);
  opacity: 0.4;
  font-size: 10px;
}
.console-line {
  display: flex;
  gap: 8px;
  padding: 1px 0;
  color: var(--text);
  word-break: break-all;
  white-space: pre-wrap;
  align-items: baseline;
}
.console-line-arrow {
  color: var(--accent);
  user-select: none;
  flex-shrink: 0;
  font-size: 11px;
  opacity: 0.7;
}
.console-error {
  color: var(--red);
  background: var(--red-dim);
  border-left: 3px solid var(--red);
  padding: 7px 12px;
  margin: 6px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.console-error strong {
  font-weight: 700;
}
.console-end-marker {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.console-end-marker::before {
  content: "✓";
  color: var(--green);
}
.console-input-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  color: var(--green);
}
.console-input-prompt {
  color: var(--green);
  font-weight: 700;
  user-select: none;
  flex-shrink: 0;
}
.console-input-field {
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--green);
  outline: none;
  color: #fff;
  font-family: var(--font-code);
  font-size: 13px;
  flex: 1;
  min-width: 80px;
  padding-bottom: 1px;
  transition: border-color 150ms;
  caret-color: var(--green);
}
.console-input-field:focus {
  border-bottom-color: #86efac;
}
.console-input-field:disabled {
  color: var(--text-muted);
  border-color: transparent;
  cursor: default;
}

/* ---- LaTeX output ---- */
.latex-block {
  margin: 6px 0;
  text-align: center;
  overflow-x: auto;
  line-height: 2;
}
.latex-inline {
  display: inline-block;
  vertical-align: middle;
  margin: 2px 4px;
}
.katex { font-size: 1.05em; }
.katex-display { overflow-x: auto; }

/* ---- Syntax tokens ---- */
.t-type {
  color: var(--syn-type);
  font-weight: 500;
}
.t-ctrl {
  color: var(--syn-ctrl);
  font-weight: 500;
}
.t-fn {
  color: var(--syn-fn);
}
.t-user-fn {
  color: #e879f9;
  font-style: italic;
}
.t-user-var {
  color: #fbbf24;
}
.t-val {
  color: var(--syn-val);
  font-style: italic;
}
.t-str {
  color: var(--syn-str);
}
.t-num {
  color: var(--syn-num);
}
.t-cmt {
  color: var(--syn-cmt);
  font-style: italic;
}
.t-op {
  color: var(--syn-op);
  font-weight: 500;
}
.t-import {
  color: var(--syn-import);
}
.t-marker {
  color: #f59e0b;
  font-weight: 700;
}
.t-marker-bracket {
  color: #78716c;
}
.t-marker-val {
  color: #fde68a;
}

/* ---- Autocomplete popup ---- */
#autocomplete-popup {
  position: fixed;
  z-index: 200;
  background: #1a1d2e;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  min-width: 220px;
  max-width: 320px;
  max-height: 220px;
  overflow-y: auto;
  display: none;
  font-family: var(--font-code);
  font-size: 12px;
}
.ac-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  cursor: pointer;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.ac-item:last-child {
  border-bottom: none;
}
.ac-item:hover,
.ac-active {
  background: var(--bg-hover);
}
.ac-active {
  border-left: 2px solid var(--accent);
}
.ac-label {
  color: var(--text);
  white-space: nowrap;
}
.ac-detail {
  color: var(--text-muted);
  font-size: 10px;
  text-align: right;
  white-space: nowrap;
}
/* ---- Signature Help (Balão de Parâmetros) ---- */
#signature-popup {
  position: fixed;
  z-index: 201;
  background: var(--bg-modal);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  padding: 6px 12px;
  font-family: var(--font-code);
  font-size: 12px;
  color: var(--text-dim);
  pointer-events: none;
  translate: 0 -50%;
}
#signature-popup.hidden {
  display: none;
}
.sig-fn {
  color: var(--syn-fn);
  font-weight: 600;
}
.sig-arg {
  color: var(--text);
}
.sig-arg.active {
  color: var(--accent);
  font-weight: bold;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 5, 0.75);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
}
.modal-overlay.hidden {
  display: none;
}
.modal-box {
  background: var(--bg-modal);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  max-width: 920px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 40px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(124, 131, 255, 0.08);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.modal-header h2 svg {
  color: var(--accent);
}
.modal-close {
  background: none;
  color: var(--text-muted);
  font-size: 18px;
  padding: 4px 9px;
  border-radius: 5px;
  line-height: 1;
}
.modal-close:hover {
  background: #2a2d40;
  color: var(--text);
}
.modal-tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: #0f1117;
  flex-shrink: 0;
}
.tab-btn {
  padding: 10px 18px;
  background: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition:
    color 150ms,
    border-color 150ms,
    background 150ms;
}
.tab-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--bg-panel);
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}
.tab-pane h3 {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tab-pane h3:first-child {
  margin-top: 0;
}
.tab-pane h4 {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0 8px;
}
.tab-intro {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 14px;
}
.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 18px;
}
.doc-table th {
  background: var(--bg-panel);
  color: var(--text-dim);
  padding: 8px 14px;
  text-align: left;
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.doc-table td {
  padding: 7px 14px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.doc-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.015);
}
.doc-table tbody tr:hover td {
  background: var(--bg-hover);
}
.doc-table td:first-child code,
.doc-table td code {
  color: #fbbf24;
}
.code-example {
  background: #0a0c14;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  font-family: var(--font-code);
  font-size: 12.5px;
  line-height: 1.7;
  margin-bottom: 18px;
  overflow-x: auto;
  color: var(--text);
}
.ex-kw {
  color: var(--syn-ctrl);
  font-weight: 500;
}
.ex-fn {
  color: var(--syn-fn);
}
.ex-str {
  color: var(--syn-str);
}
.ex-num {
  color: var(--syn-num);
}
.ex-cmt {
  color: var(--syn-cmt);
  font-style: italic;
}
.doc-note {
  background: rgba(124, 131, 255, 0.08);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 12px;
}
.doc-note strong {
  color: var(--accent);
}
.doc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.doc-list li {
  color: var(--text-muted);
  font-size: 13px;
  padding-left: 16px;
  position: relative;
}
.doc-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
  opacity: 0.6;
}
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 8px 28px;
  font-size: 13px;
  box-shadow: 0 0 14px var(--accent-glow);
}
.btn-primary:hover {
  background: #6870f0;
  box-shadow: 0 0 22px rgba(124, 131, 255, 0.4);
}

/* ============================================================
   DEPURADOR VISUAL
   ============================================================ */

/* Painel flutuante no canto superior direito do editor */
#debug-panel {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 20;
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 180px;
  max-width: 280px;
  max-height: calc(100% - 16px);
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  font-family: var(--font-ui);
  font-size: 12px;
}

.debug-header {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.debug-header::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: debugPulse 1.2s ease-in-out infinite;
}
@keyframes debugPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.debug-controls {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.debug-controls button {
  flex: 1;
  padding: 5px 8px;
  font-size: 11px;
  font-family: var(--font-ui);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text);
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
  white-space: nowrap;
}
.debug-controls button:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.debug-controls .btn-stop {
  border-color: var(--red);
  color: var(--red);
}
.debug-controls .btn-stop:hover {
  background: var(--red-dim);
  border-color: var(--red);
}

/* Lista de variáveis */
#debug-vars {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.debug-var {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
}
.debug-var:last-child {
  border-bottom: none;
}
.debug-var-name {
  color: var(--accent);
  font-family: var(--font-code);
  flex-shrink: 0;
}
.debug-var-val {
  color: var(--text-dim);
  font-family: var(--font-code);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

/* Linha ativa no depurador — destaque no número de linha */
.ln-row.debug-active .ln-num {
  color: var(--accent);
  font-weight: bold;
}
.ln-row.debug-active {
  background: var(--accent-glow);
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════
   COLOR SWATCH — bolinha colorida no highlight layer
   ═══════════════════════════════════════════════════════════ */
.t-color-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, .22);
  vertical-align: middle;
  position: relative;
  top: -1px;
  margin-right: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4);
  pointer-events: none;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   COLOR PICKER POPUP
   ═══════════════════════════════════════════════════════════ */
.cp-popup {
  position: fixed;
  z-index: 10000;
  background: #1b1d2e;
  border: 1px solid rgba(120, 130, 200, .35);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 255, 255, .04);
  padding: 10px;
  width: 246px;
  display: none;
  font-size: 11px;
  user-select: none;
  font-family: var(--font-code, monospace);
}

/* Gradient square */
.cp-grad-wrap {
  position: relative;
  width: 100%;
  height: 148px;
  border-radius: 6px;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
}
.cp-canvas { width: 100%; height: 100%; display: block; }
.cp-cursor {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .5);
}

/* Hue + alpha bars */
.cp-bars {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cp-bar-wrap {
  position: relative;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
}
.cp-hue-wrap {
  background: linear-gradient(to right,
    hsl(0,100%,50%), hsl(30,100%,50%), hsl(60,100%,50%), hsl(90,100%,50%),
    hsl(120,100%,50%), hsl(150,100%,50%), hsl(180,100%,50%), hsl(210,100%,50%),
    hsl(240,100%,50%), hsl(270,100%,50%), hsl(300,100%,50%), hsl(330,100%,50%),
    hsl(360,100%,50%));
}
.cp-alpha-wrap {
  background-color: #999;
  background-image:
    linear-gradient(45deg, #666 25%, transparent 25%),
    linear-gradient(-45deg, #666 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #666 75%),
    linear-gradient(-45deg, transparent 75%, #666 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
}
.cp-alpha-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: block;
}
.cp-range {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 14px;
  background: transparent;
  margin: 0; padding: 0;
  cursor: pointer;
}
.cp-range::-webkit-slider-runnable-track { background: transparent; height: 14px; }
.cp-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, .35);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
  margin-top: 0;
  cursor: pointer;
}
.cp-range::-moz-range-track { background: transparent; height: 14px; border: none; }
.cp-range::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, .35);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
}

/* Bottom: preview + fields */
.cp-bottom {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}
.cp-pv-wrap {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background-color: #888;
  background-image:
    linear-gradient(45deg, #555 25%, transparent 25%),
    linear-gradient(-45deg, #555 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #555 75%),
    linear-gradient(-45deg, transparent 75%, #555 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
  border: 1px solid rgba(255, 255, 255, .12);
}
.cp-pv { width: 100%; height: 100%; }

.cp-fields { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.cp-hex {
  width: 100%;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 5px;
  color: #e2e4f0;
  padding: 3px 7px;
  font-family: var(--font-code, monospace);
  font-size: 12px;
  box-sizing: border-box;
  outline: none;
}
.cp-hex:focus { border-color: var(--accent, #7c83ff); }

.cp-rgb-row {
  display: flex;
  gap: 4px;
}
.cp-lbl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: rgba(200, 205, 230, .6);
  font-size: 10px;
  flex: 1;
}
.cp-lbl input {
  width: 100%;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 4px;
  color: #e2e4f0;
  padding: 2px 3px;
  font-size: 11px;
  text-align: center;
  outline: none;
  font-family: var(--font-code, monospace);
  -moz-appearance: textfield;
}
.cp-lbl input::-webkit-inner-spin-button,
.cp-lbl input::-webkit-outer-spin-button { -webkit-appearance: none; }
.cp-lbl input:focus { border-color: var(--accent, #7c83ff); }

/* ============================================================
   PSEUDO NOTEBOOK — notebook.html
   ============================================================ */
.nb-body {
  overflow: auto;
  background: var(--bg-app);
}
.nb-body html,
.nb-body body { overflow: auto; }

.nb-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px;
  height: 50px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.nb-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.nb-back {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-family: var(--font-ui);
  transition: color 150ms;
}
.nb-back:hover { color: var(--text); }
.nb-app-name {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.nb-title-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 2px 6px;
  min-width: 180px;
  max-width: 320px;
  outline: none;
}
.nb-title-input:focus { border-bottom-color: var(--accent); }
.nb-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nb-header-right button {
  background: var(--bg-panel);
  color: var(--text-dim);
  border: 1px solid var(--border);
  font-size: 12px;
  padding: 5px 12px;
}
.nb-header-right button:hover {
  background: var(--bg-hover);
  color: var(--text);
}
/* Run-all dropdown group */
.nb-run-group {
  position: relative;
  display: flex;
  align-items: stretch;
}
.nb-btn-run-all {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
  border-radius: var(--radius) 0 0 var(--radius) !important;
}
.nb-btn-run-all:hover {
  background: var(--accent-dim) !important;
}
.nb-run-arrow {
  background: rgba(124,131,255,0.25) !important;
  color: #fff !important;
  border-left: 1px solid rgba(255,255,255,0.2) !important;
  border-color: var(--accent) !important;
  border-radius: 0 var(--radius) var(--radius) 0 !important;
  padding: 0 8px !important;
  font-size: 10px !important;
}
.nb-run-arrow:hover { background: rgba(124,131,255,0.45) !important; }
.nb-run-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 310px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 200;
  overflow: hidden;
}
.nb-run-menu.nb-run-menu-open { display: block; }
.nb-run-menu-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-sans);
}
.nb-run-menu-item:last-child { border-bottom: none; }
.nb-run-menu-item:hover { background: var(--bg-hover); }
.nb-run-menu-item.nb-run-menu-active { background: var(--accent-glow); }
.nb-run-menu-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
.nb-run-menu-badge { font-size: 10px; }
.nb-run-menu-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
}

/* Guide button */
.nb-guide-btn {
  font-family: var(--font-code) !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  width: 28px;
  padding: 0 !important;
  border-radius: 50% !important;
}

/* Env-panel toggle button */
.nb-env-toggle-btn {
  font-size: 12px !important;
  color: var(--syn-type) !important;
  border: 1px solid rgba(125,211,252,0.25) !important;
}
.nb-env-toggle-btn:hover {
  background: rgba(125,211,252,0.08) !important;
}

/* Env side panel */
.nb-env-panel {
  position: fixed;
  top: 50px;
  bottom: 22px;
  left: 0;
  width: 260px;
  z-index: 99;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 220ms cubic-bezier(.4,0,.2,1);
  box-shadow: 4px 0 18px rgba(0,0,0,.35);
}
.nb-env-panel.nb-env-panel-open { transform: translateX(0); }

.nb-env-panel-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.nb-env-panel-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--syn-type);
}
.nb-env-panel-close {
  background: transparent !important;
  color: var(--text-dim) !important;
  font-size: 14px !important;
  padding: 0 4px !important;
  line-height: 1;
}
.nb-env-panel-close:hover { color: var(--text) !important; }

.nb-env-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.nb-env-empty {
  padding: 20px 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: center;
}
.nb-env-empty strong { color: var(--accent); }

.nb-env-row {
  padding: 6px 12px;
  border-bottom: 1px solid rgba(42,45,64,0.6);
  cursor: default;
  transition: background 120ms;
}
.nb-env-row:hover { background: var(--bg-hover); }
.nb-env-row-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.nb-env-name {
  font-family: var(--font-code);
  font-size: 12px;
  color: var(--syn-fn);
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nb-env-type {
  font-family: var(--font-code);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 8px;
  flex-shrink: 0;
  font-weight: 600;
}
.env-t-num  { background: rgba(253,186,116,.15); color: var(--syn-num); }
.env-t-str  { background: rgba(252,165,161,.15); color: var(--syn-str); }
.env-t-bool { background: rgba(192,132,252,.15); color: var(--syn-ctrl); }
.env-t-func { background: rgba(134,239,172,.15); color: var(--syn-fn); }
.env-t-list { background: rgba(124,131,255,.15); color: var(--accent); }
.env-t-obj  { background: rgba(125,211,252,.15); color: var(--syn-type); }
.env-t-null { background: rgba(90,96,128,.15);   color: var(--text-muted); }

.nb-env-val {
  font-family: var(--font-code);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nb-env-panel-ft {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  flex-shrink: 0;
}
.nb-env-clear-btn {
  width: 100%;
  background: transparent !important;
  border: 1px solid var(--border) !important;
  color: var(--text-dim) !important;
  font-size: 11px !important;
  padding: 4px !important;
}
.nb-env-clear-btn:hover {
  border-color: var(--red) !important;
  color: var(--red) !important;
}

/* Guide modal */
.nb-guide-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.nb-guide-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 680px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.nb-guide-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.nb-guide-title {
  font-weight: 600;
  font-size: 14px;
}
.nb-guide-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: var(--radius);
}
.nb-guide-close:hover { background: var(--bg-hover); color: var(--text); }
.nb-guide-body {
  overflow-y: auto;
  flex: 1;
}
.nb-gs {
  border-bottom: 1px solid var(--border);
}
.nb-gs:last-child { border-bottom: none; }
.nb-gs > summary {
  padding: 11px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  color: var(--text);
}
.nb-gs > summary::-webkit-details-marker { display: none; }
.nb-gs > summary::after { content: '▾'; font-size: 11px; color: var(--text-dim); }
.nb-gs[open] > summary::after { content: '▴'; }
.nb-gs > summary:hover { background: var(--bg-hover); }
.nb-gc {
  padding: 4px 18px 16px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-dim);
}
.nb-gc p { margin: 6px 0; }
.nb-gc ul, .nb-gc ol { margin: 6px 0 6px 20px; }
.nb-gc li { margin: 3px 0; }
.nb-gc code {
  font-family: var(--font-code);
  font-size: 12px;
  background: rgba(0,0,0,0.3);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--syn-str);
}
.nb-gc kbd {
  font-family: var(--font-code);
  font-size: 11px;
  background: var(--bg-tab);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  color: var(--text);
}
.nb-gc-pre {
  background: var(--bg-editor);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 8px 0;
  overflow-x: auto;
  font-family: var(--font-code);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
}
.nb-gc-pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.nb-gc-example { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.nb-gc-cell {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.nb-gc-cell pre {
  margin: 0;
  padding: 8px 12px;
  background: var(--bg-editor);
  font-family: var(--font-code);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
}
.nb-gc-cell pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.nb-gc-badge {
  display: block;
  padding: 2px 10px;
  background: var(--bg-tab);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-code);
  font-size: 10px;
  color: var(--accent);
}
.nb-gc-badge-dim { color: var(--text-dim); }
.nb-gc-env { border-left: 3px solid rgba(124,131,255,0.45); }
.nb-gc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 12px;
}
.nb-gc-table th {
  text-align: left;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
}
.nb-gc-table td {
  padding: 5px 10px;
  border-bottom: 1px solid rgba(42,45,64,0.5);
  color: var(--text-dim);
  vertical-align: top;
}
.nb-gc-table tr:last-child td { border-bottom: none; }
.nb-gc-tip {
  background: rgba(124,131,255,0.08);
  border-left: 3px solid rgba(124,131,255,0.4);
  padding: 6px 10px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 8px 0;
  font-size: 12px;
  color: var(--text-dim);
}

.nb-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}
.nb-cells {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Individual cell */
.nb-cell {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 150ms;
}
.nb-cell:focus-within { border-color: var(--accent-dim); }

.nb-cell-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 10px;
  background: var(--bg-tab);
  border-bottom: 1px solid var(--border);
  min-height: 28px;
}
.nb-cell-type-badge {
  font-family: var(--font-code);
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 1px 8px;
  border-radius: 10px;
  user-select: none;
}
.nb-cell-type-badge.nb-md-badge {
  color: var(--syn-ctrl);
  background: rgba(192,132,252,0.12);
}
.nb-cell-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0;
  transition: opacity 150ms;
}
.nb-cell:hover .nb-cell-actions,
.nb-cell:focus-within .nb-cell-actions { opacity: 1; }

.nb-btn-run {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(74,222,128,0.3);
  font-size: 11px;
  padding: 2px 10px;
}
.nb-btn-run:hover { background: rgba(74,222,128,0.22); }

.nb-btn-icon {
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  padding: 2px 7px;
}
.nb-btn-icon:hover { background: var(--bg-hover); color: var(--text); }
.nb-btn-del { color: var(--red); opacity: 0.55; }
.nb-btn-del:hover { opacity: 1; background: var(--red-dim); }

/* Collapse button */
.nb-btn-collapse {
  font-size: 8px;
  opacity: 0.45;
  padding: 2px 5px;
  transition: opacity 150ms;
  flex-shrink: 0;
}
.nb-cell:hover .nb-btn-collapse,
.nb-cell:focus-within .nb-btn-collapse { opacity: 0.75; }
.nb-btn-collapse:hover { opacity: 1 !important; }

/* Collapsed cell — hide body, keep toolbar */
.nb-cell-collapsed .nb-editor-wrap,
.nb-cell-collapsed .nb-cell-output,
.nb-cell-collapsed .nb-md-edit,
.nb-cell-collapsed .nb-md-preview { display: none !important; }
.nb-cell-collapsed .nb-cell-toolbar { border-bottom: none; }

/* Env-mode cell */
.nb-cell.nb-env-mode { border-left: 3px solid rgba(124,131,255,0.45); }
.nb-btn-env {
  font-family: var(--font-code);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.nb-cell.nb-env-mode .nb-btn-env {
  color: var(--accent);
  background: var(--accent-glow);
}

/* Code cell editor */
.nb-cell-editor {
  display: block;
  width: 100%;
  background: var(--bg-editor);
  color: var(--text);
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.65;
  padding: 12px 16px;
  border: none;
  outline: none;
  resize: none;
  min-height: 56px;
  tab-size: 2;
  overflow-y: hidden;
}

/* Cell output */
.nb-cell-output {
  display: none;
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.6;
  background: var(--bg-console);
}
.nb-cell-output.nb-has-output { display: block; }

/* Markdown cell */
.nb-md-editor {
  display: block;
  width: 100%;
  background: var(--bg-editor);
  color: var(--text);
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.65;
  padding: 12px 16px;
  border: none;
  outline: none;
  resize: none;
  min-height: 56px;
  tab-size: 2;
  overflow-y: hidden;
}
.nb-md-done-bar {
  display: flex;
  justify-content: flex-end;
  padding: 4px 10px;
  background: var(--bg-editor);
  border-top: 1px solid var(--border);
}
.nb-md-preview {
  padding: 14px 20px;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  cursor: pointer;
  min-height: 32px;
}
.nb-md-preview:empty::after {
  content: "Clique para editar (Markdown)";
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
}
.nb-md-preview h1 { font-size: 22px; margin: 12px 0 8px; }
.nb-md-preview h2 { font-size: 18px; margin: 10px 0 6px; }
.nb-md-preview h3 { font-size: 15px; margin: 8px 0 4px; }
.nb-md-preview p { margin: 6px 0; }
.nb-md-preview strong { color: var(--syn-type); }
.nb-md-preview em { font-style: italic; color: var(--text-dim); }
.nb-md-preview code {
  font-family: var(--font-code); font-size: 12px;
  background: var(--bg-tab); padding: 1px 5px;
  border-radius: 3px; color: var(--syn-str);
}
.nb-md-preview pre {
  background: var(--bg-editor); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; overflow-x: auto;
}
.nb-md-preview pre code { background: transparent; padding: 0; font-size: 13px; }
.nb-md-preview ul, .nb-md-preview ol { margin: 8px 0 8px 24px; }
.nb-md-preview li { margin: 3px 0; }
.nb-md-preview hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.nb-md-preview a { color: var(--accent); }
.nb-md-preview blockquote {
  border-left: 3px solid var(--accent-dim); margin: 8px 0;
  padding: 4px 14px; color: var(--text-dim);
}
.nb-md-preview h4 { font-size: 13px; margin: 7px 0 3px; font-weight: 600; }
.nb-md-preview h5 { font-size: 12px; margin: 6px 0 2px; font-weight: 600; }
.nb-md-preview h6 { font-size: 12px; margin: 6px 0 2px; font-weight: 600; color: var(--text-dim); }
.nb-md-preview del { text-decoration: line-through; color: var(--text-dim); }
.nb-md-preview u { text-decoration: underline; }
.nb-md-preview mark { background: rgba(250,204,21,0.25); color: inherit; padding: 0 2px; border-radius: 2px; }
.nb-md-preview sup, .nb-md-preview sub { font-size: 0.75em; }
.nb-md-preview .md-align-center { text-align: center; }
.nb-md-preview .md-align-right  { text-align: right; }
.nb-md-preview .md-align-left   { text-align: left; }
.nb-md-preview .md-align-justify { text-align: justify; }
.nb-md-preview .md-table {
  border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px;
}
.nb-md-preview .md-table th,
.nb-md-preview .md-table td {
  border: 1px solid var(--border); padding: 5px 12px;
}
.nb-md-preview .md-table th {
  background: var(--bg-tab); color: var(--accent); font-weight: 600;
}
.nb-md-preview .md-table tr:nth-child(even) td {
  background: rgba(124,131,255,0.04);
}

/* Add-cell bar */
.nb-add-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  opacity: 0;
  transition: opacity 200ms;
}
.nb-add-bar:hover { opacity: 1; }
.nb-add-bar-bottom { opacity: 0.5; }
.nb-add-bar-bottom:hover { opacity: 1; }
.nb-add-bar button {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  font-size: 11px;
  padding: 4px 16px;
}
.nb-add-bar button:hover {
  color: var(--text);
  border-color: var(--accent-dim);
  background: var(--accent-glow);
}

/* Status bar */
.nb-status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 22px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  z-index: 50;
}
#nb-status-text.nb-status-ok { color: var(--green); }
#nb-status-text.nb-status-err { color: var(--red); }

/* Exec spinner on cell run button */
.nb-btn-run.nb-running {
  opacity: 0.6;
  cursor: wait;
  pointer-events: none;
}

/* ---- Notebook highlight overlay (textarea + layer pattern) ---- */
.nb-editor-wrap {
  position: relative;
  background: var(--bg-editor);
}
/*
 * Both layers share identical typography so text alignment is pixel-perfect.
 * The textarea sits above (z-index 2) and is the natural-flow size anchor;
 * the highlight layer is absolute and fills the same space behind it.
 */
.nb-cell-editor {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre-wrap;
  overflow: hidden;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: transparent;
  caret-color: var(--accent);
}
.nb-cell-editor::selection {
  background: rgba(124, 131, 255, 0.25);
  color: transparent;
}
.nb-cell-editor::placeholder {
  color: var(--text-muted);
}
.nb-hl-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre-wrap;
  word-break: break-word;
  pointer-events: none;
  z-index: 1;
  color: var(--text);
  overflow: hidden;
}

/* Global .console-input-line / .console-input-field styles (defined earlier)
   already apply inside .nb-cell-output — no overrides needed here. */

/* ============================================================
   IMPORTADOR DE DADOS
   ============================================================ */
.imp-page {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  display: flex;
  flex-direction: column;
  overflow: auto;
}

/* ---- Header ---- */
.imp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  height: 44px;
  background: var(--bg-panel);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.imp-header-left { display: flex; align-items: center; gap: 12px; }
.imp-header-right { display: flex; align-items: center; }
.imp-back {
  display: inline-flex;
  align-items: center;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background 150ms;
}
.imp-back:hover { background: var(--bg-hover); color: var(--text); }
.imp-app-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.imp-file-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  border-radius: 20px;
  padding: 2px 10px 2px 8px;
  gap: 4px;
}
.imp-new-file-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
  line-height: 1;
  margin-left: 4px;
}
.imp-new-file-btn:hover { color: var(--text); }
.imp-header-hint { font-size: 11px; color: var(--text-muted); }

/* ---- Drop zone ---- */
.imp-drop-wrap {
  padding: 16px 24px 0;
  flex-shrink: 0;
}
.imp-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-editor);
  cursor: pointer;
  transition: border-color 200ms, background 200ms;
  text-align: center;
}
.imp-drop:hover, .imp-drop.imp-dragging {
  border-color: var(--accent-dim);
  background: var(--accent-glow);
}
.imp-drop-icon { color: var(--text-muted); opacity: 0.6; }
.imp-drop-text { font-size: 14px; color: var(--text-dim); }
.imp-drop-hint { font-size: 12px; color: var(--text-muted); }

/* Compact drop once file is loaded */
.imp-drop.imp-drop-mini {
  flex-direction: row;
  padding: 10px 16px;
  gap: 8px;
  border-style: solid;
  border-color: var(--accent-dim);
  background: var(--accent-glow);
}
.imp-drop.imp-drop-mini .imp-drop-icon { display: none; }
.imp-drop.imp-drop-mini .imp-drop-text { font-size: 12px; }
.imp-drop.imp-drop-mini .imp-drop-hint { display: none; }

/* ---- Main layout ---- */
.imp-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 16px 24px 24px;
  gap: 16px;
  min-height: 0;
}
.imp-split {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

/* ---- Panes ---- */
.imp-pane {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
}
.imp-preview-pane { flex: 3; min-width: 0; }
.imp-vars-pane    { flex: 2; min-width: 280px; max-width: 420px; }

.imp-pane-title {
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 8px 14px;
  background: var(--bg-line-numbers);
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ---- Preview body ---- */
.imp-preview-body {
  flex: 1;
  overflow: auto;
  padding: 12px 14px;
}
.imp-table-wrap { overflow-x: auto; }
.imp-table {
  border-collapse: collapse;
  font-size: 12px;
  font-family: var(--font-code);
  width: 100%;
  min-width: max-content;
}
.imp-table th {
  background: var(--bg-line-numbers);
  color: var(--text-dim);
  font-weight: 600;
  padding: 5px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.imp-table td {
  padding: 4px 10px;
  border-bottom: 1px solid var(--border-faint, rgba(255,255,255,0.05));
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.imp-table tr:hover td { background: var(--bg-hover); }
.imp-rn {
  color: var(--text-muted);
  text-align: right;
  user-select: none;
  width: 40px;
}
.imp-table-more {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px;
}
.imp-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}
.imp-pre {
  margin: 0;
  font-family: var(--font-code);
  font-size: 12px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.imp-empty  { color: var(--text-muted); font-size: 13px; margin: 0; }
.imp-error  { color: #f87171; font-size: 13px; margin: 0; }

/* ---- Right column (selection pane + vars pane stacked) ---- */
.imp-right-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 320px;
  flex-shrink: 0;
  min-width: 280px;
}
.imp-preview-pane { flex: 1; min-width: 0; }

/* ---- Selection panel ---- */
.imp-sel-pane { flex-shrink: 0; }
.imp-sel-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.imp-sel-info {
  font-size: 12px;
  margin: 0;
  padding: 6px 8px;
  border-radius: 4px;
  line-height: 1.5;
}
.imp-sel-info.imp-sel-empty { color: var(--text-muted); background: transparent; }
.imp-sel-info.imp-sel-active {
  color: var(--text);
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
}
.imp-sel-rows { color: var(--text-muted); font-size: 11px; }

/* Row range / txt separator controls */
.imp-row-controls, .imp-txt-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.imp-field-label { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.imp-num-inp {
  width: 60px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font-code);
  font-size: 12px;
  padding: 3px 6px;
  outline: none;
}
.imp-num-inp:focus { border-color: var(--accent-dim); }
.imp-range-sep  { font-size: 12px; color: var(--text-muted); }
.imp-auto-label { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; cursor: pointer; margin-left: 4px; }
.imp-auto-label input { cursor: pointer; }

/* Text input + select shared */
.imp-text-inp, .imp-sep-inp {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font-code);
  font-size: 12px;
  padding: 4px 8px;
  outline: none;
}
.imp-text-inp:focus, .imp-sep-inp:focus { border-color: var(--accent-dim); }
.imp-sep-inp { width: 70px; }
.imp-select {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 4px 8px;
  outline: none;
  cursor: pointer;
}
.imp-select:focus { border-color: var(--accent-dim); }

/* Create form */
.imp-create-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.imp-vname-inp { width: 100%; box-sizing: border-box; }
.imp-create-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  transition: background 150ms;
}
.imp-create-btn:hover:not(:disabled) { background: rgba(124,131,255,0.22); }
.imp-create-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Remove button */
.imp-rm-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 5px;
  border-radius: 3px;
  line-height: 1;
}
.imp-rm-btn:hover { background: rgba(248,113,113,0.15); color: #f87171; }

/* ---- Variable list ---- */
.imp-vars-pane { flex: 1; min-height: 80px; }
.imp-vars-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.imp-var-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: var(--bg-editor);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
}
.imp-vi-name {
  font-family: var(--font-code);
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}
.imp-vi-type {
  color: var(--text-muted);
  font-size: 11px;
  flex-shrink: 0;
}
.imp-vi-cols {
  flex: 1;
  color: var(--text-dim);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-code);
}

/* ---- Interactive table ---- */
.imp-th {
  cursor: pointer;
  user-select: none;
  transition: background 120ms, color 120ms;
}
.imp-th:hover { background: var(--bg-hover) !important; color: var(--text) !important; }
.imp-th.imp-col-sel {
  background: var(--accent-glow) !important;
  color: var(--accent) !important;
  box-shadow: inset 0 -2px 0 var(--accent-dim);
}
.imp-td.imp-col-sel { background: rgba(124,131,255,0.06) !important; }
.imp-row-in { background: rgba(124,131,255,0.04); }

/* ---- JSON paths ---- */
.imp-json-hint { font-size: 12px; color: var(--text-muted); margin: 0 0 8px 0; }
.imp-json-paths {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 10px;
}
.imp-json-path {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 100ms;
}
.imp-json-path:hover { background: var(--bg-hover); }
.imp-json-path.imp-jp-sel {
  background: var(--accent-glow);
  border-color: var(--accent-dim);
}
.imp-jp-label {
  font-family: var(--font-code);
  font-size: 12px;
  color: var(--accent);
  flex-shrink: 0;
}
.imp-jp-desc { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-json-raw-wrap { margin-top: 4px; }
.imp-json-raw-toggle {
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 4px 0;
}
.imp-json-raw-toggle:hover { color: var(--text-dim); }
.imp-json-raw { max-height: 200px; overflow: auto; }

/* ---- Code pane ---- */
.imp-code-pane {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
.imp-code-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-line-numbers);
  border-bottom: 1px solid var(--border);
}
.imp-code-hint { font-size: 11px; color: var(--text-muted); flex: 1; }
.imp-code-actions { display: flex; gap: 6px; align-items: center; }
.imp-export-btn, .imp-copy-btn {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font-ui);
  transition: background 150ms;
  white-space: nowrap;
}
.imp-export-btn { color: var(--text-dim); border-color: var(--border); background: var(--bg-editor); }
.imp-export-btn:hover { background: var(--bg-hover); color: var(--text); }
.imp-copy-btn:hover:not(:disabled) { background: rgba(124,131,255,0.18); }
.imp-copy-btn:disabled { opacity: 0.6; cursor: default; }
.imp-code-out {
  resize: vertical;
  min-height: 130px;
  max-height: 380px;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-editor);
  border: none;
  outline: none;
  padding: 12px 16px;
  width: 100%;
  box-sizing: border-box;
  tab-size: 2;
}

/* ---- Responsive ---- */
@media (max-width: 760px) {
  .imp-split { flex-direction: column; }
  .imp-right-col { width: auto; }
  .imp-header-hint { display: none; }
}

/* ============================================================
   MODE SWITCHER
   ============================================================ */
.imp-mode-bar {
  display: flex;
  gap: 0;
  padding: 10px 24px 0;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}
.imp-mode-btn {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-family: var(--font-ui);
  font-weight: 500;
  padding: 7px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
  margin-bottom: -1px;
}
.imp-mode-btn:hover { color: var(--text-dim); }
.imp-mode-btn.imp-mode-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ============================================================
   .pdados EDITOR
   ============================================================ */
.ed-cols-pane {
  flex: 1;
  min-width: 320px;
  max-width: 520px;
}
.ed-header-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.ed-load-btn { font-size: 11px; padding: 3px 10px; }
.ed-save-btn { font-size: 12px; }

.ed-cols-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ed-empty-hint { color: var(--text-muted); font-size: 12px; margin: 0; line-height: 1.6; }

.ed-libs-hint {
  padding: 6px 14px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-line-numbers);
  flex-shrink: 0;
}
.ed-libs-hint code {
  background: var(--bg-editor);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  color: var(--accent);
  margin-right: 4px;
}

/* ---- Column card ---- */
.ed-col-card {
  background: var(--bg-editor);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ed-col-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ed-col-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  color: var(--accent);
}
.ed-col-mode {
  width: auto;
  flex-shrink: 0;
  font-size: 11px;
  padding: 3px 6px;
}
.ed-col-expr-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ed-col-expr-inp {
  font-family: var(--font-code);
  font-size: 12px;
}
.ed-col-manual-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ed-col-manual-ta {
  font-family: var(--font-code);
  font-size: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 5px 8px;
  resize: vertical;
  min-height: 72px;
  outline: none;
  line-height: 1.5;
}
.ed-col-manual-ta:focus { border-color: var(--accent-dim); }

/* Column preview line */
.ed-col-preview {
  font-size: 11px;
  font-family: var(--font-code);
  min-height: 16px;
  line-height: 1.4;
}
.ed-col-ok    { color: var(--text-muted); }
.ed-col-error { color: #f87171; }

/* Editor preview body (taller than import preview) */
.ed-preview-body {
  flex: 1;
  overflow: auto;
  padding: 10px 12px;
  min-height: 200px;
}

/* ============================================================
   PROTOCOL TABLE  (teacher modal)
   ============================================================ */
.proto-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 0.8rem 0 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.proto-table th {
  padding: 7px 12px;
  text-align: left;
  background: var(--bg-tab);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.proto-table th + th,
.proto-table td + td { border-left: 1px solid var(--border); }
.proto-table td {
  padding: 8px 12px;
  vertical-align: middle;
  color: var(--text);
  line-height: 1.5;
  border-bottom: 1px solid rgba(42,45,64,0.6);
}
.proto-table tr:last-child td { border-bottom: none; }
.proto-table tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
.proto-method {
  display: inline-block;
  font-family: var(--font-code);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.proto-method-get {
  background: rgba(74,222,128,0.12);
  color: var(--green);
  border: 1px solid rgba(74,222,128,0.3);
}
.proto-method-post {
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
}

/* ============================================================
   THEME SETTINGS MODAL
   ============================================================ */
.theme-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.theme-preset-btn {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 5px 16px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 120ms;
}
.theme-preset-btn:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
  background: var(--accent-glow);
}
.theme-group { margin-bottom: 22px; }
.theme-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.theme-vars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 5px 20px;
}
.theme-var-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}
.theme-swatch-wrap {
  position: relative;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}
.theme-swatch-wrap input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}
.theme-swatch {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid var(--border-light);
  pointer-events: none;
  transition: border-color 100ms;
}
.theme-swatch-wrap:hover .theme-swatch { border-color: var(--accent); }
.theme-hex-input {
  font-family: var(--font-code);
  font-size: 11px;
  background: var(--bg-tab);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 3px 7px;
  border-radius: 4px;
  width: 76px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.theme-hex-input:focus {
  outline: none;
  border-color: var(--accent-dim);
  background: var(--bg-editor);
}
.theme-var-lbl {
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Library Modal ── */
.lib-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 60px;
  z-index: 9000;
}
.lib-box {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: min(860px, 94vw);
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lib-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-header);
  flex-shrink: 0;
}
.lib-topbar-left { display: flex; align-items: center; }
.lib-topbar-title { font-size: 13px; font-weight: 600; color: var(--text); }
.lib-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 100ms, background 100ms;
}
.lib-close:hover { color: var(--text); background: var(--bg-hover); }
.lib-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 14px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-header);
  flex-shrink: 0;
}
.lib-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  margin-bottom: -1px;
  border-radius: 4px 4px 0 0;
  transition: color 100ms, border-color 100ms;
}
.lib-tab:hover { color: var(--text); }
.lib-tab-on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.lib-tab-cnt {
  font-size: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 5px;
  min-width: 18px;
  text-align: center;
  color: var(--text-muted);
}
.lib-search-wrap { margin-left: auto; padding-bottom: 6px; }
.lib-search {
  background: var(--bg-editor);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 12px;
  padding: 4px 10px;
  width: 180px;
  outline: none;
  transition: border-color 100ms;
}
.lib-search:focus { border-color: var(--accent-dim); }
.lib-cnt { flex: 1; overflow-y: auto; min-height: 200px; }
.lib-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-dim);
  text-align: center;
  gap: 10px;
  font-size: 13px;
}
.lib-list { padding: 6px 0; }
.lib-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 80ms;
}
.lib-item:hover { background: var(--bg-hover); }
.lib-item:last-child { border-bottom: none; }
.lib-item-ic { color: var(--text-muted); flex-shrink: 0; display: flex; align-items: center; }
.lib-item-info { flex: 1; min-width: 0; }
.lib-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.lib-bib-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
}
.lib-item-meta { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--text-muted); }
.lib-item-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.lib-item-age { flex-shrink: 0; }
.lib-item-acts {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 100ms;
}
.lib-item:hover .lib-item-acts { opacity: 1; }
.lib-act {
  background: none;
  border: 1px solid transparent;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: color 100ms, background 100ms, border-color 100ms;
}
.lib-act:hover { color: var(--text); background: var(--bg-panel); border-color: var(--border); }
.lib-act-del:hover {
  color: var(--red, #f87171);
  border-color: rgba(248,113,113,0.3);
  background: rgba(248,113,113,0.08);
}
.lib-body-preview { display: flex; flex-direction: column; height: 100%; }
.lib-prev-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  flex-shrink: 0;
}
.lib-prev-back {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 100ms, border-color 100ms;
}
.lib-prev-back:hover { color: var(--accent); border-color: var(--accent-dim); }
.lib-prev-title { font-size: 13px; font-weight: 600; color: var(--text); }
.lib-prev-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 18px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: var(--bg-header);
  flex-shrink: 0;
}
.lib-prev-act {
  background: var(--bg-editor);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 100ms, background 100ms, border-color 100ms;
}
.lib-prev-act:hover { color: var(--text); border-color: var(--border-light); background: var(--bg-hover); }
.lib-prev-act-del:hover {
  color: var(--red, #f87171);
  border-color: rgba(248,113,113,0.3);
  background: rgba(248,113,113,0.08);
}
.lib-prev-content { flex: 1; overflow-y: auto; padding: 16px 18px; }
.lib-prev-code {
  font-family: var(--font-code);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-editor);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  overflow-x: auto;
}
.lib-prev-cell { margin-bottom: 14px; }
.lib-prev-cell-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.lib-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-size: 12px;
  padding: 8px 18px;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 200ms, transform 200ms;
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
}
.lib-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.lib-toast-err { border-color: rgba(248,113,113,0.5); color: #f87171; }

/* ============================================================
   MODAL DE DOCUMENTAÇÃO (F1) — busca + resumo do básico
   O guia completo, detalhado e interativo, mora em guia.html.
   ============================================================ */
.hm-box { max-width: 720px; max-height: 82vh; }

.hm-searchbar {
  position: relative;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  flex-shrink: 0;
}
.hm-searchbar input {
  width: 100%;
  background: var(--bg-app);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 9px 34px 9px 36px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}
.hm-searchbar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.hm-searchbar input::placeholder { color: var(--text-muted); }
.hm-sicon {
  position: absolute; left: 32px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; display: flex;
}
.hm-clear {
  position: absolute; right: 28px; top: 50%; transform: translateY(-50%);
  background: none; color: var(--text-muted); font-size: 13px;
  padding: 3px 7px; border-radius: 4px; line-height: 1;
}
.hm-clear:hover { background: var(--bg-hover); color: var(--text); }
.hm-clear.hidden { display: none; }

.hm-body { padding: 12px 14px 18px; }
.hm-res.hidden, .hm-inicial.hidden { display: none; }

/* ---- resultados ---- */
.hm-res-vazio {
  padding: 34px 20px; text-align: center;
  color: var(--text-muted); font-size: 13px;
}
.hm-res-vazio strong { color: var(--text-dim); }
.hm-res-cont {
  font-size: 11px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .5px; padding: 4px 8px 8px;
}
.hm-item {
  display: block; width: 100%; text-align: left; background: none;
  padding: 9px 11px; border-radius: 6px; margin-bottom: 2px;
  border: 1px solid transparent; color: var(--text);
  font-family: var(--font-ui); line-height: 1.5;
}
.hm-item:hover, .hm-item.sel {
  background: var(--bg-hover); border-color: var(--border-light);
}
.hm-item.sel { border-color: var(--accent-dim); }
.hm-i-top { display: flex; align-items: baseline; gap: 9px; }
.hm-i-sig {
  font-family: var(--font-code); font-size: 13px;
  color: var(--syn-fn); font-weight: 600;
}
.hm-i-sig em { font-style: normal; color: var(--accent); background: var(--accent-glow); border-radius: 2px; }
.hm-i-sig .hm-i-args { color: var(--text-muted); font-weight: 400; }
.hm-i-tag {
  margin-left: auto; flex-shrink: 0;
  font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  border: 1px solid var(--border); border-radius: 99px; padding: 1px 8px;
}
.hm-i-sum {
  font-size: 12px; color: var(--text-dim); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hm-i-sum code { color: var(--syn-num); background: none; padding: 0; font-size: 11.5px; }

/* ---- resumo do básico ---- */
.hm-sec {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .7px; color: var(--text-muted);
  padding: 14px 8px 8px;
}
.hm-sec:first-child { padding-top: 4px; }
.hm-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 7px; padding: 0 4px;
}
.hm-card {
  display: block; padding: 10px 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-panel);
  color: var(--text); text-decoration: none;
  transition: border-color 150ms;
}
.hm-card:hover { border-color: var(--accent-dim); }
.hm-card .hc-t { font-size: 12.5px; font-weight: 600; margin-top: 3px; }
.hm-card .hc-d { font-size: 11px; color: var(--text-muted); line-height: 1.45; margin-top: 1px; }

.hm-ref {
  width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 0 4px;
}
.hm-ref td { padding: 5px 8px; border-bottom: 1px solid var(--border); color: var(--text-dim); vertical-align: top; }
.hm-ref tr:last-child td { border-bottom: none; }
.hm-ref td:first-child { width: 40%; }
.hm-ref code { color: var(--syn-num); background: rgba(124,131,255,.08); padding: 1px 5px; border-radius: 3px; font-size: 11.5px; }

.hm-pills { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px; }
.hm-pill {
  font-family: var(--font-code); font-size: 11.5px;
  background: var(--bg-panel); border: 1px solid var(--border);
  color: var(--text-dim); padding: 4px 11px; border-radius: 99px;
  text-decoration: none; transition: border-color 150ms, color 150ms;
}
.hm-pill:hover { border-color: var(--accent); color: var(--accent); }
.hm-pill .hp-n { color: var(--text-muted); margin-left: 5px; }

/* ---- rodapé ---- */
.hm-footer { display: flex; align-items: center; gap: 14px; }
.hm-hint { font-size: 11px; color: var(--text-muted); flex: 1; }
.hm-hint kbd {
  font-family: var(--font-code); font-size: 10px; color: var(--text-dim);
  border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 3px; padding: 1px 5px; margin-right: 2px;
}
.hm-guia {
  display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none; padding: 8px 15px; font-size: 13px; font-weight: 600;
}
.hm-guia:hover { text-decoration: none; }

/* ---- Botão Executar com menu (nova aba) ---- */
.run-dd { display: flex; align-items: stretch; }
.run-dd .btn-run { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.run-dd .btn-run-seta {
  border-top-left-radius: 0; border-bottom-left-radius: 0;
  padding-left: 7px; padding-right: 8px;
  border-left: 1px solid rgba(0, 0, 0, 0.22);
}
.run-dd .hdr-dd-menu { right: 0; left: auto; min-width: 232px; }
.run-dd .hdr-dd-item { display: flex; align-items: center; gap: 8px; }
.hdr-dd-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-muted);
  padding: 7px 11px 4px;
}

/* ============================================================
   MODO CELULAR — só a IDE
   Vira layout de uma coluna com abas, barra de símbolos sobre o
   teclado e um painel deslizante para o que não cabe na tela.
   A classe .mob é posta em <html> por mobile.js.
   ============================================================ */

/* Nada disso aparece fora do modo celular. */
#mob-barra, #mob-teclas, #mob-painel, #mob-fundo, #mob-topo { display: none; }

.mob {
  /* Bloqueia o "puxar para atualizar" e o balanço elástico, que
     atrapalham quem está rolando código. */
  overscroll-behavior: none;
}

/* O corpo vira uma coluna: barra superior, conteúdo elástico, barra de
   símbolos e barra de abas. Sem isso o #main-layout continuaria
   reservando 100vh menos o cabeçalho — que no celular nem existe — e o
   editor terminaria por baixo das barras.
   100dvh acompanha a barra de endereço do navegador quando ela some. */
.mob body {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}
/* Os sobrepostos são fixos e não entram na coluna. */
.mob body > .modal-overlay,
.mob body > #autocomplete-popup,
.mob body > #signature-popup,
.mob body > #mob-fundo,
.mob body > #mob-painel { flex: none; }

/* ---- barra superior compacta ---- */
.mob #header { display: none; }
.mob #mob-topo {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 10px;
  padding-top: env(safe-area-inset-top);
  height: calc(52px + env(safe-area-inset-top));
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mob #mob-topo .mt-nome {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mob #mob-topo .mt-status { font-size: 10.5px; }

/* ---- área principal: uma coisa por vez ---- */
.mob #main-layout {
  flex-direction: column;
  height: auto;
  flex: 1;
  min-height: 0;
}
.mob #resizer { display: none; }
.mob #editor-panel,
.mob #console-panel {
  flex: 1;
  min-width: 0;
  min-height: 0;
}
.mob #main-layout[data-aba="editor"] #console-panel,
.mob #main-layout[data-aba="console"] #editor-panel { display: none; }
.mob .panel-tab { display: none; }
.mob #metadata-bar { display: none; }

.mob #line-numbers { min-width: 40px; padding: 12px 4px 12px 2px; }
.mob #highlight-layer,
.mob #error-layer,
.mob #warning-layer,
.mob #code-editor { padding: 12px 12px 12px 10px; }
.mob #console-saida { padding: 12px 12px 20px; }

/* Rolar com o dedo dentro do editor sem arrastar a página junto. */
.mob #code-editor { -webkit-overflow-scrolling: touch; }

/* Quebra de linha automática: sem ela, ler código no celular vira um
   arrastar horizontal constante. */
.mob.quebra #code-editor,
.mob.quebra #highlight-layer,
.mob.quebra #error-layer,
.mob.quebra #warning-layer { white-space: pre-wrap; word-break: break-word; }
.mob.quebra #line-numbers { display: none; }

/* ---- barra de abas e ações, na base ---- */
.mob #mob-barra {
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 5px 6px;
  padding-bottom: calc(5px + env(safe-area-inset-bottom));
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.mob-b {
  flex: 1;
  min-height: 44px; /* alvo de toque confortável */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
  padding: 4px 2px;
  position: relative;
}
.mob-b svg { width: 17px; height: 17px; }
.mob-b:active { background: var(--bg-hover); }
.mob-b.ativo { color: var(--accent); background: var(--accent-glow); }
.mob-b.destaque { background: var(--accent); color: #fff; }
.mob-b.destaque:active { filter: brightness(1.12); }
.mob-b .mb-ponto {
  position: absolute;
  top: 5px;
  right: calc(50% - 16px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  display: none;
}
.mob-b.tem-novidade .mb-ponto { display: block; }

/* ---- barra de símbolos ---- */
.mob #mob-teclas {
  display: none;
  gap: 5px;
  padding: 6px 7px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.mob #mob-teclas::-webkit-scrollbar { display: none; }
.mob.teclas #mob-teclas { display: flex; }
.mob-k {
  flex: 0 0 auto;
  min-width: 40px;
  height: 40px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-editor);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--font-code);
  font-size: 15px;
  line-height: 1;
}
.mob-k:active { background: var(--accent); color: #fff; border-color: var(--accent); }
.mob-k.k-larga { font-family: var(--font-ui); font-size: 12px; font-weight: 600; padding: 0 12px; }
.mob-k.k-sep {
  flex: 0 0 auto;
  width: 1px;
  min-width: 1px;
  padding: 0;
  background: var(--border);
  border: none;
  border-radius: 0;
  align-self: center;
  height: 24px;
  pointer-events: none;
}

/* ---- painel deslizante com o resto dos comandos ---- */
.mob #mob-fundo {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 5, 0.6);
  z-index: 190;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms;
}
.mob.painel #mob-fundo { opacity: 1; pointer-events: auto; }

.mob #mob-painel {
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  max-height: 84vh;
  background: var(--bg-modal);
  border-top: 1px solid var(--border-light);
  border-radius: 14px 14px 0 0;
  transform: translateY(100%);
  /* Fechado, sai da árvore de acessibilidade também: um diálogo apenas
     deslocado continuaria sendo lido por leitor de tela. */
  visibility: hidden;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), visibility 220ms;
  padding-bottom: env(safe-area-inset-bottom);
}
.mob.painel #mob-painel { transform: translateY(0); visibility: visible; }
.mob-p-topo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mob-p-topo h3 { font-size: 14px; font-weight: 700; color: var(--text); flex: 1; }
.mob-p-alca {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: 3px;
  background: var(--border-light);
}
.mob-p-corpo { overflow-y: auto; padding: 10px 12px 18px; }

.mob-p-sec {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  padding: 12px 6px 6px;
}
.mob-p-linha { display: flex; align-items: center; gap: 10px; padding: 6px; }
.mob-p-linha .mp-rot { flex: 1; font-size: 13px; color: var(--text); }
.mob-p-linha .mp-sub { display: block; font-size: 11px; color: var(--text-muted); }

/* Interruptor acessível: alvo grande e estado legível sem depender de cor */
.mob-sw {
  min-width: 62px;
  min-height: 34px;
  border-radius: 99px;
  border: 1px solid var(--border-light);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.mob-sw[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.mob-passo { display: flex; align-items: center; gap: 6px; }
.mob-passo button {
  min-width: 44px;
  min-height: 38px;
  border-radius: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}
.mob-passo button:active { background: var(--bg-hover); }
.mob-passo .mp-val {
  min-width: 46px;
  text-align: center;
  font-family: var(--font-code);
  font-size: 12.5px;
  color: var(--text-dim);
}

/* No painel, cada menu suspenso vira uma seção aberta: dentro de uma
   folha rolável, um menu flutuante ficaria cortado. */
.mob #mob-p-comandos .header-right {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.mob #mob-p-comandos .hdr-dd { position: static; }
.mob #mob-p-comandos .hdr-dd-menu {
  position: static;
  display: block;
  min-width: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0 0 0 12px;
  margin: 0;
}
.mob #mob-p-comandos .hdr-dd-arrow { display: none; }
.mob #mob-p-comandos .btn-icon,
.mob #mob-p-comandos .hdr-dd-item,
.mob #mob-p-comandos .btn-run {
  justify-content: flex-start;
  width: 100%;
  min-height: 44px;
  font-size: 13px;
  border-radius: 8px;
}
.mob #mob-p-comandos .btn-group { display: contents; }
.mob #mob-p-comandos .app-brand,
.mob #mob-p-comandos .header-center,
.mob #mob-p-comandos .run-dd .btn-run-seta { display: none; }

.mob .mob-p-acoes { display: flex; flex-direction: column; gap: 4px; }
.mob .mob-p-acoes .btn-icon {
  justify-content: flex-start;
  width: 100%;
  min-height: 44px;
  font-size: 13px;
  border-radius: 8px;
}

/* Fechar do painel: alvo quadrado e confortável, fora da lista. */
.mob #mob-fechar {
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  flex: 0 0 auto;
}

/* ---- ajustes finos ---- */
.mob #autocomplete-popup { max-height: 34vh; font-size: 14px; }
.mob .ac-item { padding: 10px 12px; min-height: 42px; }
.mob #signature-popup { font-size: 13px; }
.mob .modal-box { max-height: 90vh; border-radius: 12px; }
.mob .modal-overlay { padding: 8px; align-items: flex-end; }
.mob #search-box { padding: 8px; gap: 6px; }
.mob #search-input { font-size: 16px; min-height: 40px; }
.mob #search-box .btn-icon { min-width: 40px; min-height: 40px; justify-content: center; }
.mob .console-input-field { font-size: 16px; min-height: 38px; }

/* Foco sempre visível: no celular a navegação por teclado externo e
   por leitor de tela depende disso. */
.mob button:focus-visible,
.mob input:focus-visible,
.mob textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .mob #mob-painel, .mob #mob-fundo { transition: none; }
}
