/* Shell común de la oficina local de ErBolamm.
 * Cargado por cada vista (panel.html + tareas/vista/*.html).
 * No debe contener reglas exclusivas de una vista concreta. */

@import url("estilos/tokens.css");
@import url("estilos/componentes.css");

* {
  box-sizing: border-box;
}
html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--page);
}
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: Abel, system-ui, sans-serif;
  line-height: 1.45;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  min-height: 34px;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--light);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}
button:hover {
  border-color: var(--cyan);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--glow);
  outline-offset: 2px;
}
button.primary {
  color: #fdfdfd;
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: 0 0 14px rgba(94, 206, 245, 0.28);
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}
h1,
h2,
h3 {
  font-family: "Fira Sans Condensed", "Arial Narrow", sans-serif;
}
h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}
.app-shell {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar-toggle {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  min-height: 0;
  padding: 0;
  margin: 0;
  margin-left: auto;
  flex: 0 0 auto;
  border: 1px solid var(--light);
  border-radius: 50%;
  color: var(--navy);
  background: var(--surface);
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}
.sidebar-toggle:hover {
  border-color: var(--cyan);
  box-shadow: var(--shadow-sm);
}
html[data-theme="dark"] .sidebar-toggle {
  color: var(--glow);
}
.sidebar-toggle .chev {
  display: inline-block;
  font-family: "DejaVu Sans", system-ui, sans-serif;
  font-size: 1.05rem;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.18s ease;
}
html[data-sidebar="icons"] .sidebar-toggle .chev {
  transform: rotate(180deg);
}
.office-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 0.5rem;
  overflow-y: auto;
  border-right: 1px solid var(--light);
  background: var(--sidebar);
  transition:
    width 0.18s ease,
    padding 0.18s ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-bottom: 1px solid var(--light);
}
.sidebar-brand > span {
  flex: 1 1 auto;
  min-width: 0;
}
.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}
.sidebar-brand strong,
.sidebar-brand small {
  display: block;
}
.sidebar-brand strong {
  color: var(--navy);
  font-family: "Fira Sans Condensed", "Arial Narrow", sans-serif;
  font-size: 1.08rem;
}
html[data-theme="dark"] .sidebar-brand strong {
  color: var(--glow);
}
.sidebar-brand small {
  color: var(--border);
  font-size: 0.76rem;
}
.side-nav {
  display: grid;
  gap: 0.25rem;
  padding: 0.5rem;
}
.nav-card {
  display: grid;
  /* La columna reservada para el icono mide lo que el icono: 1,75rem, el texto minmax y auto para el indicador */
  grid-template-columns: 1.75rem minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  min-height: 2.6rem;
  padding: 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--ink);
  text-decoration: none;
  position: relative;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}
