/* =============================================================
   DUALAI CRM V2 — Shell de aplicación + primitivas de UI (V1)
   Capa autorizada del plan maestro: sistema de tokens (design-system.css)
   + primitivas reutilizables ANTES del rediseño por página (V2-V8).
   Se carga DESPUÉS de style.css para normalizar la iconografía,
   botones, tarjetas y badges heredados. A medida que cada página
   migre a estas primitivas, su CSS ad-hoc se elimina de style.css
   (no se añaden bloques finales de overrides).
   ============================================================= */

/* ── Base tipográfica (UI: Inter. Sin fuentes de emojis jamás) ── */
body {
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  line-height: 1.55;
  background: var(--canvas, var(--bg));
  color: var(--text);
}
h1, h2, h3, h4 {
  font-family: var(--font-ui);
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }
/* Mono SOLO para IDs, hashes, timestamps, códigos de ciclo de vida,
   task IDs, executors y contadores técnicos. */
.ui-mono, code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.92em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ── Iconos (SVG inline, sprite #i-*) ── */
.ui-icon {
  width: 1.15em;
  height: 1.15em;
  display: inline-block;
  vertical-align: -0.18em;
  flex: 0 0 auto;
}

/* ── Shell: sidebar + marco ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.app-sidebar {
  width: var(--ui-sidebar-w);
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--bg-sunken) 88%, transparent);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width var(--dur-med) ease;
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  height: var(--ui-topbar-h);
  padding: 0 0.9rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: 0 0 auto;
}
.app-brand:hover { text-decoration: none; }
.app-brand-mark { width: 30px; height: 30px; flex: 0 0 auto; border-radius: var(--radius-md); }
.app-brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.app-brand-name { font-size: 0.95rem; }
.app-brand-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.app-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.55rem 0.8rem;
  overflow-y: auto;
  flex: 1 1 auto;
}
.app-nav-group-label {
  margin: 0.85rem 0 0.15rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 0.65rem;
  font-weight: 650;
}
.app-nav-group-label:first-child { margin-top: 0.2rem; }
.app-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  min-height: 42px;
  border-radius: var(--radius-md);
  color: var(--ui-nav-fg);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.app-nav-item:hover {
  background: var(--primary-bg);
  color: var(--ui-nav-fg-active);
  text-decoration: none;
}
.app-nav-item[aria-current="page"] {
  background: var(--ui-nav-bg-active);
  color: var(--ui-nav-fg-active);
  font-weight: 650;
}
.app-nav-item .ui-icon { width: 1.25rem; height: 1.25rem; }
.app-sidebar-foot {
  padding: 0.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.35rem;
}
.app-shell[data-collapsed="true"] .app-sidebar { width: var(--ui-sidebar-w-collapsed); }
.app-shell[data-collapsed="true"] .app-brand-text,
.app-shell[data-collapsed="true"] .app-nav-item span,
.app-shell[data-collapsed="true"] .app-nav-group-label { display: none; }
.app-shell[data-collapsed="true"] .app-nav-item,
.app-shell[data-collapsed="true"] .app-brand { justify-content: center; padding-left: 0; padding-right: 0; }

.app-frame {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Barra superior (utilidades) ── */
.app-topbar {
  height: var(--ui-topbar-h);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 72%, transparent);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 40;
}
.ui-search {
  flex: 0 1 280px;
  width: 280px;
  max-width: 100%;
  position: relative;
  display: flex;
  margin: 0;
}
.ui-search .ui-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--text-soft);
  pointer-events: none;
}
.ui-search input {
  width: 100%;
  padding: 0.5rem 0.85rem 0.5rem 2.15rem;
  min-height: 40px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.85rem;
}
.ui-search input::placeholder { color: var(--text-soft); }
.app-topbar-utils {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.ui-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
}
.ui-icon-btn:hover { background: var(--primary-bg); color: var(--ui-nav-fg-active); text-decoration: none; }
.app-account {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.7rem 0.2rem 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}
.app-account .user-name { font-size: 0.85rem; font-weight: 600; }

