/* ==========================================================================
   ATHEN COCKPIT — Caelestia glass · Tokyo Night · terminal industrial
   Tokens en 3 capas (primitivos → semánticos → componentes), color en OKLCH.
   Fuente local: sin red, y xterm mide las celdas con la fuente ya cargada.
   ========================================================================== */

@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap;
  src: url('vendor/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap;
  src: url('vendor/fonts/jetbrains-mono-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; font-display: swap;
  src: url('vendor/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; font-display: swap;
  src: url('vendor/fonts/jetbrains-mono-latin-ext-500-normal.woff2') format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 700; font-display: swap;
  src: url('vendor/fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-weight: 700; font-display: swap;
  src: url('vendor/fonts/jetbrains-mono-latin-ext-700-normal.woff2') format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: dark;

  /* 1 · primitivos */
  --p-ink-chrome: oklch(0.155 0.018 268);
  --p-ink-term: oklch(0.150 0.016 266);
  --p-lavender-1: oklch(0.846 0.061 275);
  --p-lavender-2: oklch(0.767 0.054 275);
  --p-lavender-3: oklch(0.677 0.063 274);
  --p-cyan: oklch(0.820 0.105 236);
  --p-blue: oklch(0.719 0.132 264);
  --p-gold: oklch(0.784 0.106 75);
  --p-green: oklch(0.795 0.139 130);
  --p-red: oklch(0.723 0.159 10);
  --p-violet: oklch(0.751 0.134 299);

  /* 2 · semánticos (texto: ≥ 4.5:1 sobre el cristal más claro previsto) */
  --fg-1: var(--p-lavender-1);
  --fg-2: var(--p-lavender-2);
  --fg-3: var(--p-lavender-3);
  --accent: var(--p-cyan);
  --accent-2: var(--p-blue);
  --brand: var(--p-gold);
  --ok: var(--p-green);
  --warn: var(--p-gold);
  --err: var(--p-red);
  --violet: var(--p-violet);

  --surface-chrome: oklch(0.155 0.018 268 / 0.72);
  --surface-term: oklch(0.150 0.016 266 / 0.82);
  --surface-raised: oklch(1 0 0 / 0.06);
  --surface-hover: oklch(1 0 0 / 0.10);
  --surface-press: oklch(0.82 0.105 236 / 0.20);
  --line: oklch(1 0 0 / 0.09);
  --line-strong: oklch(0.82 0.105 236 / 0.40);
  --focus: var(--accent);

  /* 3 · escala y movimiento */
  --fs-xs: 0.75rem;   /* 12px — mínimo del chrome */
  --fs-sm: 0.8125rem; /* 13px */
  --fs-md: 0.9375rem; /* 15px */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 12px;
  --hit: 28px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --t-fast: 120ms;
  --t-base: 180ms;
  --font: 'JetBrains Mono', 'Cascadia Mono', Consolas, ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: var(--font); }

html, body { height: 100%; }
body {
  overflow: hidden;
  background: transparent;
  color: var(--fg-1);
  font-size: var(--fs-sm);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.fg-2 { color: var(--fg-2); }
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
input:focus-visible { outline: none; }

/* El chrome no se selecciona; el contenido (valores, nombres, rutas) sí. */
.titlebar, .tabbar, button, kbd, .eyebrow, .banner { user-select: none; -webkit-user-select: none; }

/* ---------- Mascota ---------- */
.pet-canvas-large { width: 112px; height: 112px; image-rendering: pixelated; filter: drop-shadow(0 6px 16px oklch(0 0 0 / 0.4)); flex: none; }
.pet-canvas-mini { width: 24px; height: 24px; image-rendering: pixelated; flex: none; }

/* ---------- Ventana ---------- */
.full-window {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface-chrome);
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px oklch(0 0 0 / 0.55), inset 0 1px 0 oklch(1 0 0 / 0.10);
}

/* ---------- Botones ---------- */
.icon-btn {
  width: var(--hit); height: var(--hit);
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: var(--r-sm);
  color: var(--fg-2); cursor: pointer;
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) var(--ease-out);
}
.icon-btn:active, .btn-primary:active, .btn-text:active, .row:active, .tab-add:active { transform: scale(0.97); }
.icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--surface-press); }
@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover { background: var(--surface-hover); color: var(--fg-1); }
  .icon-btn.danger:hover { background: oklch(0.723 0.159 10 / 0.22); color: var(--err); }
}

