/* TRAZING — interfaz tipo CAD. Tokens de color en :root; tema claro con [data-theme="light"]. */
:root {
  --bg: #0f1318; --chrome: #151a21; --panel: #171c23; --panel-2: #1e242d; --panel-3: #252c37;
  --line: #2b333f; --line-2: #39424f;
  --text: #e7eaef; --muted: #96a2b2; --faint: #6b7686;
  --accent: #2f9bd8; --accent-2: #5bb8ee; --accent-ink: #04121c;
  --canvas: #1b2028;
  --ok: #22c55e; --warn: #f59e0b; --info: #3b82f6; --bad: #ef4444; --pend: #8b95a5;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --r: 8px; --gut: 16px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef1f5; --chrome: #f7f8fa; --panel: #ffffff; --panel-2: #f3f5f8; --panel-3: #e8ecf1;
  --line: #dde2e9; --line-2: #c9d0da;
  --text: #17202b; --muted: #5b6878; --faint: #8a95a3;
  --accent: #0a6fb5; --accent-2: #0f84d6; --accent-ink: #ffffff;
  --canvas: #f8fafc; --shadow: 0 10px 30px rgba(15,23,42,.15);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.4 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .fine { color: var(--faint); font-size: 11.5px; margin: 14px 0 0; }
.err { color: var(--bad); min-height: 1.2em; margin: 6px 0; }
.grow { flex: 1; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--panel-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { border-color: color-mix(in srgb, var(--bad) 60%, transparent); color: var(--bad); background: transparent; }
.btn.wide { width: 100%; height: 40px; margin-top: 6px; }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; background: transparent; border-radius: 6px; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn svg, .rb svg, .btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
input[type=text], input[type=password], input[type=search], input[type=number], select, textarea {
  width: 100%; height: 34px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel-2); outline: none;
}
textarea { height: auto; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 0; }
label > input, label > select, label > textarea { margin-top: 4px; color: var(--text); font-size: 14px; }

/* ---------- Bloqueo ---------- */
.lock { position: fixed; inset: 0; display: grid; place-items: center; padding: var(--gut); background: radial-gradient(1200px 600px at 20% 0%, #1b2633 0%, var(--bg) 60%); z-index: 50; overflow: auto; }
:root[data-theme="light"] .lock { background: radial-gradient(1200px 600px at 20% 0%, #dbe7f3 0%, var(--bg) 60%); }
.lock-card { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; box-shadow: var(--shadow); }
.lock-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.lock-brand b { display: block; letter-spacing: .14em; font-size: 15px; } .lock-brand small { color: var(--muted); }
.lock h1 { font-size: 18px; margin: 0 0 4px; }
.logo { width: 28px; height: 28px; border-radius: 7px; flex: none; background:
  linear-gradient(135deg, transparent 46%, var(--accent) 46% 54%, transparent 54%),
  repeating-linear-gradient(0deg, transparent 0 6px, color-mix(in srgb, var(--accent) 35%, transparent) 6px 7px),
  var(--panel-3); border: 1px solid var(--line-2); }

/* ---------- Estructura ---------- */
.app { position: fixed; inset: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
.app > * { min-width: 0; }
.topbar { height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 10px; background: var(--chrome); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); height: calc(44px + env(safe-area-inset-top)); }
.brand { display: flex; align-items: center; gap: 8px; letter-spacing: .14em; font-size: 12.5px; margin-right: 6px; }
.brand .logo { width: 22px; height: 22px; border-radius: 5px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab { height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab.active { color: var(--text); background: var(--panel-3); box-shadow: inset 0 -2px 0 var(--accent); }
.top-right { display: flex; align-items: center; gap: 6px; }
.proj-name { color: var(--muted); max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip { padding: 3px 8px; border-radius: 999px; background: var(--panel-3); color: var(--muted); font-size: 12px; white-space: nowrap; }

.ribbon { display: flex; gap: 0; padding: 6px 8px; background: var(--chrome); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; min-height: 74px; }
.rgroup { display: flex; flex-direction: column; padding: 0 8px; border-right: 1px solid var(--line); flex: none; }
.rgroup:last-child { border-right: 0; }
.rgroup .rbtns { display: flex; gap: 2px; flex: 1; align-items: flex-start; }
.rgroup .rlabel { font-size: 10.5px; color: var(--faint); text-align: center; letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; }
.rb { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 58px; max-width: 84px; padding: 5px 6px; border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; color: var(--text); font-size: 11.5px; line-height: 1.15; text-align: center; }
.rb svg { width: 22px; height: 22px; color: var(--accent-2); }
.rb:hover { background: var(--panel-2); border-color: var(--line); }
.rb.on { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }

.workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr) 330px; min-height: 0; }
.panel { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.panel.right { border-right: 0; border-left: 1px solid var(--line); }
.panel-tabs { display: flex; border-bottom: 1px solid var(--line); }
.ptab { flex: 1; height: 34px; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.ptab.active { color: var(--text); border-bottom-color: var(--accent); }
.panel-head { height: 34px; display: flex; align-items: center; padding: 0 12px; border-bottom: 1px solid var(--line); gap: 8px; }
.panel-search { padding: 8px; border-bottom: 1px solid var(--line); }
.panel-search input, .panel-search select { height: 30px; }
.panel-search select { margin-bottom: 6px; font-weight: 600; }
.panel-body { overflow: auto; flex: 1; min-height: 0; padding: 6px 0 20px; }

/* Árbol */
.tree-group > summary { list-style: none; display: flex; align-items: center; gap: 6px; padding: 6px 10px; cursor: pointer; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
.tree-group > summary::-webkit-details-marker { display: none; }
.tree-group > summary::before { content: ''; width: 0; height: 0; border: 4px solid transparent; border-left-color: currentColor; transition: transform .15s; }
.tree-group[open] > summary::before { transform: rotate(90deg) translateX(2px); }
.tree-group > summary .cnt { margin-left: auto; color: var(--faint); }
.titem { display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 22px; cursor: pointer; min-width: 0; }
.titem:hover { background: var(--panel-2); }
.titem.sel { background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: inset 2px 0 0 var(--accent); }
.titem .code { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.titem .desc { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.chips { display: flex; gap: 2px; flex: none; }
.chip { width: 8px; height: 14px; border-radius: 2px; background: var(--panel-3); }
.st-aprobado { background: var(--ok) !important; } .st-verificado { background: var(--info) !important; } .st-ejecutado { background: var(--warn) !important; }
.st-pendiente { background: var(--pend) !important; opacity: .55; } .st-rechazado { background: var(--bad) !important; }
.tx-aprobado { color: var(--ok); } .tx-verificado { color: var(--info); } .tx-ejecutado { color: var(--warn); } .tx-pendiente { color: var(--pend); } .tx-rechazado { color: var(--bad); }

/* Capas */
.lrow { display: flex; align-items: center; gap: 8px; padding: 5px 10px; min-width: 0; }
.lrow:hover { background: var(--panel-2); }
.lrow .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; border: 1px solid rgba(255,255,255,.15); }
.lrow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .meta { color: var(--faint); font-size: 11px; }
.lrow.sub { padding-left: 30px; font-size: 12px; }
.lsec { padding: 10px 10px 4px; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 8px; }
.eye { width: 26px; height: 22px; border: 0; background: transparent; cursor: pointer; color: var(--muted); display: grid; place-items: center; border-radius: 4px; flex: none; }
.eye:hover { background: var(--panel-3); }
.eye.off { opacity: .35; }
.eye svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; }

/* Panel derecho */
.sec { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.sec h3 { margin: 0 0 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.big { font-size: 20px; font-weight: 600; font-family: var(--mono); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; background: var(--panel-3); white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.steps { display: flex; flex-direction: column; gap: 8px; }
.step { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--panel-2); }
.step-head { display: flex; align-items: center; gap: 8px; }
.step-head b { flex: 1; }
.flow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 8px; }
.flow div { border-radius: 5px; padding: 4px 6px; background: var(--panel-3); font-size: 11px; line-height: 1.25; min-width: 0; }
.flow div b { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 500; }
.flow div.done { background: color-mix(in srgb, var(--ok) 22%, var(--panel-3)); }
.flow div.done b { color: var(--ok); }
.flow div span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plink { display: flex; gap: 6px; align-items: center; padding: 4px 0; font-size: 12px; cursor: pointer; color: var(--accent-2); border: 0; background: none; text-align: left; width: 100%; }
.plink:hover { text-decoration: underline; }
.plink .grow { color: var(--muted); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warnbox { border: 1px solid color-mix(in srgb, var(--warn) 50%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); color: var(--text); border-radius: 6px; padding: 6px 8px; font-size: 12px; margin-top: 6px; }
table.t { width: 100%; border-collapse: collapse; font-size: 11.5px; font-family: var(--mono); }
table.t th { text-align: right; color: var(--muted); font-weight: 500; padding: 3px 4px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
table.t td { text-align: right; padding: 3px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th:first-child, table.t td:first-child { text-align: left; }
table.t tr:hover td { background: var(--panel-2); }
.tscroll { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.empty { padding: 24px 16px; color: var(--muted); text-align: center; }
.empty b { display: block; color: var(--text); margin-bottom: 6px; font-size: 14px; }

/* ---------- Visor ---------- */
.viewport { position: relative; overflow: hidden; background: var(--canvas); min-width: 0; touch-action: none; }
#view { position: absolute; inset: 0; display: block; }
.watermark { position: absolute; inset: 0; pointer-events: none; opacity: .07; background-repeat: repeat; }
.hud { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line-2); padding: 6px 12px; border-radius: 8px; box-shadow: var(--shadow); font-size: 12.5px; max-width: calc(100% - 32px); text-align: center; backdrop-filter: blur(6px); }
.hud .live { display: block; font-family: var(--mono); color: #fde68a; font-size: 12px; }
:root[data-theme="light"] .hud .live { color: #92400e; }
.north { position: absolute; right: 14px; top: 12px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-2); background: color-mix(in srgb, var(--panel) 85%, transparent); display: grid; place-items: center; font-weight: 700; font-size: 12px; pointer-events: none; }
.north::before { content: ''; position: absolute; top: 3px; border: 5px solid transparent; border-bottom: 8px solid var(--bad); }
.north span { margin-top: 8px; }
.scalebar { position: absolute; left: 12px; bottom: 10px; display: flex; flex-direction: column; gap: 2px; font-family: var(--mono); font-size: 11px; color: var(--muted); pointer-events: none; }
.scalebar i { display: block; height: 6px; border: 1.5px solid var(--muted); border-top: 0; }
.gnss-card { position: absolute; right: 12px; bottom: 12px; width: min(300px, calc(100% - 24px)); background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
.gnss-card .gk { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-family: var(--mono); font-size: 12px; }
.gnss-card .gk dt { color: var(--muted); font-family: var(--font); }
.gnss-card .gk dd { margin: 0; text-align: right; }
.gnss-card .stake { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.gnss-card .stake .big { color: var(--accent-2); }
.gnss-card .acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.cutfill { font-weight: 700; } .cutfill.cut { color: #fb923c; } .cutfill.fill { color: #38bdf8; }

.dock { position: absolute; left: 0; right: 0; bottom: 0; height: 42%; min-height: 200px; background: var(--panel); border-top: 1px solid var(--line-2); display: flex; flex-direction: column; box-shadow: 0 -10px 30px rgba(0,0,0,.3); }
.dock-head { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 12px; border-bottom: 1px solid var(--line); }
.dock-body { flex: 1; min-height: 0; overflow: auto; padding: 8px 12px; }
.dock-body svg text { fill: var(--muted); font: 11px var(--font); }

.board { position: absolute; inset: 0; background: var(--bg); overflow: auto; padding: 16px; }
.board-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.board-head h2 { margin: 0; font-size: 17px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.kpi small { color: var(--muted); display: block; }
.kpi b { font-size: 22px; font-family: var(--mono); }
.kpi .bar { height: 6px; border-radius: 3px; background: var(--panel-3); margin-top: 8px; display: flex; overflow: hidden; }
.kpi .bar i { display: block; height: 100%; }
.matrix-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: auto; }
table.matrix { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12px; }
table.matrix th, table.matrix td { padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.matrix thead th { position: sticky; top: 0; background: var(--panel-2); z-index: 1; color: var(--muted); font-weight: 500; text-align: center; }
table.matrix thead th:first-child, table.matrix td:first-child { position: sticky; left: 0; background: var(--panel); text-align: left; z-index: 2; }
table.matrix thead th:first-child { background: var(--panel-2); z-index: 3; }
table.matrix tr.grp td { background: var(--panel-2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
table.matrix td.cell { text-align: center; cursor: pointer; }
.mcell { display: inline-flex; min-width: 76px; justify-content: center; padding: 2px 6px; border-radius: 5px; font-size: 11px; color: #0b1118; font-weight: 600; }
.mcell.na { background: transparent; color: var(--faint); font-weight: 400; }
table.matrix tr:hover td { background: var(--panel-2); }
table.matrix .code { font-family: var(--mono); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.drop-hint { position: absolute; inset: 10px; border: 2px dashed var(--accent); border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--canvas) 80%, transparent); font-size: 16px; text-align: center; pointer-events: none; }
.drop-hint small { display: block; color: var(--muted); margin-top: 6px; font-size: 12px; }

/* ---------- Comandos y estado ---------- */
.bottom { background: var(--chrome); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.cmd { padding: 2px 10px 0; }
.cmd-log { height: 38px; overflow: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: pre-wrap; }
.cmd-log .ok { color: var(--text); } .cmd-log .warn { color: var(--warn); } .cmd-log .res { color: #fde68a; }
:root[data-theme="light"] .cmd-log .res { color: #92400e; }
.cmd-line { display: flex; align-items: center; gap: 8px; height: 28px; border-top: 1px solid var(--line); }
.cmd-prompt { font-family: var(--mono); font-size: 12px; color: var(--accent-2); white-space: nowrap; }
.cmd-line input { flex: 1; height: 26px; border: 0; background: transparent; font-family: var(--mono); font-size: 12.5px; padding: 0; outline: none; box-shadow: none; }
.status { display: flex; align-items: center; gap: 10px; height: 26px; padding: 0 10px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.coord { font-family: var(--mono); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.toggles { display: flex; gap: 2px; }
.tog { height: 20px; padding: 0 7px; border: 1px solid var(--line-2); border-radius: 4px; background: transparent; color: var(--faint); font-size: 10.5px; letter-spacing: .04em; cursor: pointer; }
.tog.on { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.st-gnss, .st-save { white-space: nowrap; }

/* ---------- Modal, ocupado, toasts ---------- */
.modal { position: fixed; inset: 0; background: rgba(3,6,10,.55); display: grid; place-items: center; z-index: 40; padding: var(--gut); }
.modal-card { width: min(640px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); }
.modal-card.wide { width: min(1000px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 12px 16px 16px; overflow: auto; }
.modal-body .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 13px; margin-top: 10px; }
.check input { width: 16px; height: 16px; margin: 0; }
.busy { position: fixed; inset: 0; background: rgba(3,6,10,.5); display: grid; place-items: center; z-index: 45; padding: var(--gut); }
.busy-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 18px; text-align: center; box-shadow: var(--shadow); }
.busy-card small { color: var(--muted); display: block; margin-top: 6px; min-height: 1.2em; }
.busy .bar { height: 6px; border-radius: 3px; background: var(--panel-3); margin-top: 12px; overflow: hidden; }
.busy .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.spinner { width: 28px; height: 28px; margin: 0 auto 10px; border-radius: 50%; border: 3px solid var(--panel-3); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toasts { position: fixed; right: 16px; bottom: 70px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100% - 32px); }
.toast { background: var(--panel); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); padding: 9px 12px; border-radius: 8px; box-shadow: var(--shadow); max-width: 420px; transition: opacity .3s, transform .3s; }
.toast.ok { border-left-color: var(--ok); } .toast.warn { border-left-color: var(--warn); } .toast.err { border-left-color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(6px); }
.pdfview { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pdfview canvas { max-width: 100%; border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.3); background: #fff; }

.only-mobile { display: none !important; }
.fab { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.fab button { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--panel); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--accent-2); }
.fab button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.fab button.on { background: var(--accent); color: var(--accent-ink); }

/* ---------- Tableta / móvil ---------- */
@media (max-width: 1180px) { .workspace { grid-template-columns: 250px minmax(0, 1fr) 300px; } .proj-name { display: none; } }
@media (max-width: 860px) {
  .only-mobile { display: inline-grid !important; }
  .fab.only-mobile { display: flex !important; }
  .brand b, .user-chip { display: none; }
  .topbar { gap: 4px; padding: 0 6px; padding-top: env(safe-area-inset-top); }
  .tab { padding: 0 9px; }
  .ribbon { min-height: 0; padding: 4px; }
  .rgroup { padding: 0 4px; }
  .rgroup .rlabel { display: none; }
  .rb { min-width: 50px; font-size: 10.5px; padding: 4px; }
  .rb svg { width: 20px; height: 20px; }
  .workspace { grid-template-columns: minmax(0, 1fr); position: relative; }
  .cmd-line input { min-width: 0; width: 100%; }
  .panel { position: absolute; top: 0; bottom: 0; z-index: 20; width: min(340px, 88vw); box-shadow: var(--shadow); transition: transform .22s ease; }
  .panel.left { left: 0; transform: translateX(-105%); }
  .panel.right { right: 0; transform: translateX(105%); }
  .panel.open { transform: none; }
  .cmd-log { display: none; }
  .status .toggles { display: none; }
  .st-save { display: none; }
  .gnss-card { left: 12px; right: 76px; width: auto; bottom: 12px; }
  .dock { height: 55%; }
  .scalebar { bottom: auto; top: 12px; }
  .grid2 { grid-template-columns: 1fr; }
  .toasts { bottom: 90px; right: 12px; left: 12px; }
  .toast { max-width: none; }
}