.nav-card:hover {
  border-color: rgba(94, 206, 245, 0.55);
  background: var(--subtle);
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}
.nav-card[aria-current="page"] {
  border-color: rgba(94, 206, 245, 0.45);
  background: var(--subtle);
}
/* Indicadores de migración en pestañas de navegación (nube ☁️ y móvil 📱) */
.nav-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  line-height: 1;
  opacity: 0.9;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
  transition: transform 0.16s ease, opacity 0.16s ease;
  user-select: none;
  pointer-events: none;
}
.nav-card:hover .nav-status-icon {
  transform: scale(1.18);
  opacity: 1;
}
html[data-sidebar="icons"] .nav-status-icon {
  position: absolute;
  top: 0.15rem;
  right: 0.2rem;
  font-size: 0.72rem;
}
/* Aviso en una pestaña lateral: trabajo en segundo plano o resultado sin ver. */
.nav-card.has-update,
.nav-card.is-working {
  position: relative;
}
.nav-card.has-update {
  border-color: var(--warm);
}
.nav-card .nav-badge {
  position: absolute;
  top: 0.3rem;
  left: 1.55rem;
  box-sizing: border-box;
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid var(--sidebar);
  border-radius: 50%;
  background: var(--warm);
}
.nav-card.has-update .nav-badge {
  animation: nav-badge-pulse 1.2s ease-in-out 3;
}
/* Trabajo en curso: aro hueco y quieto; el punto lleno queda para "lista". */
.nav-card.is-working .nav-badge {
  border-color: var(--blue);
  background: var(--sidebar);
}
@keyframes nav-badge-pulse {
  50% {
    transform: scale(1.5);
  }
}
@media (prefers-reduced-motion: reduce) {
  .nav-card.has-update .nav-badge {
    animation: none;
  }
}
.nav-icon,
.section-icon {
  display: inline-grid;
  place-items: center;
  /* Tamaño de los iconos de Chrome: glifo de 16 px en una caja de 28 px, sin
     círculo ni degradado. El adorno era lo que los hacía parecer grandes.
     El área que se toca es la fila entera de la tarjeta, no este cuadro. */
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-sm);
  color: var(--blue);
  background: none;
  font-family: "DejaVu Sans", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
}
html[data-theme="dark"] .nav-icon,
html[data-theme="dark"] .section-icon {
  color: var(--cyan);
}
.nav-card[aria-current="page"] .nav-icon,
.nav-card:hover .nav-icon {
  background: var(--subtle);
}
.nav-copy strong,
.nav-copy small {
  display: block;
  line-height: 1.15;
}
.nav-copy strong {
  font-family: "DejaVu Sans", system-ui, sans-serif;
  font-size: 0.82rem;
}
.nav-copy small {
  margin-top: 0.08rem;
  color: var(--border);
  font-size: 0.7rem;
}
.sidebar-note {
  margin-top: auto;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  color: var(--border);
  background: var(--subtle);
  font-size: 0.75rem;
}
.sidebar-note strong {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--ink);
}
.sidebar-facturas-control,
.sidebar-directo-control,
.sidebar-server-control {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.btn-arrancar-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid #86efac;
  background: #dcfce7;
  color: #15803d;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn-arrancar-panel:hover {
  background: #bbf7d0;
  border-color: #4ade80;
}
.btn-arrancar-panel:active {
  transform: scale(0.98);
}
.btn-arrancar-panel .arrancar-icon {
  font-size: 1rem;
  line-height: 1;
}
.btn-action-start,
.er-btn.btn-action-start,
.pill-btn.btn-action-start {
  background: #2e7d32 !important;
  color: #ffffff !important;
  border: 1px solid #1b5e20 !important;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(46, 125, 50, 0.25);
}
.btn-action-start:hover,
.er-btn.btn-action-start:hover,
.pill-btn.btn-action-start:hover {
  background: #1b5e20 !important;
  border-color: #0e3813 !important;
  color: #ffffff !important;
}
.btn-action-stop,
.er-btn.btn-action-stop,
.pill-btn.btn-action-stop {
  background: #c62828 !important;
  color: #ffffff !important;
  border: 1px solid #8e0000 !important;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(198, 40, 40, 0.25);
}
.btn-action-stop:hover,
.er-btn.btn-action-stop:hover,
.pill-btn.btn-action-stop:hover {
  background: #b71c1c !important;
  border-color: #7f0000 !important;
  color: #ffffff !important;
}
.btn-apagar-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid #fca5a5;
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn-apagar-panel:hover {
  background: #fecaca;
  border-color: #f87171;
}
.btn-apagar-panel:active {
  transform: scale(0.98);
}
.btn-apagar-panel .apagar-icon {
  font-size: 1rem;
  line-height: 1;
}
.sidebar-robot-note {
  margin-top: 0;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  color: var(--border);
  background: var(--subtle);
  font-size: 0.72rem;
  line-height: 1.35;
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}
.sidebar-robot-note .robot-icon {
  font-size: 0.85rem;
  color: var(--blue);
  flex-shrink: 0;
}
html[data-theme="dark"] .btn-arrancar-panel {
  background: #052e16;
  border-color: #14532d;
  color: #86efac;
}
html[data-theme="dark"] .btn-arrancar-panel:hover {
  background: #14532d;
  border-color: #166534;
}
html[data-theme="dark"] .btn-apagar-panel {
  background: #450a0a;
  border-color: #7f1d1d;
  color: #fca5a5;
}
html[data-theme="dark"] .btn-apagar-panel:hover {
  background: #7f1d1d;
  border-color: #991b1b;
}
html[data-sidebar="icons"] .sidebar-facturas-control,
html[data-sidebar="icons"] .sidebar-directo-control,
html[data-sidebar="icons"] .sidebar-server-control {
  align-items: center;
}
html[data-sidebar="icons"] .btn-arrancar-panel,
html[data-sidebar="icons"] .btn-apagar-panel {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: var(--radius-sm);
}
html[data-sidebar="icons"] .btn-arrancar-panel span:not(.arrancar-icon),
html[data-sidebar="icons"] .btn-apagar-panel span:not(.apagar-icon),
html[data-sidebar="icons"] .sidebar-robot-note {
  display: none;
}
html[data-sidebar="icons"] .app-shell {
  grid-template-columns: 4.5rem minmax(0, 1fr);
}
html[data-sidebar="icons"] .office-sidebar {
  padding: 0.5rem;
}
html[data-sidebar="icons"] .sidebar-brand > span,
html[data-sidebar="icons"] .nav-copy,
html[data-sidebar="icons"] .sidebar-note {
  display: none;
}
html[data-sidebar="icons"] .nav-card {
  grid-template-columns: auto;
  justify-content: center;
  padding: 0.5rem;
}
html[data-sidebar="icons"] .sidebar-brand {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.25rem;
}
html[data-sidebar="icons"] .sidebar-toggle {
  margin-left: 0;
  align-self: center;
}
.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: none;
  background: rgba(48, 48, 48, 0.45);
  backdrop-filter: blur(2px);
}
.sidebar-scrim[data-active="true"] {
  display: block;
}
.office-content {
  min-width: 0;
  padding: 0.5rem;
}
.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid rgba(94, 206, 245, 0.4);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}
.brand {
  display: flex;
  min-width: 10rem;
  align-items: center;
  gap: 0.4rem;
  margin-right: auto;
}
.topbar .brand-mark {
  display: none;
}
h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
}
html[data-theme="dark"] h1 {
  color: var(--glow);
}
.private-chip,
.connection {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--light);
  border-radius: 999px;
  font-size: 0.74rem;
}
.private-chip {
  color: #fdfdfd;
  border-color: var(--navy);
  background: var(--navy);
}
.connection::before {
  content: "";
  width: 0.58rem;
  height: 0.58rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--border);
}
.connection[data-kind="online"]::before {
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(94, 206, 245, 0.18);
}
.connection[data-kind="error"]::before {
  background: var(--warm);
}
.system-telemetry-chips {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.system-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 95, 169, 0.25);
  background: rgba(0, 95, 169, 0.08);
  color: var(--navy);
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s ease;
}
button.system-chip {
  outline: none;
}
button.system-chip:focus-visible {
  outline: 2px solid var(--accent, #5ecef5);
  outline-offset: 1px;
}
html[data-theme="dark"] .system-chip {
  color: var(--glow);
  background: rgba(94, 206, 245, 0.12);
  border-color: rgba(94, 206, 245, 0.35);
}
.system-chip:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.system-chip.warn {
  border-color: #f59e0b;
  color: #b45309;
  background: rgba(245, 158, 11, 0.14);
}
html[data-theme="dark"] .system-chip.warn {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.2);
}
.system-chip.danger {
  border-color: #ef4444;
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.14);
}
html[data-theme="dark"] .system-chip.danger {
  color: #f87171;
  background: rgba(239, 68, 68, 0.2);
}
#theme-toggle {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
}
#refresh-btn,
.btn-refresh {
  width: 20px;
  height: 20px;
  min-height: 20px;
  min-width: 20px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  line-height: 1;
  border: 1px solid var(--light);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s ease, background 0.15s ease, border-color 0.15s ease;
}
#refresh-btn:hover,
.btn-refresh:hover {
  background: rgba(94, 206, 245, 0.15);
  border-color: var(--cyan);
  color: var(--navy);
}
html[data-theme="dark"] #refresh-btn:hover,
html[data-theme="dark"] .btn-refresh:hover {
  background: rgba(94, 206, 245, 0.2);
  border-color: var(--glow);
  color: var(--glow);
}
#refresh-btn:focus-visible,
.btn-refresh:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
#refresh-btn:active,
.btn-refresh:active {
  transform: rotate(180deg);
}
.updated {
  margin: 0.3rem 0.2rem 0.5rem;
  color: var(--border);
  font-size: 0.78rem;
  text-align: right;
}
.needs {
  margin-bottom: 1rem;
  padding: 0.5rem;
  border: 1px solid rgba(232, 149, 94, 0.5);
  border-left: 0.35rem solid var(--warm);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.needs h2 {
  margin: 0 0 0.3rem;
  font-size: 1.08rem;
}
.needs ul {
  margin: 0;
  padding-left: 1.2rem;
}
.needs[hidden] {
  display: none;
}
.needs-link {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.needs-link:hover,
.needs-link:focus-visible {
  text-decoration: underline;
}
#lanes-clear-filter {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}
#lanes-clear-filter:hover,
#lanes-clear-filter:focus-visible {
  text-decoration: underline;
}
#lanes-clear-filter[hidden] {
  display: none;
}
[hidden],
.panel[hidden] {
  display: none !important;
}
.panel {
  overflow: hidden;
  border: 1px solid rgba(166, 166, 166, 0.52);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.panel-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem;
  border-bottom: 1px solid rgba(166, 166, 166, 0.4);
}
.panel-head::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: linear-gradient(var(--blue), var(--cyan));
}
.panel-head h2 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 1.18rem;
}
.plan-icon {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: var(--blue);
  stroke-width: 2;
}
html[data-theme="dark"] .plan-icon {
  stroke: var(--cyan);
}
.panel-head p {
  margin: 0.18rem 0 0;
  color: var(--border);
  font-size: 0.8rem;
}
.panel-head-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 auto;
}
.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}
.panel-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  cursor: grab;
  color: var(--border-soft, #8f8c8a);
  user-select: none;
  font-size: 1.1rem;
  border-radius: 4px;
  opacity: 0.7;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.panel-drag-handle:hover,
.panel-drag-handle:focus-visible {
  opacity: 1;
  background: rgba(0, 95, 169, 0.1);
  color: var(--blue, #005fa9);
}
.panel-drag-handle:active {
  cursor: grabbing;
}
.panel-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid rgba(166, 166, 166, 0.5);
  background: var(--surface-alt, #f4f6f8);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.panel-action-btn:hover {
  background: var(--surface);
  border-color: var(--blue, #005fa9);
  color: var(--blue, #005fa9);
}
html[data-theme="dark"] .panel-action-btn {
  background: #24292e;
  border-color: #444c56;
  color: #cdd9e5;
}
html[data-theme="dark"] .panel-action-btn:hover {
  border-color: var(--cyan, #5ecef5);
  color: var(--cyan, #5ecef5);
}
.view-mode-group {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: var(--surface-alt, #f4f6f8);
  padding: 0.15rem 0.25rem;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid rgba(166, 166, 166, 0.4);
}
.view-mode-group .view-btn {
  padding: 0.25rem 0.55rem;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--text-muted, #555);
}
.view-mode-group .view-btn:hover {
  background: var(--surface, #fff);
  color: var(--blue, #005fa9);
}
.view-mode-group .view-btn.active {
  background: var(--surface, #fff);
  border-color: rgba(0, 95, 169, 0.4);
  color: var(--blue, #005fa9);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
html[data-theme="dark"] .view-mode-group {
  background: #1c2128;
  border-color: #373e47;
}
html[data-theme="dark"] .view-mode-group .view-btn {
  color: #adbac7;
}
html[data-theme="dark"] .view-mode-group .view-btn:hover {
  background: #2d333b;
  color: var(--cyan, #5ecef5);
}
html[data-theme="dark"] .view-mode-group .view-btn.active {
  background: #2d333b;
  border-color: rgba(94, 206, 245, 0.5);
  color: var(--cyan, #5ecef5);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.workspace-panels {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transition: all 0.2s ease;
}
.workspace-panels[data-layout="side-by-side"] {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: stretch;
}
@media (max-width: 1024px) {
  .workspace-panels[data-layout="side-by-side"] {
    grid-template-columns: 1fr;
  }
}
.workspace-panels > .panel {
  min-height: 0;
}
.workspace-panels > .panel[draggable="true"] {
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.workspace-panels > .panel.is-dragging {
  opacity: 0.45;
  transform: scale(0.99);
}
.workspace-panels > .panel.drag-over {
  outline: 2px dashed var(--blue, #005fa9);
  outline-offset: 4px;
}
.workspace-panels > .board {
  margin-top: 0;
}
.workspace-panels > .map-panel,
#map-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.workspace-panels > .map-panel .panel-head,
#map-panel .panel-head {
  flex: 0 0 auto;
}
.workspace-panels > .map-panel #office-3d,
#map-panel #office-3d {
  flex: 1 1 auto;
  min-height: 0;
}
.workspace-panels > .board,
#tablero {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.workspace-panels > .board,
.workspace-panels[data-layout="side-by-side"] > #tablero {
  height: 100%;
}
#tablero .panel-head,
.board .panel-head {
  flex: 0 0 auto;
}
#tablero .lanes,
.board .lanes {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
@media (min-width: 1025px) {
  .workspace-panels[data-layout="side-by-side"] > .board,
  .workspace-panels[data-layout="side-by-side"] > #tablero {
    height: 0;
    min-height: 100%;
    max-height: 100%;
  }
}
.plano-standalone-body {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
.plano-topbar {
  flex: 0 0 auto;
}
.plano-standalone-content {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
}
.plano-standalone-content .map-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.plano-standalone-content #office-3d {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}
.plano-standalone-content #office-3d > .real-office {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.plano-standalone-content #office-3d .office-volume {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.plano-standalone-content #office-3d .volume-viewport {
  flex: 1 1 auto;
  min-height: 0;
}
.map-meta {
  font-family: ui-monospace, "JetBrains Mono", "DejaVu Sans Mono", monospace;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.workspace {
  display: block;
}
.floor-wrap {
  padding: 0.5rem;
}
.floor {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--light);
  border-radius: var(--radius-md);
  background: var(--paper);
}
.floor .wall {
  fill: none;
  stroke: #00467b;
  stroke-width: 2;
}
.floor .zone {
  fill: #fdfdfd;
  stroke: #a6a6a6;
  stroke-width: 1;
}
.floor .desk {
  fill: #d9d9d9;
  stroke: #00467b;
  stroke-width: 2;
}
.floor .screen {
  fill: #bebbb9;
  stroke: #00467b;
  stroke-width: 2;
}
.floor .screen.on {
  fill: #5ecef5;
}
.floor text {
  fill: #303030;
  font-family: "DejaVu Sans", sans-serif;
}
.floor .zone-title {
  fill: #00467b;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
}
.floor .role-label {
  font-size: 12px;
  font-weight: 700;
}
/* ── Plano en ciclo, aprobado el 2026-09-11 ────────────────────────────────
 * Muros, puertas y pasillo en anillo en vez de zonas sueltas. Colores
 * tomados de las variables ya definidas arriba: se adaptan solos a modo
 * oscuro, sin reglas nuevas por tema. */
.floor .grid-linea {
  stroke: var(--border);
  stroke-width: 0.6;
  opacity: 0.4;
}
.floor .suelo-pasillo {
  fill: var(--subtle);
}
.floor .suelo-sala {
  fill: var(--surface);
  filter: drop-shadow(0 4px 14px rgba(0, 70, 123, 0.14));
}
html[data-theme="dark"] .floor .suelo-sala {
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.35));
}
.floor .muro {
  stroke: var(--ink);
  stroke-width: 7;
  fill: none;
  stroke-linecap: square;
}
.floor .tabique {
  stroke: var(--ink);
  stroke-width: 4;
  fill: none;
  stroke-linecap: square;
}
.floor .ventana {
  stroke: var(--blue);
  stroke-width: 5;
  stroke-linecap: square;
}
.floor .ventana-cristal {
  stroke: var(--glow);
  stroke-width: 2;
}
.floor .mueble {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1.5;
}
.floor .mueble-lleno {
  fill: var(--light);
  stroke: var(--border);
  stroke-width: 1.5;
}
.floor .silla {
  fill: var(--surface);
  stroke: var(--muted);
  stroke-width: 1.5;
}
.floor .rotulo {
  fill: var(--navy);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
html[data-theme="dark"] .floor .rotulo {
  fill: var(--glow);
}
.floor .rotulo-peq {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.floor .carpeta {
  fill: var(--blue);
  font-family: ui-monospace, "DejaVu Sans Mono", monospace;
  font-size: 10px;
  font-weight: 600;
}
html[data-theme="dark"] .floor .carpeta {
  fill: var(--cyan);
}
/* Muñequitos del plano. Estados visuales derivados en el navegador:
 * is-working (tarea en haciendo), is-queued (espera con tareas en por-hacer),
 * is-asleep (espera sin nada), is-orchestrator (coordinación).
 * Todas las animaciones son finitas: se reproducen al cambiar de estado. */
.map-agent {
  transition: transform 3.3s cubic-bezier(0.45, 0.05, 0.35, 1);
}
.map-agent.no-transition {
  transition: none;
}
.map-agent .sprite {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
.map-agent.is-idle {
  opacity: 0.55;
  filter: saturate(0.55);
}
.map-agent.is-queued {
  opacity: 0.92;
  filter: none;
}
.map-agent .ring {
  fill: #fdfdfd;
  stroke: var(--agent-color);
  stroke-width: 4;
}
.map-agent .body {
  fill: var(--agent-color);
}
.map-agent .face {
  fill: #d9d9d9;
  stroke: #303030;
  stroke-width: 1.5;
}
.map-agent .initials {
  fill: #303030;
  text-anchor: middle;
  font-size: 9px;
  font-weight: 700;
}
.map-agent .chevron {
  display: none;
  fill: #005fa9;
}
.map-agent.is-orchestrator .chevron {
  display: block;
}
.map-agent .queue-badge {
  display: none;
}
.map-agent.is-queued .queue-badge {
  display: block;
}
.map-agent .queue-badge circle {
  fill: #e8955e;
  stroke: #fdfdfd;
  stroke-width: 2;
}
.map-agent .queue-badge text {
  fill: #fdfdfd;
  font-size: 10px;
  font-weight: 700;
  text-anchor: middle;
}
.map-agent .zzz {
  display: none;
}
.map-agent.is-asleep .zzz {
  display: block;
}
.map-agent .zzz text {
  fill: #00467b;
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  animation: agent-zzz 2.4s ease-out 3 forwards;
}
.map-agent .zzz text:nth-child(2) {
  font-size: 9px;
  animation-delay: 0.5s;
}
.map-agent .zzz text:nth-child(3) {
  font-size: 7px;
  animation-delay: 1s;
}
/* Caminata: bobeo lento 3x más pausado que el original. */
.map-agent.is-walking .sprite {
  animation: agent-walk 0.84s ease-in-out 3;
}
/* Trabajo: animación de escritura en bucle continuo, 3x más lento. */
.map-agent.is-working .sprite {
  animation: agent-type 1.35s ease-in-out 3;
}
/* Orquestador: pulso del anillo, 3x más lento. */
.map-agent.is-orchestrator .ring {
  animation: agent-pulse 3.6s ease-in-out 3;
}
/* Espera con cola: leve oscilación para indicar actividad. */
.map-agent.is-queued .sprite {
  animation: agent-idle 0.9s ease-in-out 3;
}
/* ZZZ: flotación lenta, 3x más lento. */
.map-agent .zzz text {
  animation: agent-zzz 7.2s ease-out 3;
}
.floor .screen.on {
  animation: screen-boot 0.9s steps(3, end) 1;
}
@keyframes agent-walk {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}
@keyframes agent-type {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}
@keyframes agent-pulse {
  0%,
  100% {
    stroke-width: 4;
  }
  50% {
    stroke-width: 7;
  }
}
@keyframes agent-zzz {
  0% {
    opacity: 0;
    transform: translate(0, 0);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0.55;
    transform: translate(6px, -14px);
  }
}
@keyframes agent-idle {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}
@keyframes screen-boot {
  0% {
    fill: #bebbb9;
  }
  50% {
    fill: #8fd5fa;
  }
  100% {
    fill: #5ecef5;
  }
}
.role-co {
  --agent-color: #10a37f;
}
.role-cl {
  --agent-color: #d97757;
}
.role-pi {
  --agent-color: #ff4e83;
}
.role-ja {
  --agent-color: #005fa9;
}
.role-ge {
  --agent-color: #4285f4;
}
.role-gr {
  --agent-color: #4b5563;
}
.role-op {
  --agent-color: #9aa4b2;
}
.role-om {
  --agent-color: #64748b;
}
.role-ex {
  --agent-color: #a6a6a6;
}
.floor-note {
  padding: 0.5rem;
  color: var(--border);
  font-size: 0.76rem;
}
.agent-list,
.limit-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0.5rem;
  list-style: none;
}
.agent-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.agent-row,
.limit-row {
  padding: 0.5rem;
  border: 1px solid rgba(166, 166, 166, 0.45);
  border-radius: var(--radius-md);
  background: var(--subtle);
}
.agent-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.35rem 0.6rem;
  align-items: center;
}
.agent-zone {
  grid-column: 2;
}
.avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 3px solid var(--agent-color);
  border-radius: 50%;
  color: var(--ink);
  background: var(--surface);
  font-family: "DejaVu Sans", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.agent-row.is-orchestrator .avatar::before {
  content: "⌄";
  position: absolute;
  margin-top: -52px;
  color: var(--blue);
  font-size: 1.2rem;
}
.agent-copy strong,
.agent-copy span {
  display: block;
}
.agent-copy span,
.agent-zone {
  color: var(--border);
  font-size: 0.76rem;
}
.limit-heading {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.limit-meta {
  margin: 0.2rem 0;
  color: var(--border);
  font-size: 0.74rem;
}
.limit-track {
  height: 0.55rem;
  overflow: hidden;
  border: 1px solid var(--light);
  border-radius: 999px;
  background: var(--surface);
}
.limit-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}
.limit-row.near .limit-fill {
  background: var(--warm);
}
.limit-row.stale {
  opacity: 0.68;
}
/* ── Costes y suscripciones: fichas legibles sin tabla horizontal ───────── */
.costs-section,
.ai-limits {
  padding: 0.5rem;
}
.ai-limits {
  border-top: 1px solid var(--light);
}
.costs-section h3,
.ai-limits h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}
.costs-note,
.costs-status {
  margin: 0 0 0.75rem;
  color: var(--border);
  font-size: 0.82rem;
}
.cost-state-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
  padding: 0;
  list-style: none;
}
.charge-alert {
  margin: 0 0 0.85rem;
  padding: 0.5rem;
  border: 2px solid var(--warm);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--warm) 14%, var(--surface));
}
.charge-alert[hidden] {
  display: none;
}
.charge-alert strong {
  display: block;
  margin-bottom: 0.35rem;
}
.charge-alert ul {
  margin: 0;
  padding-left: 1.2rem;
}
.cost-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cost-row {
  position: relative;
  min-width: 0;
  padding: 0.5rem;
  border: 1px solid rgba(166, 166, 166, 0.55);
  border-radius: var(--radius-md);
  background: var(--subtle);
}
.cost-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.cost-heading strong {
  overflow-wrap: anywhere;
}
.cost-state,
.source-kind {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 1.55rem;
  padding: 0.5rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
}
.cost-state.state-activo {
  color: #176b3a;
  background: #e7f6ec;
}
.cost-state.state-cancelado {
  color: #8a2f28;
  background: #fbeceb;
}
.cost-state.state-desconocido {
  color: #694c00;
  background: #fff4cf;
}
html[data-theme="dark"] .cost-state.state-activo {
  color: #a9e8bd;
  background: #183b26;
}
html[data-theme="dark"] .cost-state.state-cancelado {
  color: #ffc0ba;
  background: #4b2421;
}
html[data-theme="dark"] .cost-state.state-desconocido {
  color: #ffe39a;
  background: #493b17;
}
.cost-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.7rem;
}
.cost-facts div {
  min-width: 0;
}
.cost-facts dt {
  color: var(--border);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}
.cost-facts dd {
  margin: 0.08rem 0 0;
  overflow-wrap: anywhere;
  font-size: 0.8rem;
}
.source-kind.manual {
  color: var(--border);
  background: var(--surface);
}
.source-kind.verified {
  color: #005188;
  background: #e6f5fc;
}
html[data-theme="dark"] .source-kind.verified {
  color: var(--glow);
  background: #183545;
}
/* ── Pestaña Agentes: anotar límites a mano y pegar+interpretar ──────────── */
.limit-editor,
.limit-paste {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--light);
}
.limit-editor h3,
.limit-paste h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}
.limit-editor-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}
.limit-editor label,
.limit-paste label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
  color: var(--ink);
}
.limit-editor-note {
  display: block;
  margin-bottom: 0.6rem;
}
.limit-editor select,
.limit-editor input,
.limit-paste textarea {
  font: inherit;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}
.limit-paste-note {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.limit-paste-note code {
  font-family: ui-monospace, "DejaVu Sans Mono", monospace;
  background: var(--page);
  padding: 0.5rem;
  border-radius: 0.25rem;
}
.limit-paste textarea {
  width: 100%;
  resize: vertical;
  font-family: ui-monospace, "DejaVu Sans Mono", monospace;
  font-size: 0.85rem;
}
.limit-editor-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.limit-editor-actions button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fdfdfd;
}
.limit-editor-actions button:hover {
  background: var(--navy);
}
.limit-editor-actions p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.limit-editor-actions p[data-error="si"] {
  color: var(--warm);
}
.board,
.creator,
.routines,
.reports {
  margin-top: 1rem;
  scroll-margin-top: 6rem;
}
.creator-help {
  grid-column: 1 / -1;
  margin: -0.4rem 0 0;
  color: var(--border);
  font-size: 0.8rem;
}
.creator-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  padding: 0.5rem;
}
.creator-form label {
  display: grid;
  gap: 0.28rem;
  font-family: "DejaVu Sans", system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
}
.creator-form label.wide,
.creator-actions {
  grid-column: 1 / -1;
}
.creator-form input,
.creator-form select,
.creator-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem;
  border: 1px solid var(--light);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface);
}
.creator-form textarea {
  min-height: 7rem;
  resize: vertical;
}
.creator-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
}
.creator-result {
  margin: 0;
  overflow-wrap: anywhere;
}
.creator-result a {
  color: var(--blue);
  font-weight: 700;
}
html[data-theme="dark"] .creator-result a {
  color: var(--glow);
}
.routine-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  padding: 0.5rem;
}
.routine-card {
  display: grid;
  min-width: 0;
  align-content: space-between;
  gap: 0.7rem;
  padding: 0.5rem;
  border: 1px solid rgba(166, 166, 166, 0.45);
  border-radius: var(--radius-md);
  background: var(--subtle);
}
.routine-card h3,
.routine-card p {
  margin: 0;
}
.routine-card p {
  color: var(--border);
  overflow-wrap: anywhere;
}
.routine-result {
  margin: 0;
  padding: 0.5rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.preview-file,
.preview-body {
  display: block;
  max-height: 17rem;
  overflow: auto;
  padding: 0.5rem;
  border: 1px solid var(--light);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--subtle);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.preview-file {
  max-height: none;
  margin-bottom: 0.7rem;
}
.lanes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 0.8rem;
  padding: 0.5rem;
  align-items: start;
}
.lane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(166, 166, 166, 0.5);
  border-radius: var(--radius-md);
  background: var(--subtle);
  min-height: auto;
  align-self: start;
}
.lane h3 {
  min-height: 34px;
  margin: 0;
  padding: 0.35rem 0.5rem;
  display: flex;
  align-items: center;
  font-family: "Fira Sans Condensed", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  flex: 0 0 auto;
}
.lane:nth-child(2) {
  border-color: color-mix(in srgb, #d97706 62%, var(--border));
  background: color-mix(in srgb, #f59e0b 12%, var(--subtle));
}
.lane:nth-child(2) h3 {
  color: #8a4b00;
}
.lane ul {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0.5rem;
  list-style: none;
  max-height: calc(10 * 3.85rem + 4.5rem);
  overflow-y: auto;
  scrollbar-width: thin;
}
.lane ul::-webkit-scrollbar {
  width: 6px;
}
.lane ul::-webkit-scrollbar-thumb {
  background: rgba(166, 166, 166, 0.4);
  border-radius: 3px;
}
.lane.drag-over {
  border-color: var(--cyan);
  background: color-mix(in srgb, var(--cyan) 16%, var(--subtle));
  outline: 2px dashed var(--cyan);
  outline-offset: -2px;
}
.task {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title edit"
    "details details";
  align-items: center;
  gap: 0.25rem 0.4rem;
  padding: 0.4rem 0.55rem;
  border-left: 0.35rem solid var(--task-accent, var(--cyan));
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.task:hover {
  background: color-mix(in srgb, var(--subtle) 40%, var(--surface));
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}
.task[draggable="true"] {
  cursor: grab;
}
.task.is-dragging {
  opacity: 0.35;
  cursor: grabbing;
  transform: scale(0.98);
}
.task.task-card--disabled-host,
.task-card--disabled-host {
  opacity: 0.42;
  cursor: not-allowed !important;
}
.task-card--disabled-host * {
  cursor: not-allowed !important;
}
.task-host-badge {
  grid-column: 1 / -1;
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  width: fit-content;
  background: var(--subtle);
  color: var(--ink);
  border: 1px solid var(--border);
  margin-top: 2px;
}
.task strong {
  grid-area: title;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.25;
  min-width: 0;
  overflow-wrap: anywhere;
}
.task small {
  grid-area: details;
  display: none;
  font-size: 0.76rem;
  color: var(--muted, #666);
  border-top: 1px solid rgba(166, 166, 166, 0.2);
  padding-top: 0.3rem;
  margin-top: 0.2rem;
  overflow-wrap: anywhere;
  min-width: 0;
}
.task.is-expanded {
  background: color-mix(in srgb, var(--cyan) 6%, var(--surface));
  align-items: start;
}
.task.is-expanded strong {
  display: block;
  -webkit-line-clamp: unset;
}
.task.is-expanded small {
  display: block;
}
.task-ficha-open {
  grid-area: edit;
  justify-self: end;
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  min-height: 0;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  background: var(--subtle, rgba(0, 0, 0, 0.05));
  border: 1px solid rgba(166, 166, 166, 0.3);
  color: inherit;
  box-shadow: none;
  touch-action: manipulation;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.task-ficha-open:hover {
  background: var(--cyan);
  color: #fff;
  border-color: var(--cyan);
}
.by-co {
  --task-accent: #10a37f;
}
.by-cl {
  --task-accent: #d97757;
}
.by-pi {
  --task-accent: #ff4e83;
}
.by-ja {
  --task-accent: #005fa9;
}
.by-ge {
  --task-accent: #4285f4;
}
.by-gr {
  --task-accent: #4b5563;
}
.by-op {
  --task-accent: #9aa4b2;
}
.by-om {
  --task-accent: #64748b;
}
.by-ex {
  --task-accent: #a6a6a6;
}
html[data-theme="dark"] .by-gr,
html[data-theme="dark"] .role-gr {
  --task-accent: #9aa4b2;
  --agent-color: #9aa4b2;
}
html[data-theme="dark"] .by-op,
html[data-theme="dark"] .role-op {
  --task-accent: #c3cbd6;
  --agent-color: #c3cbd6;
}
html[data-theme="dark"] .by-om,
html[data-theme="dark"] .role-om {
  --task-accent: #94a3b8;
  --agent-color: #94a3b8;
}
.reports {
  margin-bottom: 1rem;
}
.inbox,
.bitacora,
.facturas {
  margin-top: 1rem;
  margin-bottom: 1rem;
}
.inbox-form {
  display: grid;
  gap: 0.55rem;
  padding: 0.5rem;
}
.inbox-form label {
  font-size: 0.86rem;
  font-weight: 700;
}
.inbox-form textarea {
  width: 100%;
  min-height: 7rem;
  padding: 0.5rem;
  border: 1px solid var(--light);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface);
  resize: vertical;
}
.inbox-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.inbox-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0.5rem;
  list-style: none;
}
.inbox-message {
  padding: 0.5rem;
  border-left: 0.3rem solid var(--blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--subtle);
}
.inbox-message[data-author="pi"] {
  border-left-color: #ff4e83;
}
.inbox-message strong,
.inbox-message p,
.inbox-message small {
  display: block;
  overflow-wrap: anywhere;
}
.inbox-message p {
  margin: 0.25rem 0 0;
  white-space: pre-wrap;
}
.inbox-message small {
  margin-top: 0.2rem;
  color: var(--border);
}
/* Cada nota se puede convertir en tarea: un botón, sin recibos ni tics. */
.inbox-edit {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.inbox-edit:hover { background: var(--subtle); }
.bitacora-frame,
.facturas-frame,
.directo-frame,
.twitch-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 14rem);
  min-height: 32rem;
  border: 0;
  background: var(--paper);
}
.directo-offline-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: calc(100vh - 14rem);
  min-height: 32rem;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 1.15rem;
  text-align: center;
  padding: 2rem;
  box-sizing: border-box;
}
.directo-offline-placeholder p {
  margin: 0;
}
.report-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.5rem;
}
.report-status {
  margin: 0;
  color: var(--border);
  font-size: 0.82rem;
}
.report-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0.5rem;
  list-style: none;
}
.report {
  padding: 0.5rem;
  border-left: 0.3rem solid var(--blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--subtle);
}
.report[data-status="incompleto"] {
  border-left-color: var(--warm);
}
.report strong,
.report span,
.report small {
  display: block;
  overflow-wrap: anywhere;
}
.report span {
  display: -webkit-box;
  margin-top: 0.25rem;
  overflow: hidden;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}
