:root{
  color-scheme: dark;
  --bg: #0b1220;
  --panel: #0f1a2e;
  --panel-2: #111f36;
  --text: #e8eefc;
  --muted: #a9b7d6;
  --border: rgba(232,238,252,.10);
  --brand: #7c5cff;
  --brand-2: #2de2e6;
  --danger: #ff5c7a;
  --ok: #31d0aa;
  --shadow: 0 18px 60px rgba(0,0,0,.35);
  --radius: 14px;

  /* Controles (inputs/botones): consistencia UX */
  --control-radius: 12px;
  --focus-border: rgba(124,92,255,.55);
  --focus-ring: rgba(124,92,255,.14);
  --hover-border: rgba(124,92,255,.28);
  --btn-hover-bg: rgba(232,238,252,.085);

  /* Tokens de superficies (para theming robusto) */
  --topbar-bg: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.02));
  --card-bg: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
  --menu-bg: rgba(15,26,46,.98);
  --menu-hover-bg: rgba(232,238,252,.04);
  --input-bg: rgba(15,26,46,.75);
  --btn-bg: rgba(232,238,252,.06);
  --pill-bg: rgba(232,238,252,.06);
  --flash-bg: rgba(15,26,46,.55);
  --logbox-bg: rgba(6,10,18,.65);
  --nav-active-bg: rgba(232,238,252,.06);

  /* Tokens de fondo (para tema claro/oscuro) */
  --bg-grad-1: rgba(124,92,255,.30);
  --bg-grad-2: rgba(45,226,230,.18);
  --bg-grad-3: rgba(49,208,170,.10);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  color:var(--text);
  background:
    radial-gradient(1200px 700px at 20% -10%, var(--bg-grad-1), transparent 55%),
    radial-gradient(900px 600px at 100% 10%, var(--bg-grad-2), transparent 50%),
    radial-gradient(800px 600px at 40% 110%, var(--bg-grad-3), transparent 50%),
    var(--bg);
}
body.ai-modal-open{ overflow:hidden; }

a{color:inherit; text-decoration:none}
a:hover{opacity:.95; text-decoration:underline}