/* ── Contenido y pie ── */
.app-content { flex: 1 1 auto; width: 100%; padding: 1.6rem 1.75rem 3rem; }
.app-footer {
  border-top: 1px solid var(--border);
  padding: 0.9rem 1.75rem 1.1rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ── Navegación móvil (5 destinos) + cajón «Más» ── */
.app-mobile-nav { display: none; }
.app-drawer-backdrop, .app-drawer { display: none; }
@media (max-width: 860px) {
  .app-sidebar { display: none; }
  .app-content { padding: 1.1rem 1rem 8rem; }
  .app-topbar { padding: 0 0.9rem; gap: 0.55rem; }
  .app-account .user-name { display: none; }
  .app-account { border: 0; padding: 0; }
  .app-mobile-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    padding: 0.25rem 0.3rem calc(0.25rem + env(safe-area-inset-bottom));
  }
  .app-mobile-nav a, .app-mobile-nav button {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: 56px;
    color: var(--ui-nav-fg);
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 0.66rem;
    font-weight: 650;
    background: none;
    border: 0;
    cursor: pointer;
  }
  .app-mobile-nav a[aria-current="page"] { color: var(--accent); }
  /* El flotante de HAL no debe tapar el nav inferior móvil */
  .hal-chat-toggle {
    bottom: calc(4.25rem + env(safe-area-inset-bottom));
    z-index: 75;
  }
  .app-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 70;
  }
  .app-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-md);
    padding: 0.9rem 0.8rem calc(1.1rem + env(safe-area-inset-bottom));
    gap: 0.15rem;
  }
}
[hidden] { display: none !important; }

/* ── Primitiva: Botón (semántica única de botones) ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease,
              color var(--dur-fast) ease;
}
.btn:hover { background: var(--primary-bg); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-success { background: var(--success); border-color: var(--success); color: var(--primary-contrast); }
.btn-success:hover { filter: brightness(1.06); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--primary-contrast); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--primary-bg); color: var(--text); }
.btn-sm { min-height: 32px; padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.btn-full { width: 100%; }

/* ── Primitiva: Tarjeta / Panel ── */
.card, .panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.panel { padding: 1.1rem 1.25rem; }

/* ── Primitiva: Badge de estado (semántica única) ── */
.badge, .status-badge, .ui-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--primary-bg);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.ui-pill-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.ui-pill-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.ui-pill-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.ui-pill-accent { background: var(--accent-bg); border-color: var(--accent-border); color: var(--accent); }

/* ── Primitiva: barras de progreso (P01-P10) ── */
.ui-progress {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--primary-bg);
  overflow: hidden;
}
.ui-progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

/* ── Primitiva: conmutador de vistas (Lista | Board) ── */
.ui-views {
  display: inline-flex;
  gap: 0.15rem;
  padding: 0.2rem;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.ui-views::-webkit-scrollbar {
  display: none;
}
.ui-views {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.ui-views a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.8rem;
  min-height: 34px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.ui-views a:hover { color: var(--text); text-decoration: none; }
.ui-views a.is-active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

/* ── Primitiva: encabezado de página ── */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.page-head h1 { margin: 0 0 0.15rem; }
.page-head-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* ── Primitiva: vacío / esqueleto / migas ── */
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--text-muted); }
.ui-skeleton {
  border-radius: var(--radius-md);
  min-height: 1rem;
  background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--primary-bg) 50%, var(--bg-sunken) 75%);
  background-size: 200% 100%;
  animation: ui-shimmer 1.4s ease infinite;
}
@keyframes ui-shimmer { to { background-position: -200% 0; } }
.ui-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-bottom: 0.6rem;
}
.ui-breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.ui-breadcrumbs a:hover { color: var(--text); text-decoration: underline; }

/* ── Accesibilidad: foco, objetivos táctiles, movimiento reducido ── */
:focus-visible {
  outline: none;
  box-shadow: var(--ui-focus-ring);
  border-radius: var(--radius-sm);
}
@media (pointer: coarse) {
  .btn, .ui-icon-btn, .app-nav-item, .ui-views a { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── HAL: mismo lenguaje visual (drawer derecho, sin emojis) ── */
.hal-chat-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-md);
}
.hal-chat-toggle { 
  border-radius: var(--radius-pill); 
  min-width: 44px; 
  min-height: 44px; 
  display: flex; 
  align-items: center; 
  justify-content: center;
}