.btn-primary {
  min-height: 32px; padding: 0 16px;
  background: var(--surface-press); color: var(--accent);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  transition: background-color var(--t-fast) ease, transform var(--t-fast) var(--ease-out);
}
.btn-text {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 24px; padding: 0 8px;
  background: transparent; border: none; border-radius: var(--r-sm);
  color: var(--accent); font-size: var(--fs-xs); font-weight: 600; cursor: pointer;
  transition: background-color var(--t-fast) ease, transform var(--t-fast) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: oklch(0.82 0.105 236 / 0.30); }
  .btn-text:hover { background: var(--surface-hover); }
}

kbd {
  font-size: var(--fs-xs); color: var(--fg-3);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; line-height: 18px;
}

/* ---------- Estado ---------- */
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--fg-3); }
.dot.on { background: var(--ok); box-shadow: 0 0 6px oklch(0.795 0.139 130 / 0.6); }
.dot.idle { background: var(--warn); }
.dot.err { background: var(--err); }
.dot.off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--fg-3); }

/* ---------- Barra de título ---------- */
.titlebar {
  height: 40px; flex: none;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--line);
}
.tb-id { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-name { font-weight: 700; color: var(--fg-1); letter-spacing: 0.02em; white-space: nowrap; }
.tb-sep { color: var(--fg-3); }
.tb-host { color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-status { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--fg-2); }
.tb-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }

/* ---------- Pestañas ---------- */
.tabbar {
  height: 36px; flex: none; display: flex; align-items: stretch;
  padding: 0 8px; gap: 4px;
  border-bottom: 1px solid var(--line);
}
.tabs { display: flex; align-items: stretch; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 0 6px 0 12px; min-width: 0; flex: none;
  background: transparent; border: none; border-radius: var(--r-sm) var(--r-sm) 0 0;
  color: var(--fg-3); font-size: var(--fs-sm); cursor: pointer; white-space: nowrap;
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease;
}
.tab::after {
  content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px;
  transform: scaleX(0); transition: transform var(--t-base) var(--ease-out);
}
.tab[aria-selected="true"] { color: var(--fg-1); background: var(--surface-raised); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }
.tab-close {
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--r-sm); background: transparent; color: var(--fg-3);
  font-size: var(--fs-xs); cursor: pointer; opacity: 0.55; transition: opacity var(--t-fast) ease, background-color var(--t-fast) ease, color var(--t-fast) ease;
}
.tab-close.armed { opacity: 1; width: auto; padding: 0 8px; color: var(--err); }
.tab[aria-selected="true"] .tab-close, .tab:focus-within .tab-close { opacity: 1; }
.tab-spacer { width: 6px; flex: none; }
.tab-add { width: 32px; align-self: center; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: var(--r-sm); color: var(--fg-2); cursor: pointer;
  transition: background-color var(--t-fast) ease, transform var(--t-fast) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .tab:hover { color: var(--fg-1); background: var(--surface-raised); }
  .tab:hover .tab-close { opacity: 1; }
  .tab-close:hover { background: oklch(0.723 0.159 10 / 0.22); color: var(--err); }
  .tab-add:hover { background: var(--surface-hover); color: var(--fg-1); }
}

/* ---------- Escenario ---------- */
.stage { flex: 1; min-height: 0; display: flex; }
.view { flex: 1; min-width: 0; min-height: 0; display: flex; }

/* ---------- Inicio ---------- */
#dashboard-view { flex-direction: column; padding: 28px 32px 16px; gap: 20px; overflow-y: auto; }
.dash { flex: 1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr); gap: 48px; align-content: start; }
.ff-block { display: flex; gap: 28px; align-items: flex-start; min-width: 0; }
.ff { min-width: 0; }
.ff-user-host { font-size: var(--fs-md); font-weight: 700; color: var(--accent); }
.ff-rule { height: 1px; background: var(--line); margin: 8px 0 10px; }
.ff-list { display: flex; flex-direction: column; gap: 2px; }
.ff-row { display: flex; gap: 14px; }
.ff-row dt { width: 64px; flex: none; color: var(--accent); font-weight: 600; }
.ff-row dd { color: var(--fg-1); min-width: 0; overflow-wrap: anywhere; }
.ff-row dd.dim { color: var(--fg-3); }
.ff-row dd.ok { color: var(--ok); }
.swatches { display: flex; gap: 6px; margin-top: 16px; }
.swatches span { width: 22px; height: 10px; border-radius: 2px; }

