:root {
  --bg: #000000;
  --card: #1c1c1c;
  --card-2: #232323;
  --gold: #a78754;
  --gold-lt: #bf9862;
  --text: #ffffff;
  --text-2: #cccccc;
  --text-3: #8a8a8a;
  --border: #333333;
  --ok: #4caf7d;
  --warn: #d9a441;
  --bad: #d1615b;
  --sidebar-w: 244px;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* Solo en html: propaga el recorte al viewport y sigue tapando cualquier
   desborde horizontal. Puesto tambien en body lo convertia en contenedor de
   scroll, y eso anula position:sticky de la sidebar y de la topbar. */
html { overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Montserrat", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
select {
  font-family: inherit;
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
}

/* Scrollbars: el default del navegador es claro y corta el tema oscuro en cada
   panel con scroll (lista de conversaciones, hilo, prompt, tablas anchas). */
* { scrollbar-width: thin; scrollbar-color: #3d3d3d transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-corner { background: transparent; }
*::-webkit-scrollbar-button { display: none; }
*::-webkit-scrollbar-thumb {
  background-color: #3d3d3d;
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 20px;
}
*::-webkit-scrollbar-thumb:hover { background-color: #6d5836; }

/* Demo banner */
.demo-banner {
  background: linear-gradient(90deg, rgba(167,135,84,.18), rgba(167,135,84,.05));
  border-bottom: 1px solid var(--border);
  color: var(--gold-lt);
  font-size: 13px;
  letter-spacing: .2px;
  text-align: center;
  padding: 8px 40px 8px 16px;
  position: relative;
}
.demo-banner__close {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--gold-lt); font-size: 20px; line-height: 1;
}

/* Layout */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: #0d0d0d;
  border-right: 1px solid var(--border);
}
/* El fondo lo pinta .sidebar, que como item flex se estira a todo el alto del
   documento: nunca queda un hueco negro debajo. Lo que se fija al viewport es
   el contenido, asi que el pie queda siempre abajo del todo. */
.sidebar__inner {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand__mark {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold), #6f5227);
  font-family: "Bebas Neue", sans-serif; font-size: 26px; color: #000;
}
.brand__text { display: flex; flex-direction: column; }
.brand__name { font-family: "Bebas Neue", sans-serif; font-size: 24px; letter-spacing: 2px; line-height: 1; }
.brand__sub { font-size: 11px; color: var(--text-3); letter-spacing: .5px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav__item {
  display: flex; align-items: center; gap: 12px;
  background: none; border: none; color: var(--text-2);
  text-align: left; padding: 11px 12px; border-radius: 10px;
  font-size: 14.5px; font-weight: 500; transition: all .15s;
}
.nav__item:hover { background: var(--card); color: var(--text); }
.nav__item.is-active { background: rgba(167,135,84,.16); color: var(--gold-lt); }
.nav__ico { width: 18px; text-align: center; opacity: .9; }

.sidebar__foot {
  margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-3); display: flex; flex-direction: column; gap: 8px;
}
.sesion { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sesion__texto { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sesion__quien { color: var(--text); font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sesion__rol { font-size: 11px; color: var(--text-3); text-transform: capitalize; }

/* Cerrar sesion era un "Salir" en letra chica al lado del nombre y se leia como
   una etiqueta mas de la sesion, no como el boton que cierra. */
.foot-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--card); border: 1px solid var(--border); border-radius: 9px;
  color: var(--text-2); padding: 9px 11px; font-size: 12.5px; font-weight: 600;
  text-align: left; transition: all .15s;
}
.foot-btn:hover { background: var(--card-2); color: var(--text); border-color: #454545; }
.foot-btn__ico { font-size: 13px; opacity: .85; }
.foot-btn--salir:hover { border-color: var(--bad); color: var(--bad); background: rgba(209,97,91,.08); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot--ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.sidebar-scrim { display: none; }

/* Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 26px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(0,0,0,.85); backdrop-filter: blur(8px); z-index: 20;
}
.hamburger { display: none; background: none; border: none; color: var(--text); font-size: 22px; }
.topbar__title { font-family: "Bebas Neue", sans-serif; font-size: 30px; letter-spacing: 1.5px; margin: 0; font-weight: 400; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.range { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }

.views { padding: 26px; flex: 1; }
.foot { padding: 18px 26px; color: var(--text-3); font-size: 12px; border-top: 1px solid var(--border); }

/* Generic cards */
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  min-width: 0;
}
.card__title { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-3); margin: 0 0 6px; font-weight: 600; }
.kpi__value { font-family: "Bebas Neue", sans-serif; font-size: 40px; line-height: 1; letter-spacing: 1px; }
.kpi__value .unit { font-size: 18px; color: var(--text-3); }
.kpi__delta { font-size: 12px; margin-top: 6px; }
.kpi__delta.up { color: var(--ok); }
.kpi__delta.down { color: var(--bad); }
.kpi__delta.neutral { color: var(--text-3); }
.kpi__accent { color: var(--gold-lt); }

.section-title {
  font-family: "Bebas Neue", sans-serif; font-size: 22px; letter-spacing: 1px;
  margin: 26px 0 14px; color: var(--text); font-weight: 400;
}
.section-title:first-child { margin-top: 0; }

.two-col { grid-template-columns: 2fr 1fr; }
.chart-wrap { position: relative; height: 260px; max-width: 100%; }
.chart-wrap.sm { height: 200px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-3); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; }
tbody tr:hover { background: var(--card-2); }

/* Lista clave-valor para tarjetas angostas: una tabla de 3 columnas no entra en
   la columna 1fr de .two-col y terminaba cortada, con scroll horizontal. */
.kv { list-style: none; margin: 0; padding: 0; }
.kv__row { padding: 11px 0; border-bottom: 1px solid var(--border); }
.kv__row:last-child { border-bottom: none; padding-bottom: 0; }
.kv__k { display: block; font-size: 13px; color: var(--text-2); }
.kv__v { display: block; margin-top: 7px; }
.kv__note { margin: 6px 0 0; font-size: 12px; color: var(--text-3); }

/* Badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; letter-spacing: .3px; white-space: nowrap; max-width: 100%; }
/* Para badges de texto largo (motivo de escalamiento, desviaciones de auditoria). */
.badge--wrap { white-space: normal; }
.badge--ok { background: rgba(76,175,125,.15); color: var(--ok); }
.badge--warn { background: rgba(217,164,65,.15); color: var(--warn); }
.badge--bad { background: rgba(209,97,91,.15); color: var(--bad); }
.badge--gold { background: rgba(167,135,84,.18); color: var(--gold-lt); }
.badge--muted { background: #2a2a2a; color: var(--text-2); }

/* Heatmap */
.heatmap { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 3px; min-width: 620px; }
.heatmap .hm-corner, .heatmap .hm-hour, .heatmap .hm-day { font-size: 10px; color: var(--text-3); display: flex; align-items: center; justify-content: center; }
.heatmap .hm-hour { padding-bottom: 4px; }
.heatmap .hm-cell { height: 20px; border-radius: 3px; }
.heatmap-legend { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); margin-top: 12px; }
.heatmap-legend .sw { width: 16px; height: 12px; border-radius: 3px; }

/* Mensajes */
.messages { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.conv-list { max-height: 620px; overflow-y: auto; padding-right: 4px; }
.pane-empty { color: var(--text-3); font-size: 13.5px; margin: 4px 2px; }
.conv-filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.conv-filters input, .conv-filters select { flex: 1; min-width: 110px; }
.conv-filters input { background: var(--card-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.conv-item {
  padding: 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px;
  cursor: pointer; transition: all .15s; background: var(--card);
}
.conv-item:hover { border-color: var(--gold); }
.conv-item.is-active { border-color: var(--gold); background: rgba(167,135,84,.08); }
.conv-item__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.conv-item__name { font-weight: 600; font-size: 14px; }
.conv-item__time { font-size: 11px; color: var(--text-3); }
.conv-item__prev { font-size: 12.5px; color: var(--text-3); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.conv-item__meta .badge { padding: 3px 8px; font-size: 11px; overflow: hidden; text-overflow: ellipsis; }

.thread { display: flex; flex-direction: column; gap: 10px; max-height: 620px; overflow-y: auto; padding-right: 6px; }
.thread__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.bubble { max-width: 78%; padding: 10px 13px; border-radius: 14px; font-size: 14px; position: relative; }
.bubble__meta { font-size: 10.5px; color: var(--text-3); margin-top: 5px; display: flex; gap: 8px; }
.bubble.in { align-self: flex-start; background: var(--card-2); border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: rgba(167,135,84,.16); border-bottom-right-radius: 4px; }
.bubble.escal { align-self: center; max-width: 92%; background: rgba(217,164,65,.1); border: 1px dashed var(--warn); color: var(--warn); font-size: 12.5px; text-align: center; }
.lat { font-weight: 600; }
.lat--ok { color: var(--ok); }
.lat--bad { color: var(--bad); }

/* Tickets kanban */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 14px; overflow-x: auto; margin-top: 16px; }
.kanban.is-cargando { opacity: .55; transition: opacity .15s; }
.kanban__col {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; min-height: 220px; transition: border-color .15s, background .15s;
}
.kanban__col.is-over { border-color: var(--gold); background: rgba(167,135,84,.07); }
.kanban__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); font-weight: 600; }
.kanban__count { background: var(--card-2); border-radius: 20px; padding: 1px 8px; font-size: 11px; }
.kanban__zona { min-height: 60px; }
.kanban__vacio { color: #4a4a4a; font-size: 12px; text-align: center; margin: 18px 0; }
.ticket {
  background: var(--card-2); border: 1px solid var(--border); border-left: 3px solid var(--gold);
  border-radius: 9px; padding: 11px; margin-bottom: 10px;
  cursor: pointer; transition: transform .12s, border-color .15s, box-shadow .15s;
}
.ticket:hover { border-color: #4a4a4a; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.ticket:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ticket.is-drag { opacity: .4; }
.ticket--alta { border-left-color: var(--bad); }
.ticket--media { border-left-color: var(--warn); }
.ticket--baja { border-left-color: var(--text-3); }
.ticket__top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ticket__id { font-size: 10.5px; color: var(--text-3); }
.ticket__title { font-size: 13.5px; font-weight: 600; margin: 6px 0 10px; white-space: normal; line-height: 1.35; }
.ticket__foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.tk-chip {
  font-size: 10.5px; font-weight: 600; letter-spacing: .3px;
  background: #2a2a2a; color: var(--text-3);
  border-radius: 6px; padding: 2px 7px; white-space: nowrap;
}
.tk-chip--bug { background: rgba(209,97,91,.14); color: var(--bad); }
.tk-chip--mejora { background: rgba(217,164,65,.14); color: var(--warn); }
.tk-chip--funcionalidad { background: rgba(76,175,125,.14); color: var(--ok); }
.tk-chip--run { background: rgba(167,135,84,.16); color: var(--gold-lt); }

/* Iniciales del asignado: en una tarjeta angosta un nombre completo se come la
   fila y no hay espacio para el tipo ni el run. */
.avatar {
  flex: 0 0 auto; margin-left: auto;
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: linear-gradient(135deg, var(--gold), #6f5227); color: #000;
  font-size: 10px; font-weight: 700; letter-spacing: .3px;
}
.avatar--vacio { background: #2f2f2f; color: var(--text-3); }

.btn {
  background: var(--gold); color: #000; border: none; border-radius: 9px;
  padding: 9px 16px; font-weight: 600; font-size: 13.5px;
}
.btn:hover { background: var(--gold-lt); }
.btn--ghost { background: transparent; color: var(--gold-lt); border: 1px solid var(--border); }
/* Para el boton que confirma algo que no se puede deshacer. */
.btn--peligro { background: var(--bad); color: #fff; }
.btn--peligro:hover { background: #e0736d; }

/* Audit detail */
.audit-detail { display: none; margin-top: 16px; }
.audit-detail.open { display: block; }
/* La etiqueta manda el ancho: con 120px fijos, "Latencia mediana" se partia en
   dos lineas y su valor dejaba de alinear con ella. max-content mide la mas
   larga de la lista y todas quedan en una linea. */
.trace { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 8px 16px; font-size: 13.5px; }
.trace dt { white-space: nowrap; }
.trace dt { color: var(--text-3); }
.trace dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.trace code { background: #000; padding: 2px 6px; border-radius: 5px; font-size: 12px; color: var(--gold-lt); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

.link { color: var(--gold-lt); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* Prompt del agente */
.prompt-body {
  background: #000; border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; margin-top: 10px; max-height: 460px; overflow-y: auto;
}
.prompt-sec + .prompt-sec { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.prompt-sec__t { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--gold-lt); font-weight: 600; }
.prompt-sec__l { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13.5px; line-height: 1.65; }
.prompt-sec__l li + li { margin-top: 4px; }
.prompt-draft { border-left: 3px solid var(--gold); }
.prompt-body.is-editing { max-height: 560px; }

/* Edicion del prompt */
.campo {
  width: 100%; background: var(--card-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-family: inherit; font-size: 13.5px;
}
.campo:focus { outline: none; border-color: var(--gold); }
.campo--mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.campo--titulo { font-weight: 600; color: var(--gold-lt); }
.campo--cuerpo { line-height: 1.6; resize: vertical; min-height: 78px; }
.prompt-sec__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.prompt-sec__del {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px;
  background: none; border: 1px solid var(--border); color: var(--text-3);
  font-size: 18px; line-height: 1;
}
.prompt-sec__del:hover { border-color: var(--bad); color: var(--bad); }
.prompt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.prompt-stamp { font-size: 12px; color: var(--text-3); }

.alert-config { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.alert-config input[type=number] { width: 110px; background: var(--card-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }

/* Responsive */
@media (max-width: 1000px) {
  .two-col { grid-template-columns: 1fr; }
  .messages { grid-template-columns: 1fr; }
  .conv-list { max-height: 340px; }
  .thread { max-height: 65vh; }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; z-index: 60;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .sidebar__inner { position: static; height: 100%; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 55; }
  .hamburger { display: block; }
  .views { padding: 18px 14px; }
  .topbar { padding: 14px 16px; }
  .topbar__title { font-size: 24px; }
  .kpi__value { font-size: 34px; }
}
@media (max-width: 520px) {
  .topbar__actions .range { font-size: 0; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}


/* [hidden] tiene que ganarle a los display de abajo. */
[hidden] { display: none !important; }

/* Pantalla de acceso */
.acceso { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.acceso__caja {
  width: 100%; max-width: 360px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.acceso__caja .brand { margin-bottom: 6px; }
.campo-bloque { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-3); }
.campo-bloque input, .campo-bloque select, .campo-bloque textarea {
  width: 100%;
  background: var(--card-2); color: var(--text); font-family: inherit; font-size: 14px;
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
}
.campo-bloque textarea { resize: vertical; line-height: 1.5; }
.campo-bloque input:focus, .campo-bloque select:focus, .campo-bloque textarea:focus { outline: none; border-color: var(--gold); }
.acceso__error {
  margin: 0; font-size: 12.5px; color: var(--bad);
  background: rgba(209,97,91,.1); border: 1px solid rgba(209,97,91,.35);
  border-radius: 8px; padding: 8px 10px;
}
.acceso__ok {
  margin: 0; font-size: 12.5px; color: var(--ok);
  background: rgba(76,175,125,.1); border: 1px solid rgba(76,175,125,.35);
  border-radius: 8px; padding: 8px 10px;
}
.acceso__hola { margin: 0 0 4px; font-size: 14px; color: var(--text-2); }
.acceso__mini { background: none; border: none; font-size: 12.5px; text-align: center; padding: 0; }
#invitacionCuerpo { display: flex; flex-direction: column; gap: 14px; }

/* Esqueleto mientras carga: ocupa el lugar del contenido para que no salte. */
.carga { overflow: hidden; }
.carga .barra {
  height: 14px; border-radius: 6px; margin-bottom: 10px;
  background: linear-gradient(90deg, #202020, #2b2b2b, #202020);
  background-size: 200% 100%; animation: brillo 1.2s linear infinite;
}
.carga .barra--alta { height: 34px; width: 60%; margin-bottom: 0; }
@keyframes brillo { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .carga .barra { animation: none; } }

.error-panel { border-left: 3px solid var(--bad); }
.error-panel p { margin: 6px 0 12px; font-size: 13.5px; }

/* Avisos efimeros */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 90; max-width: min(92vw, 460px);
  background: var(--card-2); border: 1px solid var(--border); border-left-width: 3px;
  border-radius: 10px; padding: 11px 16px; font-size: 13.5px; box-shadow: var(--shadow);
}
.toast--ok { border-left-color: var(--ok); }
.toast--bad { border-left-color: var(--bad); }

/* Traza abierta desde un turno del hilo */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.7); display: grid; place-items: center; padding: 20px; }
.modal__caja { width: 100%; max-width: 720px; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal__caja--ancha { max-width: 940px; }
/* Dentro de un modal las tarjetas no se estiran a la altura de la vecina: una
   tarjeta vacia al lado de una llena quedaba como un hueco enorme. */
.modal .two-col { align-items: start; }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal__head-txt { min-width: 0; }
.modal__t { font-family: "Bebas Neue", sans-serif; font-size: 24px; letter-spacing: 1px; margin: 0; font-weight: 400; }
.modal__sub { margin: 6px 0 0; font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.modal__x {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px;
  background: none; border: 1px solid var(--border); color: var(--text-3); font-size: 20px; line-height: 1;
}
.modal__x:hover { border-color: var(--bad); color: var(--bad); }
.modal__acciones { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.modal__acciones--izq { justify-content: flex-start; }
.modal__nota { font-size: 12px; color: var(--text-3); margin: 12px 0 0; }

/* Formularios de modal y de la vista de equipo */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid--inline { grid-template-columns: 1.4fr 1.2fr .9fr auto; align-items: end; }
.campo-bloque--full { grid-column: 1 / -1; }
.campo--chico { padding: 5px 8px; font-size: 12.5px; }

/* Vistas */
.vista-intro { color: var(--text-3); margin: 0 0 16px; font-size: 13px; max-width: 78ch; }
.tk-nota { display: block; margin-top: 12px; }
.banner { border-radius: 10px; padding: 11px 14px; font-size: 13px; border: 1px solid var(--border); }
.banner--ok { background: rgba(76,175,125,.08); border-color: rgba(76,175,125,.35); color: var(--ok); }
.banner--warn { background: rgba(217,164,65,.08); border-color: rgba(217,164,65,.35); color: var(--warn); }

.tk-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.tk-filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1; min-width: 240px; }
.tk-filtros input {
  flex: 1; min-width: 200px;
  background: var(--card-2); color: var(--text); font-family: inherit; font-size: 13.5px;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px;
}
.tk-filtros input:focus { outline: none; border-color: var(--gold); }

/* Detalle de un ticket */
.tk-det { display: grid; grid-template-columns: 1fr 260px; gap: 20px; align-items: start; }
.tk-det__col { min-width: 0; }
.tk-det__col--lado { background: #141414; border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.tk-det__titulo { font-size: 17px; margin: 0 0 8px; line-height: 1.35; }
.tk-det__desc { font-size: 13.5px; color: var(--text-2); margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tk-det__controles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px;
  margin: 16px 0; padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.tk-det__meta { grid-template-columns: 1fr; gap: 2px; font-size: 12.5px; }
.tk-det__meta dt { margin-top: 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.tk-det__meta dt:first-child { margin-top: 0; }

.tk-com__item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.tk-com__head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.tk-com__head .avatar { margin-left: 0; }
.tk-com__cuerpo { margin: 6px 0 0 32px; font-size: 13.5px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.tk-com__nuevo { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; }
.tk-com__nuevo textarea { flex: 1; resize: vertical; }

/* Equipo */
.usr { display: flex; align-items: center; gap: 10px; }
.usr .avatar { margin-left: 0; width: 30px; height: 30px; font-size: 11px; }
.acciones { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Acciones dentro de una tabla: cada una en su propia columna.
   Con dos enlaces en la misma celda, "Desactivar" y "Reactivar" miden distinto
   y el "Eliminar" de al lado cae en una x diferente en cada fila. En columnas
   separadas los alinea el navegador, que para eso es una tabla.
   width:1% hace que la columna se ajuste a su contenido en vez de estirarse,
   y el sobrante se lo quedan las columnas de datos. */
td.acciones, th.acciones {
  display: table-cell;
  width: 1%;
  white-space: nowrap;
  text-align: right;
}
.link--bad { color: var(--bad); }
button.link { background: none; border: none; padding: 0; font-size: inherit; font-family: inherit; }
button.link:disabled { opacity: .5; cursor: default; text-decoration: none; }
.enlace-caja { margin-top: 14px; padding: 12px; background: #000; border: 1px dashed var(--gold); border-radius: 10px; }
.enlace-caja__fila { display: flex; gap: 8px; margin-top: 8px; }
.enlace-caja__fila input { flex: 1; min-width: 0; }
.enlace-caja__fila .btn { flex: 0 0 auto; }

@media (max-width: 1100px) {
  .tk-det { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .form-grid, .form-grid--inline { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(5, 78vw); }
  .modal { padding: 10px; }
  .modal__caja { max-height: 92vh; }
}