.report small {
  margin-top: 0.2rem;
  color: var(--border);
}
.report button {
  margin-top: 0.55rem;
}
.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}
.report-actions button {
  margin-top: 0;
}
.report-reply {
  margin-top: 0.6rem;
  padding: 0.5rem;
  border: 1px dashed rgba(94, 206, 245, 0.55);
  border-radius: var(--radius-sm);
  background: var(--subtle);
}
.report-reply label {
  display: grid;
  gap: 0.35rem;
  font-family: "DejaVu Sans", system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
}
.report-reply textarea {
  width: 100%;
  min-height: 4.4rem;
  resize: vertical;
  padding: 0.5rem;
  border: 1px solid var(--light);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface);
}
.report-reply-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.55rem;
}
.report-reply-status {
  color: var(--border);
  font-size: 0.78rem;
}
.report-reply-list {
  margin: 0.55rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}
.report-reply-empty {
  color: var(--border);
  font-size: 0.78rem;
  font-style: italic;
}
.report-reply-entry {
  padding: 0.5rem;
  border: 1px solid rgba(166, 166, 166, 0.45);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.report-reply-entry span,
.report-reply-entry small {
  display: block;
  overflow-wrap: anywhere;
}
.report-reply-entry span {
  white-space: pre-wrap;
}
.report-reply-entry small {
  margin-top: 0.2rem;
  color: var(--border);
}
.public-note {
  margin: 1rem 0 0;
  color: var(--border);
  font-size: 0.78rem;
  text-align: center;
}
dialog {
  width: min(34rem, calc(100% - 2rem));
  padding: 0;
  border: 1px solid var(--cyan);
  border-radius: var(--radius-lg);
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
dialog::backdrop {
  background: rgba(48, 48, 48, 0.7);
  backdrop-filter: blur(4px);
}
.dialog-body {
  padding: 0.5rem;
}
.dialog-body h2 {
  margin-top: 0;
}
.options {
  display: grid;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}
.option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  align-items: center;
  min-height: 48px;
  padding: 0.5rem;
  border: 1px solid var(--light);
  border-radius: var(--radius-sm);
}
.option small {
  display: block;
  color: var(--border);
}
.confirmation {
  min-height: 2.6rem;
  color: var(--navy);
  font-weight: 700;
}
html[data-theme="dark"] .confirmation {
  color: var(--glow);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 14.5rem minmax(0, 1fr);
  }
  html[data-sidebar="icons"] .app-shell {
    grid-template-columns: 4rem minmax(0, 1fr);
  }
}
@media (max-width: 1024px) and (min-width: 701px) {
  html[data-sidebar="icons"] .app-shell {
    grid-template-columns: 3.75rem minmax(0, 1fr);
  }
}
@media (max-width: 820px) {
  .app-shell {
    display: block;
  }
  /* Sin transform: un ancestro transformado atrapa al botón `position: fixed`
   * y lo sacaba de la pantalla junto con el drawer cerrado. */
  .office-sidebar {
    position: fixed;
    top: 0;
    left: calc(-1 * min(18rem, 86vw));
    z-index: 110;
    width: min(18rem, 86vw);
    height: 100vh;
    height: 100dvh;
    padding: 0.5rem;
    box-shadow: var(--shadow-md);
    visibility: hidden;
    transition:
      left 0.22s ease,
      visibility 0s linear 0.22s;
  }
  .office-sidebar[data-drawer-open="true"] { left: 0; }
  .office-sidebar[data-drawer-open="true"] {
    visibility: visible;
    transition:
      left 0.22s ease,
      visibility 0s;
  }
  html[data-sidebar="icons"] .app-shell {
    grid-template-columns: 1fr;
  }
  html[data-sidebar="icons"] .office-sidebar {
    width: min(18rem, 86vw);
    padding: 0.5rem;
  }
  html[data-sidebar="icons"] .office-sidebar .nav-copy,
  html[data-sidebar="icons"] .office-sidebar .sidebar-brand > span,
  html[data-sidebar="icons"] .office-sidebar .sidebar-note {
    display: initial;
  }
  html[data-sidebar="icons"] .office-sidebar .nav-card {
    grid-template-columns: 2.35rem minmax(0, 1fr);
    justify-content: start;
    padding: 0.5rem;
  }
  html[data-sidebar="icons"] .office-sidebar .sidebar-brand {
    justify-content: flex-start;
  }
  .sidebar-toggle {
    margin-top: 0.65rem;
  }
  .sidebar-brand {
    padding: 0.5rem;
  }
  .side-nav {
    grid-template-columns: 1fr;
    padding: 0.5rem;
  }
  .nav-card {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 0.5rem;
  }
  .nav-icon {
    width: 2rem;
    height: 2rem;
  }
  .sidebar-note {
    display: none;
  }
  .office-content {
    padding-top: 0.75rem;
  }
}
@media (max-width: 700px) {
  .office-content {
    padding: 0.5rem;
  }
  /* Barra superior en dos filas: título + tema / orquestador + conexión. */
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.4rem 0.5rem;
    position: static;
    padding: 0.5rem 0.6rem 0.5rem 3.4rem;
    border-radius: var(--radius-md);
  }
  .brand {
    grid-column: 1;
    grid-row: 1;
    width: auto;
    min-width: 0;
    margin-right: 0;
  }
  .topbar h1 {
    overflow: hidden;
    font-size: 1.3rem;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  #theme-toggle {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: 40px;
    height: 40px;
    min-height: 40px;
  }
  #refresh-btn,
  .btn-refresh {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    margin-right: calc(40px + 0.4rem);
  }
  .connection {
    grid-column: 2;
    min-height: 30px;
    font-size: 0.72rem;
    justify-self: end;
  }
  .updated {
    margin: 0.3rem 0.2rem 0.6rem;
  }
  .private-chip {
    display: none;
  }
  .facturas .panel-head p,
  .directo .panel-head p,
  .bitacora .panel-head p {
    display: none;
  }
  .facturas-frame,
  .directo-frame,
  .bitacora-frame,
  .twitch-frame {
    height: calc(100dvh - 9rem);
    min-height: 26rem;
  }
  .map-panel .floor-wrap {
    display: none;
  }
  .map-panel[open] .floor-wrap {
    display: block;
  }
  .lanes {
    grid-template-columns: repeat(3, minmax(105px, 1fr));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.35rem;
    padding: 0.25rem;
  }
  .lane {
    min-width: 105px;
  }
  .lane h3 {
    font-size: 0.8rem;
    min-height: 28px;
    padding: 0.2rem 0.3rem;
  }
  .lane ul {
    padding: 0.25rem;
    gap: 0.25rem;
  }
  .task {
    padding: 0.3rem 0.35rem;
    gap: 0.15rem 0.25rem;
  }
  .task strong {
    font-size: 0.78rem;
    line-height: 1.2;
  }
  .task-ficha-open {
    width: 1.45rem;
    height: 1.45rem;
    font-size: 0.75rem;
  }
  .task small {
    font-size: 0.7rem;
    padding-top: 0.2rem;
    margin-top: 0.15rem;
  }
  .cost-list,
  .cost-facts {
    grid-template-columns: 1fr;
  }
  .creator-form {
    grid-template-columns: 1fr;
  }
  .routine-list {
    grid-template-columns: 1fr;
  }
  dialog {
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
    border-radius: 0;
  }
  .option {
    min-height: 52px;
  }
  .sidebar-toggle {
    position: fixed;
    top: max(0.45rem, calc(env(safe-area-inset-top, 0px) + 0.35rem));
    left: max(0.65rem, calc(env(safe-area-inset-left, 0px) + 0.45rem));
    z-index: 120;
    width: 2.6rem;
    height: 2.6rem;
    margin: 0;
    font-size: 1.2rem;
    line-height: 1;
    visibility: visible;
    box-shadow: var(--shadow-sm);
    transition: left 0.22s ease;
  }
  .sidebar-toggle .chev,
  .sidebar-toggle svg {
    display: none !important;
  }
  .sidebar-toggle::before { content: "☰"; }
  .office-sidebar[data-drawer-open="true"] .sidebar-toggle::before { content: "✕"; }
  .office-sidebar[data-drawer-open="true"] .sidebar-toggle {
    left: calc(min(18rem, 86vw) - 3.25rem);
  }
}
@media (max-width: 430px) {
  .agent-list {
    grid-template-columns: 1fr;
  }
  .nav-copy small {
    display: none;
  }
}
@media (min-width: 701px) {
  .map-panel > summary {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .map-agent {
    transition: none;
  }
  .map-agent .sprite, .map-agent .zzz, .floor .screen { animation: none; }
  .map-agent .zzz text {
    animation: none;
    opacity: 0.55;
  }
  .map-agent .ring {
    animation: none;
  }
}

/* Caja de ayuda emergente a los 3 s para los iconos (mismo patrón que /vista/terminales). */
.office-tip {
  position: fixed;
  z-index: 9999;
  max-width: 280px;
  padding: 6px 10px;
  background: var(--surface, #222);
  color: var(--text, #fff);
  border: 1px solid var(--accent, #5ecef5);
  border-radius: 6px;
  font: 12px/1.4 system-ui, sans-serif;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
  pointer-events: none;
}

/* Icono de la guia: i en un circulo, 28 px, foco de teclado. */
a.guide-info {
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--line, var(--border, #a6a6a6));
  border-radius: 50%;
  background: var(--surface, transparent);
  color: var(--ink, currentColor);
  text-decoration: none;
}
a.guide-info:focus-visible {
  outline: 2px solid var(--cyan, #5ecef5);
  outline-offset: 2px;
}
a.guide-info svg {
  display: block;
}
body > a.guide-info {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 40;
  background: var(--surface, #fff);
}

@media (max-width: 34rem) {
  /* En el móvil el botón vuelve a 44 px: ahí sí es un dedo, no un ratón. */
  button { min-height: 44px; padding: 0.5rem; }
  #theme-toggle { width: 44px; min-height: 44px; }
  #refresh-btn,
  .btn-refresh {
    width: 22px;
    height: 22px;
    min-height: 22px;
    min-width: 22px;
    padding: 0;
    margin-right: calc(44px + 0.4rem);
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   SISTEMA DE COMPONENTES («WIDGETS» CANÓNICOS ERBOLAMM / APLIARTE)
   Componentes base universales para evitar código repetitivo y anidamientos.
   ══════════════════════════════════════════════════════════════════════════ */

/* 1. Tarjeta Plana Unificada (.er-card) — Sin anidamientos recursivos */
.er-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.er-card:hover {
  border-color: var(--cyan);
}

/* 2. Botón Unificado (.er-btn / .pill-btn) — Área táctil móvil de 44px */
.er-btn, .pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.er-btn.active, .pill-btn.active {
  background: var(--blue) !important;
  color: #ffffff !important;
  border-color: var(--navy) !important;
  box-shadow: 0 2px 6px rgba(0, 95, 169, 0.25);
}

.er-btn.primary, .pill-btn.primary {
  background: var(--blue) !important;
  color: #ffffff !important;
  border-color: var(--navy) !important;
}
.er-btn.primary:hover, .pill-btn.primary:hover {
  background: var(--navy) !important;
  border-color: #002d50 !important;
}

.er-btn.secondary, .pill-btn.secondary {
  background: var(--surface) !important;
  color: var(--ink) !important;
  border-color: var(--border) !important;
}
.er-btn.secondary:hover, .pill-btn.secondary:hover {
  background: var(--subtle) !important;
}

.er-btn.danger, .pill-btn.danger {
  background: rgba(211, 47, 47, 0.12) !important;
  color: #d32f2f !important;
  border-color: #d32f2f !important;
}
.er-btn.danger:hover, .pill-btn.danger:hover {
  background: rgba(211, 47, 47, 0.22) !important;
}

html[data-theme="dark"] .er-btn.primary,
html[data-theme="dark"] .pill-btn.primary {
  background: #0284c7 !important;
  border-color: #0369a1 !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .er-btn.btn-action-start,
html[data-theme="dark"] .pill-btn.btn-action-start,
html[data-theme="dark"] .btn-action-start {
  background: #15803d !important;
  border-color: #166534 !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .er-btn.btn-action-start:hover,
html[data-theme="dark"] .pill-btn.btn-action-start:hover,
html[data-theme="dark"] .btn-action-start:hover {
  background: #14532d !important;
  border-color: #052e16 !important;
}
html[data-theme="dark"] .er-btn.btn-action-stop,
html[data-theme="dark"] .pill-btn.btn-action-stop,
html[data-theme="dark"] .btn-action-stop {
  background: #b91c1c !important;
  border-color: #991b1b !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .er-btn.btn-action-stop:hover,
html[data-theme="dark"] .pill-btn.btn-action-stop:hover,
html[data-theme="dark"] .btn-action-stop:hover {
  background: #7f1d1d !important;
  border-color: #450a0a !important;
}

/* 3. Chip de Estado Unificado (.er-chip / .herdr-chip / .status-chip) */
.er-chip, .herdr-chip, .status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  white-space: nowrap;
  line-height: 1.2;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: currentColor;
}

.er-chip.working, .chip-working, .chip-active, [data-status="working"] {
  border-color: #2e7d32;
  background: rgba(46, 125, 50, 0.12);
  color: #1b5e20;
}

html[data-theme="dark"] .er-chip.working,
html[data-theme="dark"] .chip-working,
html[data-theme="dark"] .chip-active,
html[data-theme="dark"] [data-status="working"] {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.2);
  color: #81c784;
}

.er-chip.idle, .chip-idle, [data-status="idle"], [data-status="done"] {
  border-color: #005fa9;
  background: rgba(0, 95, 169, 0.08);
  color: #005fa9;
}

html[data-theme="dark"] .er-chip.idle,
html[data-theme="dark"] .chip-idle,
html[data-theme="dark"] [data-status="idle"] {
  border-color: #5ecef5;
  background: rgba(94, 206, 245, 0.15);
  color: #5ecef5;
}

.er-chip.blocked, .er-chip.error, .chip-blocked, [data-status="blocked"], [data-status="error"] {
  border-color: #d32f2f;
  background: rgba(211, 47, 47, 0.12);
  color: #b71c1c;
}

html[data-theme="dark"] .er-chip.blocked,
html[data-theme="dark"] .chip-blocked,
html[data-theme="dark"] [data-status="blocked"] {
  border-color: #ef5350;
  background: rgba(239, 83, 80, 0.2);
  color: #ef9a9a;
}

/* 4. Visor de Terminal Unificado (.er-console / .terminal-box / .consola-caja) */
.er-console, .terminal-box, .consola-caja {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.42;
  background: #0d1117;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 160px;
  max-height: 48vh;
  margin: 0;
  box-sizing: border-box;
}

/* 5. Flat Agent Tile (.pane-card / .er-agent-tile) */
.pane-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.pane-card:hover {
  border-color: var(--cyan);
  transform: translateY(-1px);
}

.pane-card.selected {
  border-color: var(--blue);
  background: rgba(0, 95, 169, 0.04);
  box-shadow: 0 0 0 2px var(--blue);
}

html[data-theme="dark"] .pane-card.selected {
  background: rgba(94, 206, 245, 0.08);
  box-shadow: 0 0 0 2px var(--cyan);
}

/* Pestañas de Secciones Principales (.panel-tabs) */
.panel-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0.85rem 0 1.15rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.2rem 0.1rem 0.4rem;
  scrollbar-width: none;
}
.panel-tabs::-webkit-scrollbar {
  display: none;
}
.panel-tabs .pill-btn {
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 600;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  border-radius: 999px;
}
.panel-tabs .pill-btn .tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.4rem;
  margin-left: 0.35rem;
  border-radius: 999px;
  background: rgba(0, 95, 169, 0.12);
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 700;
}
.panel-tabs .pill-btn.active .tab-badge {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

/* Pestaña Destacada de Aplicaciones y Escaparate Interactivo */
.pill-btn-destacado {
  border-color: var(--blue);
  background: rgba(0, 95, 169, 0.08);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 0 8px rgba(0, 95, 169, 0.12);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
html[data-theme="dark"] .pill-btn-destacado {
  border-color: var(--cyan);
  background: rgba(94, 206, 245, 0.12);
  color: var(--ink);
  box-shadow: 0 0 10px rgba(94, 206, 245, 0.18);
}
.panel-tabs .pill-btn-destacado.active {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
}
html[data-theme="dark"] .panel-tabs .pill-btn-destacado.active {
  background: var(--navy);
  border-color: var(--cyan);
  color: #ffffff;
}

.aplicaciones-panel {
  margin-top: 0.5rem;
}
.apps-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 0.25rem 1rem;
}
.apps-filter-btn {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--light);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.16s ease;
}
.apps-filter-btn:hover {
  border-color: var(--cyan);
  color: var(--navy);
}
html[data-theme="dark"] .apps-filter-btn:hover {
  color: var(--glow);
}
.apps-filter-btn.active {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
}
html[data-theme="dark"] .apps-filter-btn.active {
  background: var(--navy);
  border-color: var(--cyan);
  color: #ffffff;
}

.apps-showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  padding: 0.5rem 0.25rem 1.5rem;
}
.app-showcase-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.app-showcase-card:hover {
  border-color: var(--cyan);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.app-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.65rem 0.75rem;
  margin-bottom: 0.85rem;
}
.app-icon-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(0, 95, 169, 0.1);
  color: var(--blue);
  flex-shrink: 0;
  border: 1px solid rgba(0, 95, 169, 0.2);
}
html[data-theme="dark"] .app-icon-badge {
  background: rgba(94, 206, 245, 0.15);
  color: var(--glow);
  border-color: rgba(94, 206, 245, 0.3);
}
.app-card-headings {
  flex: 1 1 170px;
  min-width: 0;
}
.app-card-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  font-family: "Fira Sans Condensed", sans-serif;
  line-height: 1.2;
  overflow-wrap: break-word;
}
html[data-theme="dark"] .app-card-title {
  color: var(--glow);
}
.app-card-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--border);
  line-height: 1.3;
  overflow-wrap: break-word;
}
.app-status-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-badge-prod {
  background: rgba(52, 211, 153, 0.15);
  color: #10b981;
  border: 1px solid rgba(52, 211, 153, 0.35);
}
html[data-theme="dark"] .app-badge-prod {
  color: #34d399;
}
.app-badge-dev {
  background: rgba(251, 191, 36, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(251, 191, 36, 0.35);
}
html[data-theme="dark"] .app-badge-dev {
  color: #fbbf24;
}

.app-card-desc {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink);
  flex-grow: 1;
}

.app-features-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.app-features-list li {
  font-size: 0.8rem;
  color: var(--ink);
  opacity: 0.9;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.app-features-list li::before {
  content: "•";
  color: var(--cyan);
  font-weight: bold;
}

.app-card-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: auto;
  border-top: 1px solid var(--subtle);
  padding-top: 1rem;
}
.app-main-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.16s ease;
}
.app-main-btn:hover {
  background: var(--navy);
  box-shadow: 0 2px 8px rgba(0, 70, 123, 0.25);
  color: #ffffff;
}
html[data-theme="dark"] .app-main-btn {
  background: #0284c7;
}
html[data-theme="dark"] .app-main-btn:hover {
  background: var(--blue);
}

.app-card-stores {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.app-stores-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--border);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.app-stores-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.app-store-pill {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.16s ease;
}
.app-store-pill-active {
  background: var(--subtle);
  color: var(--ink);
  border: 1px solid var(--light);
}
.app-store-pill-active:hover {
  border-color: var(--cyan);
  color: var(--blue);
}
html[data-theme="dark"] .app-store-pill-active:hover {
  color: var(--glow);
}
.app-store-pill-disabled {
  background: transparent;
  color: var(--border);
  border: 1px dashed var(--light);
  cursor: not-allowed;
  opacity: 0.7;
}

.apps-loading-msg, .apps-empty-msg {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--border);
  font-size: 0.9rem;
  font-style: italic;
  grid-column: 1 / -1;
}

/* Tareas Recurrentes */
.recurrentes-panel {
  margin-top: 1rem;
}
.recurrentes-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0.75rem;
  list-style: none;
}
.recurrentes-empty {
  color: var(--border);
  font-size: 0.95rem;
  padding: 0.5rem 0.25rem;
}
.recurrentes-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(94, 206, 245, 0.35);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.recurrentes-card:hover {
  border-color: rgba(94, 206, 245, 0.7);
  box-shadow: var(--shadow-md);
}
.recurrentes-main {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  flex: 1 1 300px;
}
.recurrentes-card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.recurrentes-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  font-family: "Fira Sans Condensed", sans-serif;
}
html[data-theme="dark"] .recurrentes-card-title {
  color: var(--glow);
}
.recurrentes-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.4;
}
.recurrentes-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
  font-size: 0.82rem;
}
.recurrentes-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--subtle);
  border: 1px solid rgba(166, 166, 166, 0.3);
  color: var(--ink);
}
.recurrentes-chip.chip-role {
  background: color-mix(in srgb, #005fa9 12%, var(--surface));
  color: #005fa9;
  border-color: rgba(0, 95, 169, 0.3);
}
html[data-theme="dark"] .recurrentes-chip.chip-role {
  background: color-mix(in srgb, #5ecef5 15%, var(--surface));
  color: #5ecef5;
  border-color: rgba(94, 206, 245, 0.4);
}
.recurrentes-chip.chip-ok {
  background: color-mix(in srgb, #16a34a 12%, var(--surface));
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.3);
}
html[data-theme="dark"] .recurrentes-chip.chip-ok {
  background: color-mix(in srgb, #22c55e 15%, var(--surface));
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.4);
}
.recurrentes-chip.chip-due {
  background: color-mix(in srgb, #d97706 12%, var(--surface));
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.3);
}
html[data-theme="dark"] .recurrentes-chip.chip-due {
  background: color-mix(in srgb, #f59e0b 15%, var(--surface));
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}
.recurrentes-cmd {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.8rem;
  background: var(--subtle);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--ink);
}
.recurrentes-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}
.btn-recurrentes-run {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--navy);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}
.btn-recurrentes-run:hover:not(:disabled) {
  background: var(--blue);
  transform: translateY(-1px);
}
.btn-recurrentes-run:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.recurrentes-feedback {
  margin: 0.5rem 0.75rem 0;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: color-mix(in srgb, #005fa9 10%, var(--surface));
  color: var(--ink);
  border: 1px solid rgba(94, 206, 245, 0.3);
}
.recurrentes-form {
  margin: 0.75rem;
  padding: 1rem;
  border: 1px solid rgba(94, 206, 245, 0.4);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 0.75rem;
}
.recurrentes-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}
.recurrentes-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.recurrentes-form-field.full-width {
  grid-column: 1 / -1;
}
.recurrentes-form-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}
.recurrentes-form-field input,
.recurrentes-form-field select,
.recurrentes-form-field textarea {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font-size: 0.9rem;
  font-family: inherit;
}
.recurrentes-form-field input:focus,
.recurrentes-form-field select:focus,
.recurrentes-form-field textarea:focus {
  outline: 2px solid var(--glow);
  border-color: var(--cyan);
}
.recurrentes-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.25rem;
}
.inbox-notice {
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
}
.inbox-notice p {
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}