.eyebrow { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-3); display: flex; align-items: center; gap: 6px; }
.eyebrow .count { color: var(--fg-3); font-weight: 500; letter-spacing: 0; }
.launch { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.launch .eyebrow:not(:first-child) { margin-top: 16px; }
.rows { display: flex; flex-direction: column; gap: 2px; }
.row {
  min-height: 40px; width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 6px 10px; text-align: left;
  background: transparent; border: none; border-radius: var(--r-sm);
  color: var(--fg-1); cursor: pointer;
  transition: background-color var(--t-fast) ease, transform var(--t-fast) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .row:hover { background: var(--surface-hover); } }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-name { font-weight: 600; }
.row-meta { font-size: var(--fs-xs); color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-state { font-size: var(--fs-xs); color: var(--fg-3); }
.empty { padding: 8px 10px; color: var(--fg-3); font-size: var(--fs-xs); }

.dash-prompt { flex: none; display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.prompt-label { display: inline-flex; flex: none; font-weight: 700; }
.p-user { color: var(--accent); } .p-colon { color: var(--fg-3); } .p-tilde { color: var(--violet); } .p-dollar { color: var(--ok); margin: 0 4px 0 2px; }
.prompt-input {
  flex: 1; min-width: 0; min-height: 28px;
  background: transparent; border: none; outline: none;
  color: var(--fg-1); font-size: var(--fs-sm);
  caret-color: var(--accent); caret-shape: block;
}
.prompt-input::placeholder { color: var(--fg-3); }

/* ---------- Terminal ---------- */
#cli-view { flex-direction: row; }
.term-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface-term); position: relative; }
.term-host { flex: 1; min-height: 0; overflow: hidden; padding: 10px 6px 6px 12px; cursor: text; }
.term-host .xterm, .term-host .xterm-viewport { background: transparent !important; }
.term-host .xterm-viewport { scrollbar-width: none; }
.term-host .xterm-viewport::-webkit-scrollbar { display: none; }

.banner {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 4px 8px 4px 14px; min-height: 32px;
  font-size: var(--fs-xs); color: var(--fg-1);
  background: oklch(0.784 0.106 75 / 0.14); border-bottom: 1px solid oklch(0.784 0.106 75 / 0.35);
  transition: opacity var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out);
}
.banner.err { background: oklch(0.723 0.159 10 / 0.14); border-bottom-color: oklch(0.723 0.159 10 / 0.4); }
@starting-style { .banner { opacity: 0; transform: translateY(-4px); } }

.mobile-keys { display: none; }

/* ---------- Panel de recursos ---------- */
.side {
  width: 248px; flex: none; display: flex; flex-direction: column; gap: 20px;
  padding: 16px 14px; overflow-y: auto;
  background: var(--surface-chrome); border-left: 1px solid var(--line);
  scrollbar-width: thin; scrollbar-color: oklch(1 0 0 / 0.15) transparent;
}
.side section { display: flex; flex-direction: column; gap: 8px; }
.list { display: flex; flex-direction: column; gap: 1px; max-height: 240px; overflow-y: auto; scrollbar-width: thin; }
.item {
  display: flex; align-items: center; gap: 8px; min-height: 24px; padding: 0 6px;
  background: transparent; border: none; border-radius: 4px; text-align: left;
  color: var(--fg-1); font-size: var(--fs-xs); cursor: default; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
button.item { cursor: pointer; transition: background-color var(--t-fast) ease; }
@media (hover: hover) and (pointer: fine) { button.item:hover { background: var(--surface-hover); } }
.item .glyph { color: var(--accent); }
.item.dim { color: var(--fg-3); }
.meters { display: flex; flex-direction: column; gap: 10px; }
.meter { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); }
.meter-head { display: flex; justify-content: space-between; color: var(--fg-2); }
.meter-bar { height: 4px; border-radius: 2px; background: var(--surface-raised); overflow: hidden; }
.meter-bar > i { display: block; height: 100%; width: var(--v, 0%); background: var(--accent); border-radius: 2px; transition: width var(--t-base) var(--ease-out); }
.meter-bar > i.hot { background: var(--warn); }
.meter-bar > i.crit { background: var(--err); }

