/* ═══════════════════════════════════════════════════════════════════════════
   ASSISTENTE DE VOZ V3 — Plano de Ações
   ═══════════════════════════════════════════════════════════════════════════ */

/* Botão na toolbar — estilos definidos em ── Botões IA no toolbar ── acima */

/* Overlay flutuante (gravação / edição) */
.v3-overlay {
  position: fixed; right: 24px; bottom: 24px;
  width: 420px; max-height: 70vh;
  background: #0f0f12; color: #f0f0f0;
  border: 1px solid rgba(0,239,255,.27);
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0,0,0,.6), 0 0 24px rgba(0,239,255,.12);
  z-index: 9999; display: flex; flex-direction: column; overflow: hidden;
  font-family: inherit;
}
.v3-header {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px; border-bottom: 1px solid #1c1c20;
}
.v3-pulse {
  width: 10px; height: 10px; border-radius: 50%; background: #ff3b3b; flex-shrink: 0;
  animation: v3pulse 1.4s infinite;
}
@keyframes v3pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,59,59,.8); }
  70%  { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.v3-status { flex: 1; font-weight: 600; font-size: 13px; }
.v3-close {
  background: transparent; border: 0; color: #666;
  cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 4px;
}
.v3-close:hover { color: #ccc; }

.v3-transcript {
  padding: 12px 14px; overflow-y: auto; flex: 1;
  min-height: 80px; max-height: 260px;
  line-height: 1.6; font-size: 14px;
}
.v3-final   { color: #f0f0f0; }
.v3-interim { color: #666; font-style: italic; }

.v3-edit { padding: 12px 14px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.v3-edit textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  background: #0e0e10; color: #f0f0f0;
  border: 1px solid #2a2a2e; border-radius: 7px;
  padding: 9px 11px; font-size: 14px; line-height: 1.55;
  font-family: inherit;
}
.v3-edit textarea:focus { outline: none; border-color: rgba(0,239,255,.5); }
.v3-hint { font-size: 12px; color: #888; margin: 0; }
.v3-edit-meta { font-size: 11px; color: #555; }

.v3-actions {
  display: flex; gap: 6px; padding: 9px 12px;
  border-top: 1px solid #1c1c20; flex-shrink: 0;
}
.v3-btn {
  flex: 1; padding: 8px 10px;
  background: #222226; color: #d0d0d0;
  border: 1px solid #333338; border-radius: 6px;
  cursor: pointer; font-size: 13px; font-family: inherit;
}
.v3-btn:hover { background: #2d2d32; }
.v3-btn.primary {
  background: #00efff; color: #060709;
  border-color: #00efff; font-weight: 600;
}
.v3-btn.primary:hover { background: #00d4e0; }

/* Processando */
.v3-processing {
  padding: 32px 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 14px; color: #ccc;
}
.v3-spinner {
  width: 34px; height: 34px;
  border: 3px solid rgba(0,239,255,.18);
  border-top-color: #00efff;
  border-radius: 50%;
  animation: v3spin .85s linear infinite;
}
@keyframes v3spin { to { transform: rotate(360deg); } }
.v3-processing small { color: #555; font-size: 11px; }

/* Erro */
.v3-error { padding: 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.v3-error strong { color: #ff6b6b; }
.v3-error p { font-size: 13px; color: #aaa; margin: 0; }

/* ── Modal de revisão do plano ── */
.v3-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000;
}
.v3-modal {
  background: #161618; color: #f0f0f0;
  width: min(840px, 95vw); max-height: 90vh;
  border: 1px solid #2a2a2e; border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column;
  font-family: inherit;
}
.v3-modal-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px 20px; border-bottom: 1px solid #222226; flex-shrink: 0;
}
.v3-modal-header h3 { margin: 0 0 3px; font-size: 16px; }
.v3-modal-header small { color: #777; font-size: 12px; }
.v3-modal-close {
  background: transparent; border: 0; color: #888;
  font-size: 18px; cursor: pointer; padding: 2px 5px;
}
.v3-modal-close:hover { color: #ccc; }

.v3-modal-transcript {
  margin: 10px 20px 0; padding: 9px 12px;
  background: #0e0e10; border-radius: 7px; font-size: 12px; flex-shrink: 0;
  border: 1px solid #222226;
}
.v3-modal-transcript summary { cursor: pointer; color: #aaa; user-select: none; }
.v3-modal-transcript p { margin: 7px 0 0; color: #c8d0d8; line-height: 1.55; }

.v3-modal-body {
  overflow-y: auto; flex: 1; padding: 0 20px;
}
.v3-modal-section { padding: 14px 0 6px; }
.v3-modal-section h4 { margin: 0 0 10px; font-size: 13px; color: #9aa5b4; text-transform: uppercase; letter-spacing: .04em; }

/* Ação card */
.v3-action {
  background: #1c1c1f; border: 1px solid #262628;
  border-radius: 8px; padding: 11px 13px; margin-bottom: 8px;
}
.v3-action-head {
  display: flex; align-items: center; gap: 9px;
  cursor: pointer; user-select: none;
}
.v3-action-toggle { width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }
.v3-action-title  { flex: 1; font-weight: 600; font-size: 13px; }
.v3-badge {
  font-size: 10px; padding: 2px 7px; border-radius: 10px;
  text-transform: uppercase; font-weight: 600; letter-spacing: .03em;
}
.v3-badge-success { background: #0d3520; color: #5fd8a5; }
.v3-badge-warn    { background: #342e0e; color: #e8c14d; }
.v3-badge-danger  { background: #341212; color: #ff8b8b; }
.v3-badge-muted   { background: #222; color: #777; }

.v3-action-quote {
  color: #666; font-style: italic; font-size: 12px;
  margin: 7px 0 0; padding-left: 24px;
}
.v3-action-body  { padding-left: 24px; margin-top: 8px; }
.v3-action-meta  { font-size: 12px; color: #9aa5b4; margin-bottom: 6px; }
.v3-action-input {
  width: 100%; box-sizing: border-box;
  background: #0e0e10; color: #f0f0f0;
  border: 1px solid #2a2a2e; border-radius: 6px;
  padding: 7px 9px; font-size: 13px; line-height: 1.5;
  resize: vertical; font-family: inherit;
}
.v3-action-slots {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 7px;
}
.v3-action-slots label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: #777; }
.v3-action-slots input,
.v3-replace-row  input {
  background: #0e0e10; color: #f0f0f0;
  border: 1px solid #2a2a2e; border-radius: 5px;
  padding: 5px 8px; font-size: 13px; font-family: inherit;
}
.v3-replace-row { display: flex; align-items: center; gap: 6px; }
.v3-replace-row input { flex: 1; }
.v3-replace-row span  { color: #555; }
.v3-pending { font-size: 11px; color: #e8c14d; margin-top: 5px; }

/* Trechos não mapeados */
.v3-warn-section { border-left: 3px solid #e8c14d; padding-left: 14px; }
.v3-warn-section ul { margin: 0; padding-left: 16px; }
.v3-warn-section li { font-size: 13px; color: #b0b8c4; margin-bottom: 4px; }
.v3-warn-section li em { color: #777; }
.v3-empty { color: #555; font-style: italic; font-size: 13px; }

.v3-modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 13px 20px; border-top: 1px solid #222226; flex-shrink: 0;
}
.v3-modal-footer .v3-btn { flex: 0 0 auto; }

/* Toast de confirmação */
.v3-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 9px 18px; background: #0d3520; color: #5fd8a5;
  border-radius: 8px; font-size: 13px; z-index: 10001;
  box-shadow: 0 4px 24px rgba(0,0,0,.5); white-space: nowrap;
  animation: v3fadeIn .2s ease-out;
}
.v3-toast.warn { background: #342e0e; color: #e8c14d; }
@keyframes v3fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ═══════════════════════════════════════════════════════════════════════════
   ASSISTENTE DE VOZ V4 — 1 chamada, laudo pronto
   ═══════════════════════════════════════════════════════════════════════════ */

/* Botão legado — mantido caso JS ainda use a classe antiga */
.etb-voz-v4 {
  background: linear-gradient(135deg, #1a3a2a, #0d2218);
  color: #5fd8a5; border: 1px solid #2a6644;
  font-size: 12px; padding: 4px 10px; border-radius: 6px;
  cursor: pointer; transition: background .2s, box-shadow .2s;
}

/* Overlay de status (canto inferior direito) — harmonizado com o review modal v3 */
.v4-overlay {
  position: fixed; right: 24px; bottom: 24px; z-index: 9900;
  background: #0f1218; border: 1px solid #232a36; border-radius: 16px;
  padding: 16px; min-width: 300px; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.03) inset;
  color: #e8eaef;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 13px;
  display: flex; flex-direction: column; gap: 12px;
  transition: opacity .2s;
}
.v4-overlay[hidden] { display: none; }

/* ── Elementos internos do overlay ── */
.v4-header {
  display: flex; align-items: center; gap: 10px;
}
.v4-status { flex: 1; font-size: 13.5px; font-weight: 600; color: #e8eaef; letter-spacing: -0.01em; }
.v4-close {
  background: none; border: none; color: #6b7280; font-size: 16px;
  cursor: pointer; padding: 4px 7px; border-radius: 7px; line-height: 1; transition: all .15s;
}
.v4-close:hover { color: #e8eaef; background: #1a2030; }
.v4-transcript {
  font-size: 13.5px; color: #cdd2de; line-height: 1.6;
  max-height: 200px; overflow-y: auto;
  background: #0a0d12; border: 1px solid #1d2330; border-radius: 10px; padding: 11px 13px;
}
.v4-transcript:empty { display: none; }
.v4-transcript .v4-interim { color: #6b7280; font-style: italic; }
.v4-pulse {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: #f87171; box-shadow: 0 0 0 4px rgba(248,113,113,.14);
  animation: v4pulseDot 1.1s ease-in-out infinite; flex-shrink: 0;
}
@keyframes v4pulseDot { 0%,100%{opacity:1;transform:scale(1);} 50%{opacity:.45;transform:scale(.72);} }
.v4-hint { margin: 0 0 8px; font-size: 12px; color: #6b7280; }
.v4-edit { display: flex; flex-direction: column; gap: 6px; }
.v4-edit textarea {
  width: 100%; field-sizing: content; min-height: 2.6em;
  background: #0a0d12; color: #e8eaef;
  border: 1px solid #1d2330; border-radius: 10px; padding: 11px 13px;
  font-family: inherit; font-size: 14px; line-height: 1.65;
  resize: none; box-sizing: border-box;
}
.v4-edit textarea:focus { outline: none; border-color: #4d8eff; box-shadow: 0 0 0 3px rgba(77,142,255,.18); }
.v4-edit-meta { font-size: 11px; color: #5a6478; text-align: right; }
.v4-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 2px; }
.v4-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid #2c333f;
  background: #161b24; color: #9ba0aa; font-size: 13px; font-weight: 550; cursor: pointer;
  font-family: inherit; transition: all .15s;
}
.v4-btn:hover { background: #1b212c; color: #e8eaef; border-color: #353a45; }
.v4-btn.primary {
  background: linear-gradient(135deg, #15824f, #11633c); color: #fff;
  border-color: transparent; font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
.v4-btn.primary:hover { background: linear-gradient(135deg, #189558, #137044); }
.v4-processing {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 14px 0; color: #9ba0aa; font-size: 13px;
}
.v4-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid #1d2330; border-top-color: #4d8eff;
  animation: v4spin .8s linear infinite;
}
@keyframes v4spin { to { transform: rotate(360deg); } }
.v4-error { display: flex; flex-direction: column; gap: 8px; }
.v4-error strong { color: #f87171; }
.v4-error p { margin: 0; font-size: 13px; color: #9ba0aa; }

/* ── Fase de revisão de transcrição: centralizado e grande ── */
.v4-overlay.v4-phase-editing {
  position: fixed;
  left: 50%; top: 50%;
  right: auto; bottom: auto;
  transform: translate(-50%, -50%);
  width: min(90vw, 900px);
  min-width: 560px; max-width: 900px;
  padding: 22px 24px;
  gap: 14px;
}
.v4-overlay.v4-phase-editing .v4-edit textarea {
  font-size: 15px; line-height: 1.65;
}

/* Fases — borda de acento sutil por estado */
.v4-overlay.v4-phase-recording { border-color: #5a2828; }
.v4-overlay.v4-phase-recording .v4-pulse { background: #f87171; }
@keyframes v4blink { 0%,100%{opacity:1;} 50%{opacity:.3;} }
.v4-overlay.v4-phase-processing { border-color: #25406a; }
.v4-overlay.v4-phase-done      { border-color: #1f5a38; }
.v4-overlay.v4-phase-error     { border-color: #5a2424; }

/* Transcript preview */
.v4-transcript-preview {
  font-size: 11px; color: #8899aa; font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 300px;
}

/* Botões de ação no overlay */
.v4-overlay-actions { display: flex; gap: 8px; justify-content: flex-end; }
.v4-overlay-actions button {
  padding: 5px 12px; border-radius: 6px; border: 1px solid;
  font-size: 12px; cursor: pointer; transition: background .15s;
}
.v4-btn-primary  { background: #1a4a30; color: #5fd8a5; border-color: #2a6644; }
.v4-btn-primary:hover { background: #1f5a38; }
.v4-btn-secondary { background: #1a1f2e; color: #8899aa; border-color: #2a3045; }
.v4-btn-secondary:hover { background: #1f2535; }
.v4-btn-danger   { background: #2e1a1a; color: #f87171; border-color: #5a2020; }
.v4-btn-danger:hover { background: #3a1f1f; }

/* ── Modal de revisão diff ── */
.v4-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  z-index: 10000; display: flex; align-items: flex-start;
  justify-content: center; padding: 24px 12px; overflow-y: auto;
}
.v4-modal-backdrop[hidden] { display: none; }

.v4-modal {
  background: #0e1117; border: 1px solid #1e2533; border-radius: 16px;
  width: 100%; max-width: 960px; display: flex; flex-direction: column;
  max-height: calc(100vh - 48px); overflow: hidden;
  box-shadow: 0 16px 60px rgba(0,0,0,.8);
}

.v4-modal-header {
  padding: 16px 20px 12px; border-bottom: 1px solid #1e2533;
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.v4-modal-header h2 { margin: 0; font-size: 16px; color: #cdd6f4; flex: 1; }
.v4-modal-close {
  background: none; border: none; color: #8899aa;
  font-size: 18px; cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.v4-modal-close:hover { color: #cdd6f4; background: #1a1f2e; }

.v4-modal-body {
  overflow-y: auto; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 16px; flex: 1;
}

/* Área rolável do modal */
.v4-modal-scroll {
  overflow-y: auto; padding: 14px 20px;
  display: flex; flex-direction: column; gap: 12px; flex: 1;
}

/* Rodapé do modal */
.v4-modal-footer {
  padding: 12px 20px; border-top: 1px solid #1e2533;
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0; background: #0b0e14;
}
.v4-modal-footer-left  { display: flex; gap: 8px; }
.v4-modal-footer-right { display: flex; gap: 8px; }
.v4-modal-footer button {
  padding: 7px 16px; border-radius: 8px; border: 1px solid;
  font-size: 13px; cursor: pointer; transition: background .15s;
}
/* ── Comparison modal columns ── */
.v4-cmp-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px 20px;
}
.v4-cmp-col {
  display: flex; flex-direction: column; gap: 10px;
  background: #0f1420; border: 1px solid #1e2533; border-radius: 10px;
  padding: 14px; min-width: 0;
}
.v4-cmp-col--dg { border-color: #1a3a5c; background: #0a1422; }
.v4-cmp-header {
  display: flex; flex-direction: column; gap: 2px;
}
.v4-cmp-source {
  font-size: 13px; font-weight: 600; color: #cdd6f4;
}
.v4-cmp-col--dg .v4-cmp-source { color: #7ec8f4; }
.v4-cmp-sub {
  font-size: 11px; color: #5566aa;
}
.v4-cmp-text {
  flex: 1; margin: 0; padding: 10px 12px;
  background: #070a10; border: 1px solid #1a2030; border-radius: 8px;
  font-family: inherit; font-size: 13px; line-height: 1.6;
  color: #aab4cc; white-space: pre-wrap; overflow-y: auto; max-height: 320px;
}
.v4-cmp-pick {
  align-self: stretch;
}
.v4-cmp-hint {
  font-size: 12px; color: #4a5570;
}

/* ── Toast v4 ── */
.v4-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 9px 18px; background: #0d3520; color: #5fd8a5;
  border-radius: 8px; font-size: 13px; z-index: 10100;
  box-shadow: 0 4px 24px rgba(0,0,0,.5); white-space: nowrap;
  animation: v4fadeIn .2s ease-out;
}
.v4-toast.warn  { background: #342e0e; color: #e8c14d; }
.v4-toast.error { background: #2e1212; color: #f87171; }
@keyframes v4fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* Toast com ação (Tentar de novo) — não some sozinho rápido */
.v4-toast--action { display: inline-flex; align-items: center; gap: 12px; white-space: normal; max-width: min(92vw, 560px); }
.v4-toast-retry {
  flex-shrink: 0; border: 1px solid #f8717155; background: #3a1818; color: #fca5a5;
  border-radius: 7px; padding: 5px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.v4-toast-retry:hover { background: #4a1d1d; color: #fecaca; }

/* ════════════════════════════════════════════════════════════════════════
   Highlights da auto-aplicação por voz (Fase 2) — vivem dentro de #laudo-editor.
   São só de tela: laudo-pdf.js os remove na exportação (Fase 3.3).
   ════════════════════════════════════════════════════════════════════════ */

/* Pivô clínico — auto-aceito, cosmético/auditável (lateralidade/negação/medida) */
.alv-pivot-flag {
  background: rgba(245, 200, 66, 0.30);
  border-bottom: 1px dashed rgba(168, 130, 18, 0.65);
  border-radius: 2px; padding: 0 1px;
}

/* Termo adicionado pela IA — PENDENTE: gate obrigatório (✓ confirmar / ✕ remover) */
.alv-added-term {
  background: rgba(248, 113, 113, 0.22);
  border-bottom: 1.5px solid rgba(220, 80, 80, 0.75);
  border-radius: 3px; padding: 0 2px; white-space: nowrap;
}
.alv-added-term[data-status="accepted"] { background: transparent; border-bottom: none; }
.alv-added-term__ctl { display: inline-flex; gap: 2px; margin-left: 5px; vertical-align: baseline; user-select: none; }
.alv-added-term__btn {
  border: none; border-radius: 4px; cursor: pointer; line-height: 1;
  font-size: 10.5px; font-weight: 700; padding: 1px 5px; color: #fff; min-width: 18px;
}
/* Glifos via pseudo-conteúdo: nunca entram em innerText (não poluem a máscara da IA). */
.alv-added-term__btn[data-act="accept"] { background: #15824f; }
.alv-added-term__btn[data-act="accept"]::before { content: "\2713"; } /* ✓ */
.alv-added-term__btn[data-act="accept"]:hover { background: #189558; }
.alv-added-term__btn[data-act="reject"] { background: #7a2020; }
.alv-added-term__btn[data-act="reject"]::before { content: "\2715"; } /* ✕ */
.alv-added-term__btn[data-act="reject"]:hover { background: #962727; }
@keyframes alvShake { 0%,100%{transform:translateX(0);} 20%,60%{transform:translateX(-4px);} 40%,80%{transform:translateX(4px);} }
.alv-added-term--shake { animation: alvShake .5s ease-in-out; box-shadow: 0 0 0 3px rgba(248,113,113,.35); }

/* ── Atalhos bar — abaixo da toolbar, só aparece com máscara com perfis ── */
.editor-atalhos-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-right: 1px solid #e2e8f0;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}
.dark-mode .editor-atalhos-inline { border-right-color: #1e2535; }
.etb-atalhos-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.etb-atalhos-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.etb-atalhos-btns .snp-item {
  font-size: 12px;
  padding: 3px 10px;
  height: 26px;
  border-radius: 6px;
  background: #14171d;
  border: 1px solid #262a33;
  color: #9ba0aa;
  cursor: pointer;
  transition: background 120ms, color 120ms, border-color 120ms;
  white-space: nowrap;
}
.etb-atalhos-btns .snp-item:hover {
  background: rgba(77, 142, 255, 0.08);
  border-color: #4d8eff;
  color: #a5b4fc;
}

.editor-ruler-wrap {
  display: flex;
  flex-direction: row;
  width: min(21cm, 100%);
  margin-bottom: 4px;
  flex-shrink: 0;
}

.editor-ruler-corner {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: #d8dce2;
  border: 1px solid #c8ccd2;
  border-radius: 3px 0 0 0;
  box-sizing: border-box;
}

.editor-ruler-v-wrap {
  flex-shrink: 0;
  width: 18px;
  margin: 0;
  align-self: stretch;
}

.editor-ruler-v {
  position: relative;
  width: 18px;
  height: 100%;
  background: #e8eaed;
  border: 1px solid #c8ccd2;
  border-radius: 3px;
  overflow: hidden;
  user-select: none;
  box-shadow: 1px 0 3px rgba(0,0,0,0.08);
}

.ruler-v-margin { position: absolute; left: 0; right: 0; background: #d0d4da; }

.ruler-tick-v-cm {
  position: absolute; left: 0; right: 0;
  height: 1px; background: #666;
}
.ruler-tick-v-mm {
  position: absolute; left: 0;
  height: 1px; background: #aaa;
  width: 5px;
}
.ruler-tick-v-mm.half { width: 7px; background: #999; }

.ruler-label-v {
  position: absolute;
  left: 0; right: 0;
  font-size: 7px;
  font-family: sans-serif;
  color: #555;
  text-align: center;
  transform: translateY(-50%);
  pointer-events: none;
  line-height: 1;
}

/* Dark mode — régua vertical */
.dark-mode .editor-ruler-corner {
  background: #111827;
  border-color: #2a3650;
}
.dark-mode .editor-ruler-v {
  background: #1a2133;
  border-color: #2a3650;
  box-shadow: none;
}
.dark-mode .ruler-v-margin  { background: #111827; }
.dark-mode .ruler-tick-v-cm { background: #4b6080; }

/* ── Réguas (tema estelar) ──────────────────────────────────────────────── */

.editor-page-grid {
  display: inline-grid;
  grid-template-columns: 18px 21cm;
  grid-template-rows: 18px auto;
  gap: 0;
  align-items: start;
}
.editor-page-grid.ruler-off { display: block; }
.editor-page-grid .editor-page { grid-column: 2; grid-row: 2; }

/* Canto */
.editor-ruler-corner {
  grid-column: 1; grid-row: 1;
  background: #e8eaed;
  border-right: 1px solid #c8ccd2;
  border-bottom: 1px solid #c8ccd2;
  box-sizing: border-box;
}

/* Régua horizontal */
.editor-ruler-h-wrap { grid-column: 2; grid-row: 1; }
.editor-ruler {
  position: relative;
  width: 100%; height: 18px;
  background: #e8eaed;
  border-bottom: 1px solid #c8ccd2;
  overflow: hidden;
  user-select: none;
  box-sizing: border-box;
}
.ruler-content-zone {
  position: absolute; top: 0; bottom: 0;
  background: #fff;
  z-index: 0;
}
.ruler-margin { position: absolute; top: 0; bottom: 0; background: #e0e3e8; z-index: 0; }
.ruler-tick-cm {
  position: absolute; bottom: 0;
  width: 1px; height: 10px;
  background: #888; z-index: 2;
}
.ruler-tick-mm {
  position: absolute; bottom: 0;
  width: 1px; height: 4px;
  background: #c0c4cc; z-index: 2;
}
.ruler-tick-mm.half { height: 6px; background: #aaa; }
.ruler-label {
  position: absolute;
  bottom: 10px;
  font-size: 7.5px;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #555;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 3;
  background: transparent;
  line-height: 1;
}

/* Régua vertical */
.editor-ruler-v-wrap { grid-column: 1; grid-row: 2; align-self: stretch; }
.editor-ruler-v {
  position: relative;
  width: 18px; height: 100%;
  min-height: 29.7cm;
  background: #e8eaed;
  border-right: 1px solid #c8ccd2;
  overflow: hidden;
  user-select: none;
  box-sizing: border-box;
}
.ruler-v-content-zone { position: absolute; left: 0; right: 0; background: #fff; z-index: 0; }
.ruler-v-margin { position: absolute; left: 0; right: 0; background: #e0e3e8; z-index: 0; }
.ruler-tick-v-cm {
  position: absolute; right: 0;
  width: 10px; height: 1px;
  background: #888; z-index: 2;
}
.ruler-tick-v-mm {
  position: absolute; right: 0;
  width: 4px; height: 1px;
  background: #c0c4cc; z-index: 2;
}
.ruler-tick-v-mm.half { width: 6px; background: #aaa; }
.ruler-label-v {
  position: absolute;
  right: 0; left: 0;
  font-size: 7px;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #555;
  text-align: center;
  pointer-events: none;
  z-index: 3;
  line-height: 1;
}

.etb-ruler-toggle.is-active { background: #e0e7ff; color: #4338ca; }

/* ── Dark mode: tema neon estelar ── */
.dark-mode .editor-ruler-corner {
  background: #0d1521;
  border-color: rgba(99,162,255,0.25);
}
.dark-mode .editor-ruler {
  background: #0d1521;
  border-bottom: 1px solid rgba(99,162,255,0.25);
  box-shadow: 0 1px 6px rgba(56,132,255,0.08);
}
.dark-mode .ruler-content-zone { background: rgba(30,48,80,0.6); }
.dark-mode .ruler-margin       { background: #0a101c; }
.dark-mode .ruler-tick-cm      { background: rgba(99,162,255,0.7); }
.dark-mode .ruler-tick-mm      { background: rgba(56,100,180,0.35); }
.dark-mode .ruler-tick-mm.half { background: rgba(80,130,220,0.5); }
.dark-mode .ruler-label        { color: rgba(120,180,255,0.75); }

.dark-mode .editor-ruler-v {
  background: #0d1521;
  border-right: 1px solid rgba(99,162,255,0.25);
  box-shadow: 1px 0 6px rgba(56,132,255,0.08);
}
.dark-mode .ruler-v-content-zone { background: rgba(30,48,80,0.6); }
.dark-mode .ruler-v-margin       { background: #0a101c; }
.dark-mode .ruler-tick-v-cm      { background: rgba(99,162,255,0.7); }
.dark-mode .ruler-tick-v-mm      { background: rgba(56,100,180,0.35); }
.dark-mode .ruler-tick-v-mm.half { background: rgba(80,130,220,0.5); }
.dark-mode .ruler-label-v        { color: rgba(120,180,255,0.75); }

.dark-mode .etb-ruler-toggle.is-active { background: #1e2847; color: #818cf8; }