.container{max-width:1400px; margin:0 auto; padding:28px 24px}
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 18px; border:1px solid var(--border);
  background: var(--topbar-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.brand{
  display:flex; align-items:center; gap:12px;
  font-weight:700; letter-spacing:.2px;
}
.brand-link{color:inherit; text-decoration:none}
.brand-link:hover{opacity:1; text-decoration:none}
.logo{
  width:34px; height:34px; border-radius:10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 40px rgba(124,92,255,.25);
}
.nav{display:flex; align-items:center; gap:14px; color:var(--muted); font-size:14px}
.nav a{padding:8px 10px; border-radius:10px}
.nav a.active{color:var(--text); background: var(--nav-active-bg); border:1px solid var(--border)}

/* Dropdown (topbar) */
.nav details.nav-dropdown{position:relative}
.nav details.nav-dropdown > summary{
  list-style:none;
  padding:8px 10px;
  border-radius:10px;
  cursor:pointer;
  user-select:none;
}
.nav details.nav-dropdown > summary::-webkit-details-marker{display:none}
.nav details.nav-dropdown > summary.active{
  color:var(--text);
  background: var(--nav-active-bg);
  border:1px solid var(--border);
}
.nav details.nav-dropdown[open] > summary{color:var(--text)}
.nav .nav-dropdown-menu{
  position:absolute;
  right:0;
  top:calc(100% + 8px);
  min-width:220px;
  border:1px solid var(--border);
  background: var(--menu-bg);
  border-radius:12px;
  box-shadow: var(--shadow);
  padding:8px;
  z-index:50;
}
.nav .nav-dropdown-menu a{
  display:block;
  padding:10px 10px;
  border-radius:10px;
}
.nav .nav-dropdown-menu a:hover{background: var(--menu-hover-bg)}
.nav .nav-dropdown-sep{
  height:1px;
  background: var(--border);
  margin:8px 4px;
}

.grid{display:grid; grid-template-columns: 1fr; gap:16px; margin-top:18px}
@media (min-width: 920px){
  .grid.two{grid-template-columns: 1fr 1fr}
}

.card{
  border:1px solid var(--border);
  background: var(--card-bg);
  border-radius: var(--radius);
  padding:16px 16px;
  box-shadow: var(--shadow);
}
.card h2{margin:0 0 8px 0; font-size:16px}
.muted{color:var(--muted)}
.small{font-size:13px}

.form{
  display:grid; gap:12px; margin-top:10px
}
label{display:block; font-size:13px; color:var(--muted); margin-bottom:6px}
input:not([type]), input[type="email"], input[type="password"], input[type="text"], input[type="url"], input[type="tel"], input[type="number"], input[type="search"]{
  width:100%;
  padding:12px 12px;
  border-radius:var(--control-radius);
  border:1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
select, textarea{
  width:100%;
  padding:12px 12px;
  border-radius:var(--control-radius);
  border:1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
textarea{min-height:110px; resize:vertical}
input:focus{border-color: var(--focus-border); box-shadow: 0 0 0 4px var(--focus-ring)}
select:focus, textarea:focus{border-color: var(--focus-border); box-shadow: 0 0 0 4px var(--focus-ring)}
input:hover, select:hover, textarea:hover{border-color: var(--hover-border)}
input:disabled, select:disabled, textarea:disabled{opacity:.6; cursor:not-allowed}
input::placeholder, textarea::placeholder{color: var(--muted); opacity:.75}

/* Select: flecha consistente (sin depender del UI del navegador) */
select{
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;
  padding-right: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 52%,
    calc(100% - 12px) 52%;
  background-size: 6px 6px, 6px 6px;
  background-repeat:no-repeat;
}
select::-ms-expand{display:none}

/* Checkboxes/radios: alineados con el “brand” */
input[type="checkbox"], input[type="radio"]{
  accent-color: var(--brand);
}

/* File input: el botón nativo con estilo tipo .btn */
input[type="file"]{
  width:100%;
  color: var(--muted);
}
input[type="file"]::file-selector-button{
  margin-right:10px;
  padding:10px 12px;
  border-radius: var(--control-radius);
  border:1px solid var(--border);
  background: var(--btn-bg);
  color: var(--text);
  cursor:pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease;
}
input[type="file"]::file-selector-button:hover{background: var(--btn-hover-bg)}
input[type="file"]::-webkit-file-upload-button{
  margin-right:10px;
  padding:10px 12px;
  border-radius: var(--control-radius);
  border:1px solid var(--border);
  background: var(--btn-bg);
  color: var(--text);
  cursor:pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease;
}
input[type="file"]::-webkit-file-upload-button:hover{background: var(--btn-hover-bg)}

.row{display:flex; gap:10px; align-items:center; justify-content:space-between}
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px;
  padding:10px 12px;
  border-radius: var(--control-radius);
  border:1px solid var(--border);
  color: var(--text);
  background: var(--btn-bg);
  cursor:pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease;
}
.btn:hover{background: var(--btn-hover-bg); text-decoration:none}
.btn.primary{
  background: linear-gradient(135deg, rgba(124,92,255,.95), rgba(45,226,230,.55));
  border-color: rgba(124,92,255,.35);
}
.btn.danger{
  background: rgba(255,92,122,.10);
  border-color: rgba(255,92,122,.35);
  color: #ffd0d9;
}
.btn:disabled{opacity:.55; cursor:not-allowed}

.flash{
  border:1px solid var(--border);
  border-left: 4px solid rgba(124,92,255,.75);
  background: var(--flash-bg);
  padding:12px 12px;
  border-radius: 12px;
}
.flash.error{border-left-color: rgba(255,92,122,.85)}
.flash.ok{border-left-color: rgba(49,208,170,.85)}

.logbox{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  background: var(--logbox-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  max-height: 60vh;
  overflow: auto;
  white-space: pre-wrap;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background: var(--pill-bg);
  color: var(--muted);
}
/* Variantes semánticas */
.pill.ok{
  border-color: var(--ok);
  color: var(--ok);
  background: transparent;
}
.pill.danger{
  border-color: var(--danger);
  color: var(--danger);
  background: transparent;
}
@supports (background: color-mix(in srgb, white 50%, black)){
  .pill.ok{
    border-color: color-mix(in srgb, var(--ok) 45%, var(--border));
    background: color-mix(in srgb, var(--ok) 12%, transparent);
  }
  .pill.danger{
    border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
    background: color-mix(in srgb, var(--danger) 12%, transparent);
  }
}

/* Tablas (coherentes en todos los temas) */
.table-wrap{
  margin-top:12px;
  overflow-x:auto;
  overflow-y:auto;
  border:1px solid var(--border);
  border-radius: 12px;
  position:relative;
}
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  font-size:14px;
}
.table thead th{
  position:sticky;
  top:0;
  text-align:left;
  font-size:12px;
  letter-spacing:.06em;
  text-transform:uppercase;
  color: var(--muted);
  background: var(--menu-bg);
  border-bottom:1px solid var(--border);
  padding:12px 12px;
  z-index:2;
}
.table tbody td{
  padding:12px 12px;
  border-bottom:1px solid var(--border);
  vertical-align:top;
}
.table tbody tr:hover td{ background: var(--menu-hover-bg); }
.table .right{ text-align:right; white-space:nowrap; }
.table .nowrap{ white-space:nowrap; }

/* Tabla más “clean” para listados */
.table.clean thead th{
  text-transform:none;
  letter-spacing:0;
  font-size:13px;
  padding:10px 12px;
}
.table.clean tbody td{ padding:10px 12px; }

/* Botones compactos */
.btn.sm{
  padding:8px 10px;
  font-size:13px;
  border-radius: 10px;
}
.pill.sm{
  padding:5px 8px;
  font-size:12px;
}

/* Dropdown genérico (reutiliza look&feel del nav) */
details.dropdown{ 
  position:relative; 
  display:inline-block; 
  z-index:100; 
}
details.dropdown > summary{
  list-style:none;
  cursor:pointer;
  user-select:none;
  position:relative;
  z-index:1;
}
details.dropdown > summary::-webkit-details-marker{display:none}
details.dropdown[open] > summary{
  z-index:1;
}
.dropdown-menu{
  position:absolute;
  right:0;
  top:calc(100% + 8px);
  min-width:220px;
  border:1px solid var(--border);
  background: var(--menu-bg);
  border-radius:12px;
  box-shadow: var(--shadow);
  padding:8px;
  z-index:1000;
  isolation: isolate;
}
/* Cuando el dropdown está abierto y cerca del borde inferior, abrirlo hacia arriba */
details.dropdown.dropdown-up .dropdown-menu{
  top:auto;
  bottom:calc(100% + 8px);
  z-index:1000;
}
/* Cuando el dropdown necesita posicionamiento fijo para evitar cortes */
details.dropdown.dropdown-fixed .dropdown-menu{
  position:fixed;
  z-index:1000;
}
.dropdown-menu a, .dropdown-menu button{
  display:block;
  width:100%;
  text-align:left;
  padding:10px 10px;
  border-radius:10px;
  border:0;
  background:transparent;
  color:inherit;
  cursor:pointer;
  transition: background-color 150ms ease, color 150ms ease;
  position:relative;
  z-index:1;
}
.dropdown-menu a:hover, .dropdown-menu button:hover{ background: var(--menu-hover-bg); }
.dropdown-sep{
  height:1px;
  background: var(--border);
  margin:6px 8px;
}

/* Mejoras estéticas del dropdown menu */
.dropdown-menu{
  min-width: 240px;
  padding: 6px;
  backdrop-filter: blur(8px);
  /* Asegurar que el menú siempre esté por encima del botón y otros elementos */
  z-index: 1000 !important;
  position: absolute !important;
}

.dropdown-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  transition: all 150ms ease;
  text-decoration: none;
  color: var(--text);
}

.dropdown-item:hover{
  background: var(--menu-hover-bg);
  transform: translateX(2px);
}

.dropdown-item:active{
  transform: translateX(0);
}

.dropdown-icon{
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.85;
}

.dropdown-item-danger{
  color: var(--danger) !important;
}

.dropdown-item-danger:hover{
  background: rgba(255,92,122,.12) !important;
  color: #ffd0d9 !important;
}

.dropdown-item.muted{
  opacity: 0.7;
  cursor: default;
}

.dropdown-item.muted:hover{
  background: transparent;
  transform: none;
}

/* Botón/icono minimal */
.btn.icon{
  padding:8px 10px;
  min-width:auto;
}
.btn.ghost{
  background: transparent;
}
.btn.ghost:hover{ background: var(--btn-hover-bg); }

/* Listado de sitios (más limpio que tabla) */
.site-list{
  display:flex;
  flex-direction:column;
}
.site-item{
  display:flex;
  gap:14px;
  align-items:flex-start;
  padding:12px 12px;
  border-bottom:1px solid var(--border);
}
.site-item:last-child{ border-bottom:0; }
.site-item:hover{ background: var(--menu-hover-bg); }
.site-main{ flex:1; min-width:260px; }
.site-title{
  font-weight:800;
  line-height:1.2;
  margin:0;
}
.site-sub{
  margin-top:4px;
  color: var(--muted);
  font-size:13px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width: 520px;
}
.site-col{
  min-width: 190px;
  max-width: 260px;
}
.site-col.wide{ min-width: 240px; max-width: 340px; }
.site-col .muted{ font-size:13px; }
.site-actions{
  min-width: 56px;
  display:flex;
  justify-content:flex-end;
}
.site-badges{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}
.site-inline{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}
.sr-only{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  border:0;
}

/* Asistente IA (widget flotante) */
.ai-fab{
  position:fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  width:56px;
  height:56px;
  border-radius:16px;
  border:1px solid var(--border);
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color:#071022;
  font-weight:900;
  letter-spacing:.5px;
  box-shadow: var(--shadow);
  cursor:pointer;
  z-index: 9999;
}
.ai-fab:hover{ opacity:.95; }
.ai-backdrop{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(2px);
  z-index: 9998;
}
.ai-panel{
  position:fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  width:min(420px, calc(100vw - 36px));
  /* Fallbacks (por si el navegador no soporta min()/dvh/svh) */
  height: 560px;
  max-height: calc(100vh - 36px);
  /* Evita cortes por barras del navegador/teclado (fallbacks) */
  max-height: min(560px, calc(100vh - 36px));
  max-height: min(560px, calc(100svh - 36px));
  max-height: min(560px, calc(100dvh - 36px));
  /* Fijamos altura para evitar “cortes” con contenido largo */
  height: min(560px, calc(100vh - 36px));
  height: min(560px, calc(100svh - 36px));
  height: min(560px, calc(100dvh - 36px));
  border-radius:16px;
  border:1px solid var(--border);
  background: var(--menu-bg);
  box-shadow: var(--shadow);
  /* Grid = footer siempre visible + mensajes scroll seguros */
  display:grid;
  grid-template-rows: 8px auto minmax(0, 1fr) auto;
  overflow:hidden;
  z-index: 9999;
  animation: ai-pop 140ms ease-out;
}
@keyframes ai-pop{
  from{ transform: translateY(10px); opacity:.0; }
  to{ transform: translateY(0); opacity:1; }
}
.ai-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  padding:12px 12px;
  border-bottom:1px solid var(--border);
}
.ai-resize-handle{
  height:8px;
  cursor: ns-resize;
  background: transparent;
}
.ai-resize-handle::after{
  content:"";
  display:block;
  width:44px;
  height:4px;
  border-radius:999px;
  margin:2px auto 0 auto;
  background: rgba(232,238,252,.18);
}
.ai-panel.minimized{
  max-height:none !important;
  height:auto !important;
}
.ai-panel.minimized .ai-resize-handle,
.ai-panel.minimized .ai-messages,
.ai-panel.minimized .ai-footer,
.ai-panel.minimized .ai-input,
.ai-panel.minimized .ai-meta{
  display:none;
}
.ai-messages{
  padding:12px 12px;
  overflow-y: scroll; /* siempre visible en conversaciones largas */
  overflow-x: hidden;
  scrollbar-gutter: stable;
  display:flex;
  flex-direction:column;
  gap:10px;
  min-height: 0; /* importante para scroll en flex */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.ai-msg{
  padding:10px 10px;
  border:1px solid var(--border);
  border-radius:14px;
  background: rgba(255,255,255,.02);
  max-width: 92%;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.ai-msg.me{ background: rgba(124,92,255,.10); border-color: rgba(124,92,255,.22); }
.ai-msg.bot{ align-self:flex-start; }
.ai-msg.me{ align-self:flex-end; }
.ai-msg.system{
  align-self:center;
  max-width: 96%;
  background: rgba(0,0,0,.18);
  border-color: rgba(232,238,252,.12);
}
.ai-msg-role{ font-size:12px; color: var(--muted); margin-bottom:4px; }
.ai-msg-text{ white-space:pre-wrap; }
.ai-msg-text a{ color:inherit; text-decoration:underline; }
.ai-msg-text code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.18);
}
.ai-msg-text pre{
  margin:8px 0 0 0;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.22);
  overflow:auto;
  white-space: pre;
}
.ai-msg-text pre code{
  padding:0;
  border:0;
  background: transparent;
  font-size: 12px;
}
.ai-msg-text ul, .ai-msg-text ol{
  margin:8px 0 0 18px;
  padding:0;
}
.ai-msg-text li{ margin:4px 0; }
.ai-typing{
  display:inline-flex;
  gap:6px;
  align-items:center;
}
.ai-dot{
  width:6px; height:6px;
  border-radius:999px;
  background: var(--muted);
  opacity:.7;
  animation: ai-dot 900ms infinite ease-in-out;
}
.ai-dot:nth-child(2){ animation-delay: 150ms; }
.ai-dot:nth-child(3){ animation-delay: 300ms; }
@keyframes ai-dot{
  0%, 100% { transform: translateY(0); opacity:.55; }
  50% { transform: translateY(-3px); opacity:.95; }
}
.ai-input{
  display:flex;
  gap:10px;
  padding:12px 12px;
  background: transparent;
}
.ai-input textarea{
  flex:1;
  resize: none;
  min-height:44px;
  max-height: 120px;
}
.ai-footer{
  border-top:1px solid var(--border);
  background: rgba(0,0,0,.10);
  padding-bottom: max(0px, env(safe-area-inset-bottom));
  /* Importante: NO usar sticky aquí (puede solapar en algunos navegadores) */
  position: relative;
}
.ai-meta{ padding:0 12px 12px 12px; }