/* ---------- Paleta ---------- */
.palette { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; background: oklch(0.1 0.01 268 / 0.55); }
.palette-box {
  width: min(560px, calc(100vw - 32px)); max-height: 60vh; display: flex; flex-direction: column;
  background: oklch(0.19 0.02 268 / 0.96); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: 0 24px 60px oklch(0 0 0 / 0.6), inset 0 1px 0 oklch(1 0 0 / 0.08); overflow: hidden;
  transform-origin: 50% 0;
  transition: opacity var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out);
}
@starting-style { .palette-box { opacity: 0; transform: scale(0.97); } }
#palette-input { height: 44px; padding: 0 16px; background: transparent; border: none; border-bottom: 1px solid var(--line); outline: none; color: var(--fg-1); font-size: var(--fs-md); }
#palette-input::placeholder { color: var(--fg-3); }
#palette-list { list-style: none; overflow-y: auto; padding: 6px; scrollbar-width: thin; }
.p-item { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: var(--r-sm); cursor: pointer; }
.p-item[aria-selected="true"] { background: var(--surface-press); }
.p-item .p-kind { width: 56px; flex: none; font-size: var(--fs-xs); color: var(--fg-3); }
.p-item .p-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-item .p-hint { font-size: var(--fs-xs); color: var(--fg-3); }
.p-empty { padding: 14px 12px; color: var(--fg-3); font-size: var(--fs-xs); }
.palette-foot { padding: 8px 14px; border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--fg-3); }

/* ---------- Conexión ---------- */
.auth-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: oklch(0.1 0.01 268 / 0.7); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.auth-form { width: min(360px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 14px; }
.auth-title { font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.1em; color: var(--brand); }
.auth-form label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); color: var(--accent); }
.auth-form input { width: 100%; min-height: 32px; background: transparent; border: none; border-bottom: 1px solid var(--line); outline: none; color: var(--fg-1); font-size: var(--fs-sm); }
.auth-form input:focus { border-bottom-color: var(--accent); }
.auth-form input::placeholder { color: var(--fg-3); }
.with-btn { display: flex; align-items: center; gap: 4px; }
.auth-error { min-height: 1.2em; font-size: var(--fs-xs); color: var(--err); }

