/* Suite común: tokens, barra superior y componentes compartidos por todas las herramientas.
   Paleta grafito y acero; mismos valores que el simulador CNC. */
:root {
  --bg: #e9e9e6; --surface: #fbfbfa; --surface-2: #f2f2ef; --surface-3: #e8e7e2;
  --line: #dcdbd4; --line-2: #cbc9c0;
  --ink: #17191d; --ink-2: #4b4f57; --ink-3: #7d8088;
  --accent: #3f454d; --accent-2: #2f343a; --accent-ink: #ffffff; --accent-soft: #e4e5e7;
  --btn: linear-gradient(180deg, #5d646d 0%, #454b53 52%, #33383e 100%);
  --btn-hover: linear-gradient(180deg, #6a727b 0%, #50575f 52%, #3c4148 100%);
  --btn-edge: #24282d;
  --ok: #1d8049; --warn: #a8700f; --err: #c43434; --info: #2a67ad;
  --ok-soft: #dcf1e5; --warn-soft: #f8ecd2; --err-soft: #f9dede; --info-soft: #dde9f7;
  --air: #1f6fd1; --air-soft: rgba(31, 111, 209, 0.14); --elec: #c2410c; --elec-on: #e8590c;
  --canvas: #f6f6f3; --grid: #e3e3dd; --grid-2: #d6d6cf;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06), 0 3px 10px rgba(16, 24, 40, 0.06);
  --shadow-2: 0 12px 40px rgba(16, 24, 40, 0.22);
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  --r: 8px; --r-sm: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0b0d; --surface: #121417; --surface-2: #181b1f; --surface-3: #1f2328; --line: #272b31; --line-2: #343941;
    --ink: #ece9e2; --ink-2: #aeaba4; --ink-3: #777a80;
    --accent: #c4c9cf; --accent-2: #dde1e5; --accent-ink: #ffffff; --accent-soft: #23272c;
    --btn: linear-gradient(180deg, #737b85 0%, #5a616a 52%, #474d55 100%); --btn-hover: linear-gradient(180deg, #808892 0%, #666d76 52%, #525860 100%); --btn-edge: #2a2e33;
    --ok: #46c07c; --warn: #e3ab3e; --err: #f26868; --info: #61a6f2;
    --ok-soft: #13301f; --warn-soft: #33270f; --err-soft: #3a1717; --info-soft: #14263a;
    --air: #5aa2ff; --air-soft: rgba(90, 162, 255, 0.16); --elec: #ff8a4c; --elec-on: #ffa45e;
    --canvas: #0f1114; --grid: #1a1e23; --grid-2: #232830;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3); --shadow-2: 0 14px 44px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0b0d; --surface: #121417; --surface-2: #181b1f; --surface-3: #1f2328; --line: #272b31; --line-2: #343941;
  --ink: #ece9e2; --ink-2: #aeaba4; --ink-3: #777a80;
  --accent: #c4c9cf; --accent-2: #dde1e5; --accent-ink: #ffffff; --accent-soft: #23272c;
  --btn: linear-gradient(180deg, #737b85 0%, #5a616a 52%, #474d55 100%); --btn-hover: linear-gradient(180deg, #808892 0%, #666d76 52%, #525860 100%); --btn-edge: #2a2e33;
  --ok: #46c07c; --warn: #e3ab3e; --err: #f26868; --info: #61a6f2;
  --ok-soft: #13301f; --warn-soft: #33270f; --err-soft: #3a1717; --info-soft: #14263a;
  --air: #5aa2ff; --air-soft: rgba(90, 162, 255, 0.16); --elec: #ff8a4c; --elec-on: #ffa45e;
  --canvas: #0f1114; --grid: #1a1e23; --grid-2: #232830;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3); --shadow-2: 0 14px 44px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Barra superior ---------- */
.suite-bar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 14px; padding-top: env(safe-area-inset-top, 0px);
  background: var(--surface); border-bottom: 1px solid var(--line); }
.sb-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); flex: none; }
.sb-mark { width: 30px; height: 30px; flex: none; }
.sb-name { font-weight: 700; font-size: 14.5px; line-height: 1.05; letter-spacing: -0.01em; }
.sb-name small { display: block; font: 600 9px var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--ink-3); margin-top: 2px; }
.sb-sep { width: 1px; height: 24px; background: var(--line); flex: none; }
.sb-tool { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sb-tool small { font-weight: 400; color: var(--ink-3); margin-left: 6px; }
.sb-grow { flex: 1; }
.sb-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; background: transparent; color: var(--ink-2); padding: 6px 9px; border-radius: var(--r-sm); white-space: nowrap; font-size: 13px; text-decoration: none; }
.sb-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.sb-btn svg { width: 16px; height: 16px; flex: none; }
.sb-btn.acc { border-color: var(--line); }
.sb-pop { position: absolute; top: calc(100% + 6px); right: 14px; width: min(560px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); padding: 12px; z-index: 60; }
.sb-pop h3 { margin: 4px 6px 10px; font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.sb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.sb-app { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 9px; text-decoration: none; color: var(--ink); border: 1px solid transparent; }
.sb-app:hover { background: var(--surface-2); border-color: var(--line); }
.sb-app[aria-current="page"] { background: var(--accent-soft); }
.sb-app .ic { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; flex: none; color: var(--ink-2); }
.sb-app .ic svg { width: 19px; height: 19px; }
.sb-app b { display: block; font-size: 13.5px; }
.sb-app span { display: block; font-size: 12px; color: var(--ink-3); }
.sb-app em { font-style: normal; font: 600 9.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 4px; margin-left: 4px; }
@media (max-width: 720px) {
  .suite-bar { gap: 6px; padding: 0 10px; }
  .sb-name small, .sb-btn .lbl { display: none; }
  .sb-name { font-size: 13.5px; }
}
@media (max-width: 480px) { .sb-brand .sb-name { display: none; } }

/* ---------- Componentes ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 500; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--btn); border-color: var(--btn-edge); color: var(--accent-ink); font-weight: 600; text-shadow: 0 1px 1px rgba(0, 0, 0, .3); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16); }
.btn.primary:hover { background: var(--btn-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 4px 8px; font-size: 12px; }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 7px; font-size: 13px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .field .lab { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.field input, .field select, .field textarea, .inp { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 7px 9px; width: 100%; min-width: 0; }
.field input[type="number"], .inp.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.field .hint { font-size: 11.5px; color: var(--ink-3); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 14px; font-weight: 650; }
.panel-body { padding: 14px; }
.eyebrow { font: 600 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-2); padding: 7px 9px; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 6px 9px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.tbl tr:last-child td { border-bottom: 0; }
.toast-wrap { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--surface); padding: 9px 14px; border-radius: 10px; box-shadow: var(--shadow-2); font-size: 13px; max-width: calc(100vw - 32px); }
dialog.dlg { border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog.dlg::backdrop { background: rgba(10, 13, 18, .45); backdrop-filter: blur(2px); }
dialog.dlg[open] { display: flex; flex-direction: column; }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: 16px; }
.dlg-head .x { margin-left: auto; }
.dlg-body { padding: 16px 18px; overflow: auto; min-height: 0; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Nube (Suite.cloud) ---------- */
.sb-pop.sc-pop { width: min(320px, calc(100vw - 24px)); padding: 6px; }
.sc-status { display: flex; align-items: center; gap: 7px; padding: 8px 10px 9px; margin-bottom: 4px; font-size: 12.5px; color: var(--ink-2); border-bottom: 1px solid var(--line); min-width: 0; }
.sc-status b { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sc-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; }
.sc-status .dot.ok { background: var(--ok); }
.sc-mi { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--ink); }
.sc-mi:hover, .sc-mi:focus-visible { background: var(--surface-2); border-color: var(--line); }
.sc-mi svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--ink-2); }
.sc-mi b { display: block; font-size: 13.5px; font-weight: 600; }
.sc-mi span { display: block; font-size: 12px; color: var(--ink-3); }
dialog.dlg.sc-dlg { width: min(460px, calc(100vw - 24px)); }
dialog.dlg.sc-dlg.wide { width: min(620px, calc(100vw - 24px)); }
.sc-dlg .dlg-body { display: flex; flex-direction: column; gap: 12px; }
.sc-dlg p { margin: 0; }
.sc-seg { align-self: flex-start; max-width: 100%; }
.sc-seg button { white-space: nowrap; }
.sc-form { display: flex; flex-direction: column; gap: 11px; }
.sc-form .field input { padding: 9px 10px; font-size: 14px; }
.sc-submit { align-self: stretch; padding: 9px 12px; font-size: 14px; }
.sc-muted { font-size: 12.5px; color: var(--ink-3); }
.sc-muted a { color: var(--ink-2); }
.sc-sep { border-top: 1px solid var(--line); padding-top: 10px; }
.sc-err { font-size: 12.5px; color: var(--err); min-height: 0; }
.sc-err:empty { display: none; }
.sc-msg { font-size: 13px; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
.sc-msg.info { background: var(--info-soft); border-color: transparent; }
.sc-msg.warn { background: var(--warn-soft); border-color: transparent; }
.sc-msg a { color: inherit; font-weight: 600; }
.sc-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.sc-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sc-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sc-item:last-child { border-bottom: 0; }
.sc-item.cur { background: var(--accent-soft); }
.sc-main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sc-main b { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.sc-main b .chip { font-size: 10.5px; padding: 0 6px; margin-left: 4px; vertical-align: 1px; font-weight: 500; }
.sc-main > span { font-size: 12px; color: var(--ink-3); }
.sc-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.sc-url { font: 11.5px var(--mono); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.sc-ren { flex: 1 1 100%; display: flex; gap: 6px; min-width: 0; }
.sc-ren input { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 8px; }
.sc-empty { font-size: 13px; color: var(--ink-3); padding: 18px 12px; text-align: center; border: 1px dashed var(--line-2); border-radius: 10px; }
.sc-copy { display: flex; gap: 6px; min-width: 0; }
.sc-copy input { flex: 1; min-width: 0; font: 12.5px var(--mono); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 7px 9px; }
.sc-foot { justify-content: flex-end; align-items: center; }
.sc-who { margin-right: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); min-width: 0; }
.sc-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-who svg { width: 15px; height: 15px; flex: none; }
@media (max-width: 480px) {
  .sc-dlg .dlg-head, .sc-dlg .dlg-body, .sc-dlg .dlg-foot { padding-left: 14px; padding-right: 14px; }
  .sc-acts { width: 100%; }
  .sc-acts .btn { flex: 1; }
  .sc-who { flex-basis: 100%; }
}
.sc-dlg .btn.danger, .sc-dlg .btn.danger:hover { background: var(--err); border-color: var(--err); color: #fff; }

/* Selector de idioma de la barra */
.sb-pop.sb-lpop { width: 180px; padding: 6px; }
.sb-lang { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--ink); font-size: 13.5px; }
.sb-lang b { font: 600 11px var(--mono); letter-spacing: .06em; color: var(--ink-3); width: 22px; }
.sb-lang:hover, .sb-lang:focus-visible { background: var(--surface-2); border-color: var(--line); }
.sb-lang[aria-checked="true"] { background: var(--accent-soft); border-color: var(--line); }
.sb-lang[aria-checked="true"] b { color: var(--accent); }
#sb-lang .lbl { display: inline; font: 600 11.5px var(--mono); letter-spacing: .06em; }