/* Responsive: en móvil se comporta como “bottom sheet” para evitar cortes */
@media (max-width: 520px){
  .ai-panel{
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: 0;
    width: auto;
    border-radius: 18px 18px 0 0;
    max-height: calc(100vh - 12px);
    max-height: calc(100svh - 12px);
    max-height: calc(100dvh - 12px);
    height: calc(100vh - 12px);
    height: calc(100svh - 12px);
    height: calc(100dvh - 12px);
  }
  .ai-fab{
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
  }
}

/* Estilos específicos para la tabla de sitios */
.sites-table-wrap{
  max-width: 100%;
}

.sites-table tbody td{
  vertical-align: middle;
  min-height: 48px;
}

/* Columna Nombre - diseño más compacto */
.site-name-cell{
  min-width: 180px;
  max-width: 280px;
}
.site-name-main{
  font-size: 13px;
  line-height: 1.3;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-name-sub{
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Columna Cliente - diseño más compacto */
.client-cell{
  min-width: 160px;
  max-width: 220px;
}
.client-info{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.client-name{
  font-size: 13px;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Columna Consultor - diseño más compacto */
.consultant-cell{
  min-width: 180px;
  max-width: 240px;
}
.consultant-info{
  display: flex;
  align-items: center;
  gap: 8px;
}
.consultant-avatar{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(232,238,252,.10);
  background: rgba(232,238,252,.06);
  flex-shrink: 0;
}
.consultant-details{
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.consultant-name{
  font-weight: 500;
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.consultant-email{
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Columna Agente - diseño más compacto y horizontal */
.agent-cell{
  min-width: 200px;
  max-width: 280px;
}
.agent-status{
  margin-bottom: 6px;
}
.agent-status-badge{
  display: inline-block;
}
.agent-details{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.agent-detail-item{
  white-space: nowrap;
}
.agent-detail-sep{
  color: var(--muted);
  opacity: 0.5;
}

/* Mejorar consistencia de alturas en filas */
.sites-table tbody tr{
  height: auto;
  min-height: 56px;
}
.sites-table tbody td{
  padding: 10px 12px;
}

/* Grid responsive para sitios */
@media (max-width: 920px){
  .sites-grid.grid.two{
    grid-template-columns: 1fr;
  }
  .sites-grid .card:last-child{
    order: -1;
  }
}

/* Ajustes de ancho del contenedor para pantallas grandes */
@media (min-width: 1400px){
  .container{
    max-width: 1600px;
    padding: 32px 32px;
  }
}

@media (min-width: 1920px){
  .container{
    max-width: 1800px;
    padding: 36px 40px;
  }
}

/* Responsive para tabla de sitios */
@media (max-width: 1400px){
  .sites-table-wrap{
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sites-table{
    min-width: 1000px;
  }
}

@media (max-width: 1200px){
  .sites-table{
    min-width: 900px;
  }
  .client-cell{
    min-width: 140px;
  }
  .consultant-cell{
    min-width: 160px;
  }
  .agent-cell{
    min-width: 180px;
  }
}

@media (max-width: 768px){
  .sites-table{
    min-width: 800px;
    font-size: 13px;
  }
  .sites-table thead th{
    font-size: 12px;
    padding: 8px 10px;
  }
  .sites-table tbody td{
    padding: 8px 10px;
  }
  .consultant-avatar{
    width: 24px;
    height: 24px;
  }
  .consultant-name{
    font-size: 12px;
  }
  .consultant-email{
    font-size: 10px;
  }
  .agent-details{
    font-size: 10px;
  }
  .agent-status-badge{
    font-size: 11px;
    padding: 4px 8px;
  }
}

@media (max-width: 480px){
  .container{
    padding: 20px 16px;
  }
  .sites-table-wrap{
    border-radius: 10px;
    margin-left: -4px;
    margin-right: -4px;
  }
  .sites-table{
    min-width: 700px;
    font-size: 12px;
  }
  .sites-table thead th{
    font-size: 11px;
    padding: 6px 8px;
  }
  .sites-table tbody td{
    padding: 6px 8px;
  }
}