/* ── Página: Proyectos (V1 — se consolida en su fase V2-V8) ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.15rem 1.25rem;
}
.project-card.is-attention { border-color: var(--warn-border); }
.project-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.project-card-head .ui-pill {
  max-width: 55%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-card-title { margin: 0; font-size: 1rem; }
.project-card-title a { color: var(--text); text-decoration: none; }
.project-card-title a:hover { text-decoration: underline; }
.project-card-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.55rem 1rem;
  margin: 0;
}
.project-card-facts dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  font-weight: 650;
}
.project-card-facts dd { margin: 0.15rem 0 0; font-size: 0.86rem; }
.project-card-banner { margin: 0; font-size: 0.82rem; color: var(--text-muted); }
.project-card-foot { margin-top: auto; display: flex; gap: 0.5rem; }


/* ── Work Views (Todo & My Work) ── */
.work-groups { display: flex; flex-direction: column; gap: 2rem; }
.work-group-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 1.1rem; margin-bottom: 1rem; color: var(--text);
}
.work-cards, .todo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.work-card-my, .work-card-todo {
  display: flex; flex-direction: column;
  padding: 1.1rem 1.25rem; gap: 0.75rem;
  color: var(--text); text-decoration: none;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.work-card-my:hover, .work-card-todo:hover {
  border-color: var(--border-strong);
  text-decoration: none;
}
.work-card-my.is-overdue, .work-card-todo.is-overdue { border-color: var(--danger-border); }
.work-card-title { font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
.work-card-my-meta, .work-card-todo-side {
  display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; margin-top: auto;
}
.work-card-todo { flex-direction: row; justify-content: space-between; align-items: flex-start; }
.work-card-todo-main { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.work-card-todo-side { flex-direction: column; align-items: flex-end; gap: 0.35rem; margin-top: 0; }
@media (max-width: 768px) {
  .work-card-todo { flex-direction: column; }
  .work-card-todo-side { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; width: 100%; margin-top: 0.5rem; }
}

/* ── Sales Pipeline & Revenue ── */
.revenue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}
.revenue-card {
  display: flex; flex-direction: column; gap: 0.35rem;
}
.revenue-label {
  font-size: 0.7rem; font-weight: 650; color: var(--text-soft); letter-spacing: 0.05em;
}
.revenue-value {
  font-size: 1.25rem; font-weight: 700; color: var(--text); line-height: 1.2;
}
.pipeline-funnel {
  display: flex; flex-wrap: wrap; gap: 1rem;
}
.pipeline-stage-card {
  flex: 1 1 180px; min-width: 150px;
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0.9rem;
  display: flex; flex-direction: column; gap: 0.6rem;
}
.stage-head { display: flex; justify-content: space-between; align-items: center; }
.stage-label { font-size: 0.8rem; font-weight: 650; color: var(--text-soft); text-transform: uppercase; }
.stage-metrics { display: flex; flex-direction: column; gap: 0.15rem; }
.stage-val { font-size: 1.1rem; font-weight: 700; }
.stage-conv { font-size: 0.75rem; color: var(--text-muted); }
.sales-forms-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 1.5rem;
}
.sales-form h3 { font-size: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.sales-form .form-group { margin-bottom: 0.75rem; }
.sales-form label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.25rem; color: var(--text-muted); }
.ui-input, .ui-select {
  width: 100%; padding: 0.5rem 0.75rem; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--bg-sunken); color: var(--text);
  font-family: var(--font-ui); font-size: 0.9rem; margin-top: 0.35rem; box-sizing: border-box;
}
.ui-input:focus, .ui-select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent);
}