/* ---------- PiP ---------- */
.pip-widget-view { width: 100vw; height: 100vh; padding: 6px; display: flex; }
.pip-glass-card {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 8px 10px;
  background: oklch(0.15 0.017 268 / 0.9); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  backdrop-filter: blur(35px) saturate(180%); -webkit-backdrop-filter: blur(35px) saturate(180%);
  box-shadow: 0 16px 40px oklch(0 0 0 / 0.6), inset 0 1px 0 oklch(1 0 0 / 0.15);
}
.pip-header { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.pip-title-col { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.pip-title { font-size: var(--fs-xs); font-weight: 700; color: var(--fg-1); }
.pip-meta { font-size: var(--fs-xs); color: var(--fg-2); }
.pip-actions { display: flex; gap: 2px; }
.pip-list { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; scrollbar-width: none; }
.pip-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; padding: 0 8px; background: oklch(0 0 0 / 0.3); border-radius: var(--r-sm); font-size: var(--fs-xs); }
.item-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.item-name { color: var(--fg-1); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-badge { font-size: var(--fs-xs); color: var(--fg-2); }
.pill-badge.green { color: var(--ok); } .pill-badge.yellow { color: var(--warn); }

/* ---------- Navegador (no Tauri): no hay wallpaper tras el cristal ---------- */
body.web {
  background:
    radial-gradient(ellipse at 15% 8%, oklch(0.72 0.13 264 / 0.20), transparent 55%),
    radial-gradient(ellipse at 88% 92%, oklch(0.75 0.13 299 / 0.16), transparent 50%),
    oklch(0.17 0.02 268);
}
body.web .full-window { border-radius: 0; border: none; box-shadow: none; }
body.web #btn-pip, body.web #btn-minimize, body.web #btn-close { display: none; }

/* ---------- Táctil: 44px de objetivo ---------- */
@media (pointer: coarse) {
  :root { --hit: 44px; }
  .titlebar { height: 52px; }
  .tabbar { height: 44px; }
  .tab-close { width: 44px; height: 44px; }
  .tab-add { width: 44px; height: 44px; }
  .row { min-height: 48px; }
  .btn-text { min-height: 44px; }
  .item { min-height: 44px; }
}

/* ---------- Celular ---------- */
@media (max-width: 760px) {
  .titlebar { grid-template-columns: 1fr auto auto; gap: 10px; padding-left: 10px; }
  #tb-status-text { display: none; }
  .tb-host, .tb-sep { display: none; }
  #btn-panel { display: none; }
  .side { display: none !important; }
  #dashboard-view { padding: 16px 14px 10px; }
  .dash { grid-template-columns: 1fr; gap: 24px; }
  .pet-canvas-large { width: 72px; height: 72px; }
  .ff-block { gap: 16px; }
  .term-host { padding: 8px 4px 4px 8px; }
  .mobile-keys { display: flex; gap: 4px; padding: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .mobile-keys button {
    flex: 1; min-height: 44px;
    background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--r-sm);
    color: var(--fg-1); font-size: var(--fs-sm); cursor: pointer;
    transition: background-color var(--t-fast) ease, transform var(--t-fast) var(--ease-out);
  }
  .mobile-keys button:active { background: var(--surface-press); transform: scale(0.97); }
  .prompt-input { font-size: 16px; } /* iOS no hace zoom al enfocar */
  #palette-input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .tab::after { transition: none; }
}

/* ---------- Logos originales (Claude, Antigravity) + mascota ---------- */
/* Íconos de los CLIs: los píxeles que dibuja cada uno en su terminal (Clawd 11×8, A de agy 12×10), a 2 px por píxel (3 px en grande) para que no se deformen. */
.logo { flex: none; overflow: visible; shape-rendering: crispEdges; }
.logo.claude { width: 22px; height: 16px; }
.logo.agy { width: 24px; height: 20px; }
.mark { position: relative; display: inline-flex; flex: none; --ring: oklch(0.19 0.02 268); }
.mark.lg .logo.claude { width: 33px; height: 24px; }
.mark.lg .logo.agy { width: 36px; height: 30px; }
.badge {
  position: absolute; right: -4px; bottom: -3px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--fg-3); box-shadow: 0 0 0 2px var(--ring);
}
.badge.on { background: var(--ok); }
.badge.idle { background: var(--warn); }
.badge.err { background: var(--err); }
.badge.off { background: var(--fg-3); }
.tab[aria-selected="true"] .mark { --ring: oklch(0.24 0.02 268); }

.pet-mini { width: 22px; height: 22px; display: inline-flex; flex: none; }
.pet-mini svg { width: 100%; height: 100%; }
.tb-logo { display: inline-flex; align-items: center; }

/* Mascota en arte ANSI: una mini-terminal (xterm) de solo lectura. Los eventos pasan al fondo (arrastre de ventana). */
.logo-term { flex: none; pointer-events: none; filter: drop-shadow(0 6px 14px oklch(0 0 0 / 0.35)); }
.logo-term .xterm-viewport { overflow: hidden !important; background: transparent !important; }
.logo-term .xterm-helper-textarea { display: none; }

/* ---------- Mover / cerrar: arrastre de pestañas y menú contextual ---------- */
.tab[draggable="true"] { -webkit-user-drag: element; }
.tab.drop-before::before, .tab.drop-after::before {
  content: ''; position: absolute; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: var(--accent);
}
.tab.drop-before::before { left: -2px; }
.tab.drop-after::before { right: -2px; }

.ctxmenu {
  position: fixed; z-index: 45; min-width: 240px; padding: 6px;
  display: flex; flex-direction: column;
  background: oklch(0.19 0.02 268 / 0.97); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  box-shadow: 0 16px 40px oklch(0 0 0 / 0.55), inset 0 1px 0 oklch(1 0 0 / 0.08);
  transform-origin: 0 0;
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
@starting-style { .ctxmenu { opacity: 0; transform: scale(0.97); } }
.ctx-item {
  min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 10px; background: transparent; border: none; border-radius: var(--r-sm);
  color: var(--fg-1); font-size: var(--fs-sm); text-align: left; cursor: pointer;
  transition: background-color var(--t-fast) ease;
}
.ctx-item:disabled { color: var(--fg-3); opacity: 0.55; cursor: default; }
.ctx-item:focus-visible { outline: none; background: var(--surface-press); }
.ctx-item.danger { color: var(--err); }
.ctx-item.armed { background: oklch(0.723 0.159 10 / 0.18); color: var(--err); font-weight: 600; }
.ctx-hint { font-size: var(--fs-xs); color: var(--fg-3); white-space: nowrap; }
.ctx-sep { height: 1px; margin: 4px 6px; background: var(--line); }
@media (hover: hover) and (pointer: fine) { .ctx-item:not(:disabled):hover { background: var(--surface-hover); } }
@media (pointer: coarse) { .ctx-item { min-height: 44px; } }

/* ---------- Aviso breve ("Copiado") ---------- */
.toast {
  position: absolute; right: 14px; bottom: 14px; z-index: 5; pointer-events: none;
  padding: 4px 10px; border-radius: var(--r-sm);
  background: oklch(0.25 0.03 268 / 0.95); border: 1px solid var(--line-strong);
  color: var(--fg-1); font-size: var(--fs-xs);
  opacity: 0; transform: translateY(4px);
  transition: opacity var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out);
}
.toast.show { opacity: 1; transform: none; }
@media (max-width: 760px) { .toast { bottom: 70px; } }