/* ─── Modo limpio / aislado (?modo=limpio o ?aislado=1) ─────────────────────── */
html[data-modo="limpio"] .office-sidebar,
html[data-modo="limpio"] #office-sidebar,
html[data-modo="limpio"] .sidebar-toggle,
html[data-modo="limpio"] #sidebar-toggle,
html[data-modo="limpio"] .sidebar-scrim,
html[data-modo="limpio"] #sidebar-scrim {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  pointer-events: none !important;
  position: absolute !important;
  left: -9999px !important;
  z-index: -1 !important;
  opacity: 0 !important;
}

html[data-modo="limpio"] .app-shell {
  display: block !important;
  grid-template-columns: 1fr !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

html[data-modo="limpio"] .office-main,
html[data-modo="limpio"] main,
html[data-modo="limpio"] .office-content,
html[data-modo="limpio"] .office-content-aplichat,
html[data-modo="limpio"] .office-content-traductor {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

html[data-modo="limpio"] .office-content-aplichat .topbar,
html[data-modo="limpio"] .office-content-traductor .topbar {
  padding-left: max(1rem, env(safe-area-inset-left)) !important;
}

/* ─── Menú contextual de la barra lateral: Abrir en ventana limpia ──────────── */
.nav-card-context-menu {
  position: fixed;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  min-width: 13rem;
  padding: 0.35rem;
  background: var(--surface);
  color: var(--navy);
  border: 1px solid var(--light);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  font-family: inherit;
  font-size: 0.88rem;
  animation: contextMenuFadeIn 0.12s ease-out;
}

@keyframes contextMenuFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

html[data-theme="dark"] .nav-card-context-menu {
  background: #1e222b;
  color: var(--glow);
  border-color: #2e3544;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.nav-card-context-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: none;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: 500;
  text-align: left;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-card-context-btn:hover,
.nav-card-context-btn:focus {
  background: var(--light);
  color: var(--navy);
  outline: none;
}

html[data-theme="dark"] .nav-card-context-btn:hover,
html[data-theme="dark"] .nav-card-context-btn:focus {
  background: #2b3242;
  color: #fff;
}