/* ── Team Grid ── */
.team-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem;
}
.team-card { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.team-card-head { display: flex; align-items: flex-start; gap: 1rem; }
.team-avatar {
  width: 48px; height: 48px; border-radius: var(--radius-md);
  background: var(--primary-bg); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; flex: 0 0 auto;
}
.team-info { flex: 1; min-width: 0; }
.team-name { margin: 0 0 0.25rem; font-size: 1.05rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.team-kind { font-size: 0.65rem; background: var(--border); border-color: var(--border-strong); color: var(--text-muted); }
.team-actions { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; }
.team-stats {
  display: flex; gap: 1rem; background: var(--bg-sunken); border-radius: var(--radius-md); padding: 0.75rem;
}
.stat-item { display: flex; flex-direction: column; align-items: center; flex: 1; }
.stat-value { font-size: 1.1rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.65rem; text-transform: uppercase; color: var(--text-soft); font-weight: 600; margin-top: 0.25rem; }

/* ── Utilities ── */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-3 { padding-top: 0.75rem; }
.border-t { border-top: 1px solid var(--border); }
.border-warn { border-color: var(--warn-border); }
.text-warn { color: var(--warn); }
.text-danger { color: var(--danger); }
.flex { display: flex; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.justify-between { justify-content: space-between; }
.font-semibold { font-weight: 600; }
.font-normal { font-weight: 400; }
.text-sm { font-size: 0.82rem; }
.p-4 { padding: 1rem; }
.pl-5 { padding-left: 1.25rem; }
.text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  display: block;
}

/* ── Calendar Mobile Adaptivity ── */
@media (max-width: 768px) {
  .cal-top-controls { flex-direction: column; align-items: stretch; gap: 0.75rem; width: 100%; }
  .cal-top-controls .cal-nav { justify-content: space-between; width: 100%; }
  .cal-top-controls .ui-views { justify-content: center; width: 100%; }
  .cal-top-controls .ui-views a { flex: 1; justify-content: center; }
  /* Semana en móvil: cabecera y horas desplazan juntas en horizontal. */
  .panel-cal { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .gcal-week { min-width: 600px; }
}

/* ── Kanban Board & Table Mobile Overflows (V5) ── */
.app-content {
  min-width: 0; /* Ensures flex children can shrink below content size */
}

.kanban-board {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}

.kanban-col {
  flex: 0 0 auto;
  width: 180px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  min-width: 0;
}

/* ── Cierre visual V7: contraste, HAL y control de menú ── */
.app-sidebar { overflow: hidden; }
.app-sidebar-foot {
  flex: 0 0 auto;
  padding: 0.65rem 0.55rem 0.75rem;
  background: color-mix(in srgb, var(--bg-sunken) 80%, transparent);
}
.app-collapse-btn {
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--primary-bg);
  border-radius: var(--radius-pill);
}
.app-topbar .hal-chat-toggle {
  position: static;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  right: auto;
  bottom: auto;
  z-index: auto;
  box-shadow: none;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.row-link-anchor {
  display: inline-block;
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.auth-subtitle, .auth-footer-note { color: var(--text-muted); }
.auth-brand { align-items: center; }
.app-collapse-btn {
  width: 100%;
  justify-content: flex-start;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0 0.7rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.app-shell[data-collapsed="true"] .app-collapse-btn { justify-content: center; padding: 0; }
.app-shell[data-collapsed="true"] .app-collapse-btn span { display: none; }
.hal-chat-toggle .hal-mark {
  position: static;
  width: 28px;
  height: 28px;
  display: block;
}
.icon-btn .ui-icon, .page-head-actions .ui-icon { width: 1rem; height: 1rem; }
.urgency-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--text-soft);
  display: inline-block;
}
.urgency-dot.is-critical { background: var(--danger); }
.urgency-dot.is-high { background: var(--warn); }
.urgency-dot.is-medium { background: var(--accent); }
@media (max-width: 860px) {
  .app-content { padding-bottom: 9.5rem; }
  .app-mobile-nav { z-index: 90; }
  .hal-chat-toggle {
    right: 12px;
    bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px));
    z-index: 70;
    width: 48px;
    height: 48px;
  }
  .dash-panel-head h2, .dash-greet { overflow-wrap: anywhere; }
}
