@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700;800;900&family=Geist+Mono:wght@400;500;600&display=swap');

:root {
  /* ── Tipografía Oficial ── */
  --ui-font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ui-font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* ── Paleta Dark Mode (Obsidian / Zinc-950) ── */
  --ui-bg: #09090b;                         /* Obsidian profundo */
  --ui-page-bg: #09090b;                    /* Fondo exterior de aplicación */
  --ui-surface: #121318;                    /* Tarjetas y superficies oscuras */
  --ui-surface-2: #16171d;                  /* Headers de tablas, dropdowns, inputs */
  --ui-surface-hover: #191a23;              /* Hover en filas y elementos */
  --ui-text: #f4f4f5;                       /* Texto principal blanco/off-white */
  --ui-text-muted: #a1a1aa;                 /* Texto secundario gris neutro */
  --ui-text-subtle: #94949e;                /* Texto terciario / placeholders */

  /* Botón primario: Pastilla blanca pura sólida con texto negro */
  --ui-primary: #ffffff;                    /* Botón primario: Blanco puro */
  --ui-on-primary: #09090b;                 /* Texto sobre primario: Obsidian */
  --ui-primary-hover: #e4e4e7;              /* Hover primario */

  --ui-muted: #18181b;                      /* Fondos sutiles, tracks de tabs, hover */
  --ui-border: #27272a;                     /* Bordes neutros de 1px */
  --ui-border-subtle: #1c1d24;              /* Bordes sutiles entre filas */
  --ui-ring: #3b82f6;                       /* Anillo de foco */

  --ui-danger: #ef4444;                     /* Rojo destructivo */
  --ui-danger-subtle: rgba(239, 68, 68, 0.12);
  --ui-danger-border: rgba(239, 68, 68, 0.28);
  --ui-danger-text: #f87171;

  /* ── Sidebar ── */
  --ui-sidebar-bg: #090a0f;                 /* Sidebar oscuro */
  --ui-sidebar-fg: #f4f4f5;                 /* Texto sidebar */
  --ui-sidebar-accent: #18181b;             /* Hover en sidebar */
  --ui-sidebar-border: #1f212a;             /* Borde divisor derecho */
  --ui-sidebar-active-bg: #181922;          /* Item activo en sidebar */
  --ui-sidebar-active-border: #27272a;      /* Borde item activo */

  /* ── Badges Semánticos Dark Mode ── */
  --ui-badge-blue-bg: rgba(59, 130, 246, 0.12);
  --ui-badge-blue-border: rgba(59, 130, 246, 0.28);
  --ui-badge-blue-text: #60a5fa;

  --ui-badge-violet-bg: rgba(168, 85, 247, 0.12);
  --ui-badge-violet-border: rgba(168, 85, 247, 0.28);
  --ui-badge-violet-text: #c084fc;

  --ui-badge-green-bg: rgba(34, 197, 94, 0.12);
  --ui-badge-green-border: rgba(34, 197, 94, 0.28);
  --ui-badge-green-text: #4ade80;

  --ui-badge-amber-bg: rgba(245, 158, 11, 0.12);
  --ui-badge-amber-border: rgba(245, 158, 11, 0.28);
  --ui-badge-amber-text: #fbbf24;

  --ui-badge-red-bg: rgba(239, 68, 68, 0.12);
  --ui-badge-red-border: rgba(239, 68, 68, 0.28);
  --ui-badge-red-text: #f87171;

  --ui-badge-gray-bg: rgba(113, 113, 122, 0.12);
  --ui-badge-gray-border: rgba(113, 113, 122, 0.28);
  --ui-badge-gray-text: #a1a1aa;

  /* ── Skeleton Loader (Limpio, sin bordes, transparencias del tema) ── */
  --skeleton-bg: rgba(255, 255, 255, 0.038);
  --skeleton-shimmer: rgba(255, 255, 255, 0.075);
  --skeleton-card-bg: rgba(255, 255, 255, 0.025);
  --skeleton-border: transparent;

  /* ── Geometría y Escalas ── */
  --ui-radius-sm: 8px;
  --ui-radius-control: 10px;
  --ui-radius-surface: 14px;
  --ui-radius-pill: 9999px;

  --ui-space-1: 4px;
  --ui-space-2: 8px;
  --ui-space-3: 12px;
  --ui-space-4: 16px;
  --ui-space-5: 20px;
  --ui-space-6: 24px;
  --ui-space-8: 32px;

  --ui-control-h: 32px;
  --ui-header-h: 56px;
  --ui-sidebar-w: 256px;
  --ui-sidebar-collapsed-w: 64px;

  /* ── Transiciones ── */
  --ui-ease: cubic-bezier(.4, 0, .2, 1);
  --ui-duration-fast: 100ms;
  --ui-duration-base: 150ms;
  --ui-duration-layout: 200ms;

  /* ── Sombras ── */
  --ui-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --ui-shadow-md: 0 4px 8px rgba(0, 0, 0, 0.5);
  --ui-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.6);

  /* ── Capas Z-Index ── */
  --ui-z-header: 20;
  --ui-z-dropdown: 40;
  --ui-z-overlay: 50;
  --ui-z-dialog: 60;
  --ui-z-toast: 70;
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESET & BASE GLOBALES
   ══════════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--ui-page-bg);
  color: var(--ui-text);
  font-family: var(--ui-font);
  font-size: 14px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbars Oscuros Transparentes */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #27272a; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3f3f46; }

/* ══════════════════════════════════════════════════════════════════════════════
   SISTEMA DE BOTONES (.ui-button)
   ══════════════════════════════════════════════════════════════════════════════ */

.ui-button,
button.btn-primary,
button.btn-secondary,
a.btn-primary,
a.btn-secondary {
  min-height: var(--ui-control-h);
  height: var(--ui-control-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius-control);
  font-family: var(--ui-font);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all var(--ui-duration-base) var(--ui-ease);
}

.ui-button:focus-visible {
  outline: none;
  border-color: var(--ui-ring);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

.ui-button:disabled,
.ui-button[disabled] {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.ui-button:not(:disabled):not([aria-haspopup]):active {
  transform: translateY(1px);
}

/* 1. Primario: White Pill Button (+ Create / + Nuevo Ticket) */
body .ui-button--primary,
body button.btn-primary,
body a.btn-primary {
  background: #ffffff;
  color: #09090b;
  border-color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  font-weight: 600;
}
body .ui-button--primary:hover,
body button.btn-primary:hover,
body a.btn-primary:hover {
  background: #e4e4e7;
  border-color: #e4e4e7;
  color: #09090b;
}

/* 2. Secundario / Outline: Superficie oscura con borde 1px */
body .ui-button--outline,
body .ui-button--secondary,
body button.btn-secondary,
body a.btn-secondary {
  background: #18181b;
  border-color: var(--ui-border);
  color: #f4f4f5;
  box-shadow: var(--ui-shadow-sm);
}
body .ui-button--outline:hover,
body .ui-button--secondary:hover,
body button.btn-secondary:hover,
body a.btn-secondary:hover {
  background: #27272a;
  border-color: #3f3f46;
  color: #ffffff;
}

/* 3. Terciario / Ghost */
body .ui-button--ghost {
  background: transparent;
  border-color: transparent;
  color: #a1a1aa;
}
body .ui-button--ghost:hover {
  background: #18181b;
  color: #ffffff;
}

/* 4. Destructivo */
body .ui-button--destructive,
body button.btn-danger,
body a.btn-danger {
  background: var(--ui-danger);
  color: #ffffff;
  border-color: var(--ui-danger);
}
body .ui-button--destructive:hover,
body button.btn-danger:hover,
body a.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* 5. Pastilla Global */
body .ui-button--pill {
  height: 32px;
  min-height: 32px;
  border-radius: var(--ui-radius-pill);
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 600;
}

/* 6. Icon Button (32px x 32px) */
body .ui-button--icon {
  width: var(--ui-control-h);
  height: var(--ui-control-h);
  padding: 0;
  border-radius: var(--ui-radius-control);
}

/* 7. Pequeño (28px) */
body .ui-button--sm {
  height: 28px;
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--ui-radius-sm);
}

/* ══════════════════════════════════════════════════════════════════════════════
   INPUTS, SELECTS Y FORMULARIOS (.ui-input, .ui-select, .ui-textarea)
   ══════════════════════════════════════════════════════════════════════════════ */

/* Base con especificidad (0,0,1) para ganar a Preflight sin pisar utilidades Tailwind (.pl-9, .px-3, .h-8, etc.) */
input:where(:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not(.login-input)),
select:where(:not(.login-input)),
textarea:where(:not(.login-input)) {
  font-family: var(--ui-font);
  font-size: 13.5px;
  line-height: 20px;
  color: var(--ui-text);
  background-color: var(--ui-surface-2);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-control);
  padding: 5px 12px;
  transition: border-color var(--ui-duration-base) var(--ui-ease),
              box-shadow var(--ui-duration-base) var(--ui-ease);
}

input:where(:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not(.login-input)),
select:where(:not(.login-input)) {
  height: var(--ui-control-h);
  min-height: var(--ui-control-h);
}

.ui-input,
.ui-select,
.ui-textarea {
  font-family: var(--ui-font);
  font-size: 13.5px;
  line-height: 20px;
  color: var(--ui-text);
  background-color: var(--ui-surface-2);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-control);
  transition: border-color var(--ui-duration-base) var(--ui-ease),
              box-shadow var(--ui-duration-base) var(--ui-ease);
}

:where(.ui-input, .ui-select) {
  height: var(--ui-control-h);
  min-height: var(--ui-control-h);
  padding: 5px 12px;
}

/* Inputs con icono a la izquierda */
.has-icon-left,
input.has-icon-left,
body input.pl-8,
body input.pl-9 {
  padding-left: 36px;
}

body input.pl-10,
body input.pl-11,
body input.pl-12 {
  padding-left: 42px;
}

.ui-textarea,
textarea:where(:not(.login-input)) {
  width: 100%;
  display: block;
  min-height: 84px;
}

input:where(:not(.login-input))::placeholder,
textarea:where(:not(.login-input))::placeholder {
  color: var(--ui-text-subtle);
}

.ui-input:focus,
.ui-select:focus,
.ui-textarea:focus,
input:where(:not([type="checkbox"]):not([type="radio"]):not(.login-input)):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ui-ring);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.ui-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ui-text);
  margin-bottom: 5px;
}

.ui-label .required-star {
  color: var(--ui-danger);
  margin-left: 2px;
}

.ui-help {
  font-size: 12px;
  color: var(--ui-text-muted);
  margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   SUPERFICIES, TARJETAS Y CONTENEDORES (.ui-card, .ui-surface)
   ══════════════════════════════════════════════════════════════════════════════ */

:where(.ui-surface, .ui-card, .glass-card) {
  background-color: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-surface);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.ui-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--ui-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ui-card-content {
  padding: 20px;
}

.ui-card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--ui-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Tarjeta Métrica Genérica (Reportes / Informes, mismo diseño minimalista sin marco) */
:where(.ui-metric-card) {
  background-color: transparent;
  border-top: none;
  border-right: none;
  border-bottom: none;
  border-left: 3px solid #3b82f6;
  border-radius: 0;
  padding: 4px 12px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2px;
  transition: background-color 0.15s ease;
}

.ui-metric-card:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

/* ── Componente KPI Minimalista y Filtrable (Solo borde izquierdo recto con color, sin marco ni relleno) ── */
.kpi-card {
  position: relative;
  background-color: transparent;
  border-top: none;
  border-right: none;
  border-bottom: none;
  border-left: 3.5px solid #3b82f6;
  border-radius: 0;
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 3px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  min-width: 0;
  box-shadow: none;
  outline: none;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.kpi-card:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

div.kpi-card:not([onclick]) {
  cursor: default;
}

div.kpi-card:not([onclick]):hover {
  background-color: transparent;
}

.kpi-card:focus,
.kpi-card:focus-visible,
.kpi-card:active {
  outline: none;
  box-shadow: none;
}

.kpi-card.is-active {
  background-color: rgba(255, 255, 255, 0.045);
}

.kpi-card .kpi-label,
.kpi-card > span:first-child {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.kpi-card .kpi-value,
.kpi-card h3 {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  color: #ffffff;
  font-family: var(--ui-font);
  margin: 0;
}

.kpi-card--blue { border-left-color: #3b82f6; }
.kpi-card--blue .kpi-label { color: #60a5fa; }

.kpi-card--sky { border-left-color: #38bdf8; }
.kpi-card--sky .kpi-label { color: #38bdf8; }

.kpi-card--purple { border-left-color: #a855f7; }
.kpi-card--purple .kpi-label { color: #c084fc; }

.kpi-card--amber { border-left-color: #f59e0b; }
.kpi-card--amber .kpi-label { color: #fbbf24; }

.kpi-card--orange { border-left-color: #f97316; }
.kpi-card--orange .kpi-label { color: #fb923c; }

.kpi-card--emerald { border-left-color: #10b981; }
.kpi-card--emerald .kpi-label { color: #34d399; }

.kpi-card--rose { border-left-color: #f43f5e; }
.kpi-card--rose .kpi-label { color: #fb7185; }

.kpi-card--slate { border-left-color: #64748b; }
.kpi-card--slate .kpi-label { color: #94a3b8; }

/* ══════════════════════════════════════════════════════════════════════════════
   BADGES Y ESTADOS SEMÁNTICOS (.ui-badge)
   ══════════════════════════════════════════════════════════════════════════════ */

.ui-badge,
.badge-encapsulated {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 22px;
  min-height: 22px;
  padding: 0 9px;
  border-radius: var(--ui-radius-sm);
  border: 1px solid transparent;
  font-family: var(--ui-font);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
}

body .ui-badge--blue,
body .badge-nuevo {
  background-color: var(--ui-badge-blue-bg);
  border-color: var(--ui-badge-blue-border);
  color: var(--ui-badge-blue-text);
}

body .ui-badge--violet,
body .ui-badge--purple,
body .badge-en_curso,
body .badge-en_proceso {
  background-color: var(--ui-badge-violet-bg);
  border-color: var(--ui-badge-violet-border);
  color: var(--ui-badge-violet-text);
}

body .ui-badge--green,
body .badge-resuelto {
  background-color: var(--ui-badge-green-bg);
  border-color: var(--ui-badge-green-border);
  color: var(--ui-badge-green-text);
}

body .ui-badge--amber,
body .badge-esperando_cliente {
  background-color: var(--ui-badge-amber-bg);
  border-color: var(--ui-badge-amber-border);
  color: var(--ui-badge-amber-text);
}

body .ui-badge--red,
body .badge-sla-vencido {
  background-color: var(--ui-badge-red-bg);
  border-color: var(--ui-badge-red-border);
  color: var(--ui-badge-red-text);
}

body .ui-badge--gray {
  background-color: var(--ui-badge-gray-bg);
  border-color: var(--ui-badge-gray-border);
  color: var(--ui-badge-gray-text);
}

/* ══════════════════════════════════════════════════════════════════════════════
   TABLAS DE DATOS (.ui-table)
   ══════════════════════════════════════════════════════════════════════════════ */

.ui-table,
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--ui-font);
  font-size: 13.5px;
  text-align: left;
}

body .ui-table thead th,
body table thead th {
  background-color: var(--ui-surface-2);
  color: var(--ui-text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--ui-border);
  white-space: nowrap;
}

:where(.ui-table thead th, table thead th) {
  padding: 10px 16px;
}

body .ui-table tbody tr,
body table tbody tr {
  border-bottom: 1px solid var(--ui-border-subtle);
  transition: background-color var(--ui-duration-base) var(--ui-ease);
  background-color: transparent;
}

body .ui-table tbody tr:hover,
body table tbody tr:hover {
  background-color: var(--ui-surface-hover);
}

:where(.ui-table tbody td, table tbody td) {
  padding: 10px 14px;
}

.ui-table tbody td,
table tbody td {
  color: var(--ui-text);
  border-bottom: 1px solid var(--ui-border-subtle);
  vertical-align: middle;
}

/* Toolbar de Tabla */
.ui-table-toolbar {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--ui-border);
  flex-wrap: wrap;
}

/* Paginación */
.ui-pagination {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--ui-border);
  font-size: 13px;
  color: var(--ui-text-muted);
}

/* ══════════════════════════════════════════════════════════════════════════════
   SHELL GLOBAL (APPSHELL & SIDEBAR UNIFICADO)
   ══════════════════════════════════════════════════════════════════════════════ */

.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background-color: var(--ui-page-bg);
}

/* Sidebar lateral (Sticky 256px) */
.app-layout .sidebar {
  width: var(--ui-sidebar-w);
  min-width: var(--ui-sidebar-w);
  background-color: var(--ui-sidebar-bg);
  border-right: 1px solid var(--ui-sidebar-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 30;
  flex-shrink: 0;
  overflow-x: hidden;
  transition: width var(--ui-duration-layout) var(--ui-ease),
              min-width var(--ui-duration-layout) var(--ui-ease);
}

.app-layout .sidebar.is-collapsed,
.app-layout .sidebar.collapsed {
  width: var(--ui-sidebar-collapsed-w);
  min-width: var(--ui-sidebar-collapsed-w);
}

.app-layout .sidebar.is-collapsed .nav-text,
.app-layout .sidebar.collapsed .nav-text,
.app-layout .sidebar.is-collapsed .sidebar-header-text,
.app-layout .sidebar.collapsed .sidebar-header-text,
.app-layout .sidebar.is-collapsed .sidebar-footer-text,
.app-layout .sidebar.collapsed .sidebar-footer-text,
.app-layout .sidebar.is-collapsed #adminTreeSubmenu,
.app-layout .sidebar.collapsed #adminTreeSubmenu,
.app-layout .sidebar.is-collapsed #adminTreeChevron,
.app-layout .sidebar.collapsed #adminTreeChevron {
  display: none;
}

/* Sidebar Brand Header & Logo */
.sidebar-header-brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.brand-link {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.app-layout .sidebar-logo-expanded {
  display: block;
  height: 60px;
  max-height: 60px;
  width: auto;
  max-width: 175px;
  object-fit: contain;
  margin: 0 auto;
  transition: opacity 0.15s ease;
}

.app-layout #sidebarLogoDiamond,
.app-layout .sidebar-logo-collapsed {
  display: none;
  height: 32px;
  max-height: 32px;
  width: auto;
  max-width: 32px;
  object-fit: contain;
  margin: 0 auto;
  transition: opacity 0.15s ease;
}

.sidebar .collapse-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}

.app-layout .sidebar.is-collapsed .sidebar-header-brand,
.app-layout .sidebar.collapsed .sidebar-header-brand {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-left: 0;
  padding-right: 0;
}

.app-layout .sidebar.is-collapsed .brand-link,
.app-layout .sidebar.collapsed .brand-link {
  justify-content: center;
  width: 100%;
  margin: 0 auto;
}

.app-layout .sidebar.is-collapsed #sidebarLogo,
.app-layout .sidebar.collapsed #sidebarLogo,
.app-layout .sidebar.is-collapsed .sidebar-logo-expanded,
.app-layout .sidebar.collapsed .sidebar-logo-expanded {
  display: none;
}

.app-layout .sidebar.is-collapsed #sidebarLogoDiamond,
.app-layout .sidebar.collapsed #sidebarLogoDiamond,
.app-layout .sidebar.is-collapsed .sidebar-logo-collapsed,
.app-layout .sidebar.collapsed .sidebar-logo-collapsed {
  display: block;
  height: 32px;
  max-height: 32px;
  width: auto;
  max-width: 32px;
  margin: 0 auto;
}

.app-layout .sidebar.is-collapsed .collapse-btn,
.app-layout .sidebar.collapsed .collapse-btn {
  position: static;
  transform: none;
  margin: 4px auto 0;
  padding: 4px;
}

/* ── Table Layout: Ajuste de columnas al texto y expansión del título ── */
.table-col-shrink {
  width: 1%;
  white-space: nowrap;
}

.table-col-expand {
  width: 100%;
  min-width: 240px;
}

.app-layout .sidebar.is-collapsed .nav-item,
.app-layout .sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 8px 0;
}

.app-layout .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--ui-radius-sm);
  color: var(--ui-text-muted);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all var(--ui-duration-base) var(--ui-ease);
}

.app-layout .nav-item:hover {
  background-color: var(--ui-sidebar-accent);
  color: #ffffff;
}

.app-layout .nav-item.active {
  background-color: var(--ui-sidebar-active-bg);
  color: #ffffff;
  border-color: var(--ui-sidebar-active-border);
  border-left: 3px solid var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  font-weight: 600;
}

/* Contenedor Principal: Ocupa exactamente todo el ancho sobrante */
.app-main-wrapper {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  width: calc(100% - var(--ui-sidebar-w));
  min-height: 100vh;
  background-color: var(--ui-page-bg);
}

.sidebar.is-collapsed + .app-main-wrapper,
.sidebar.collapsed + .app-main-wrapper {
  width: calc(100% - var(--ui-sidebar-collapsed-w));
}

.app-layout.no-sidebar .app-main-wrapper {
  width: 100%;
}

/* Header Topbar (56px de alto, sticky) */
.app-layout .app-header {
  height: var(--ui-header-h);
  min-height: var(--ui-header-h);
  background-color: var(--ui-bg);
  border-bottom: 1px solid var(--ui-border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: var(--ui-z-header);
  width: 100%;
  box-sizing: border-box;
}

/* Área de Contenido Principal (Full width) */
.app-layout .main-content {
  position: relative;
  flex: 1 1 0%;
  width: 100%;
  margin-left: 0;
  padding: 20px 24px;
  background-color: var(--ui-page-bg);
  min-width: 0;
  min-height: calc(100vh - 60px);
  box-sizing: border-box;
}

/* ══════════════════════════════════════════════════════════════════════════════
   PUENTE UNIVERSAL DE COMPATIBILIDAD -> DARK MODE (Por especificidad `body ...`)
   ══════════════════════════════════════════════════════════════════════════════ */

body :where(
  .bg-slate-950,
  .bg-slate-900,
  .bg-slate-900\/80,
  .bg-slate-900\/90,
  .bg-slate-900\/50,
  .bg-slate-950\/60,
  .bg-slate-950\/80,
  .bg-slate-950\/90,
  .bg-indigo-950\/40,
  .bg-indigo-950\/30
) {
  background-color: var(--ui-surface);
  color: var(--ui-text);
  border-color: var(--ui-border);
}

body .ui-surface.bg-white,
body .table-container.bg-white {
  background-color: var(--ui-surface);
}

body :where(
  .border-zinc-200,
  .border-zinc-200\/90,
  .border-zinc-200\/80,
  .border-slate-800,
  .border-slate-700
) {
  border-color: var(--ui-border);
}

body .text-zinc-900 { color: #ffffff; }
body .text-zinc-800 { color: #f4f4f5; }
body .text-zinc-700 { color: #e4e4e7; }
body .text-zinc-600 { color: #a1a1aa; }
body .text-zinc-500, body .text-slate-500 { color: #94949e; }

body .bg-zinc-100,
body .bg-zinc-50 {
  background-color: var(--ui-surface-2);
}

#nt_modal_card,
#imageViewerModal .bg-slate-900,
body .modal-dialog-content {
  background-color: var(--ui-surface);
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
  box-shadow: var(--ui-shadow-lg);
}

body .bg-emerald-50,
body .bg-emerald-100 {
  background-color: var(--ui-badge-green-bg);
  border-color: var(--ui-badge-green-border);
  color: var(--ui-badge-green-text);
}
body .bg-emerald-50 *,
body .bg-emerald-100 * {
  color: inherit;
}

body .bg-amber-50,
body .bg-amber-100,
body .bg-yellow-50 {
  background-color: var(--ui-badge-amber-bg);
  border-color: var(--ui-badge-amber-border);
  color: var(--ui-badge-amber-text);
}
body .bg-amber-50 *,
body .bg-amber-100 *,
body .bg-yellow-50 * {
  color: inherit;
}

body .bg-red-50,
body .bg-red-100,
body .bg-rose-50 {
  background-color: var(--ui-danger-subtle);
  border-color: var(--ui-danger-border);
  color: var(--ui-danger-text);
}
body .bg-red-50 *,
body .bg-red-100 *,
body .bg-rose-50 * {
  color: inherit;
}

body .bg-blue-50,
body .bg-blue-100,
body .bg-sky-50 {
  background-color: var(--ui-badge-blue-bg);
  border-color: var(--ui-badge-blue-border);
  color: var(--ui-badge-blue-text);
}
body .bg-blue-50 *,
body .bg-blue-100 *,
body .bg-sky-50 * {
  color: inherit;
}

body .divide-zinc-200 > :not([hidden]) ~ :not([hidden]),
body .divide-zinc-200\/80 > :not([hidden]) ~ :not([hidden]),
body .divide-zinc-200\/60 > :not([hidden]) ~ :not([hidden]) {
  border-color: var(--ui-border-subtle);
}

/* Asegurar que las notificaciones toast se sitúen por encima de modales */
#toastContainer {
  z-index: 99999;
}

/* ══════════════════════════════════════════════════════════════════════════════
   SKELETON LOADER DESIGN SYSTEM (Kevin Mehta / UX Design CSS Pattern)
   Adaptado a la paleta Dark Obsidian / EVA Technology
   https://uxdesign.cc/using-css-design-a-simple-skeleton-loader-57d884cd3547
   ══════════════════════════════════════════════════════════════════════════════ */

/* Shimmer Keyframes: Desplaza el haz de luz uniformemente de izquierda a derecha */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

@keyframes ui-skeleton-shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

/* Base Skeleton Loader (.skeleton y alias compatible .ui-skeleton-shimmer) */
.skeleton,
.ui-skeleton-shimmer {
  background-color: var(--skeleton-bg, rgba(255, 255, 255, 0.038));
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    var(--skeleton-shimmer, rgba(255, 255, 255, 0.075)) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-repeat: no-repeat;
  background-size: 200px 100%;
  position: relative;
  overflow: hidden;
  border: none !important;
  box-shadow: none !important;
  border-radius: 8px;
  animation: shimmer 1.5s infinite linear;
}

/* Bloque contenedor o figura base */
.skeleton-box,
.ui-skeleton-box {
  background-color: var(--skeleton-bg, rgba(255, 255, 255, 0.038));
  border: none !important;
  box-shadow: none !important;
  border-radius: 8px;
}

/* Modificadores de figura (Shapes limpias sin bordes adaptadas a EVA Desk) */
.skeleton-avatar,
.skeleton-circle {
  border-radius: 50% !important;
  border: none !important;
  box-shadow: none !important;
  flex-shrink: 0;
}

.skeleton-title {
  height: 20px;
  border-radius: 8px;
  border: none !important;
  box-shadow: none !important;
}

.skeleton-text {
  height: 14px;
  border-radius: 6px;
  border: none !important;
  box-shadow: none !important;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-button,
.skeleton-btn {
  height: 36px;
  border-radius: 10px;
  border: none !important;
  box-shadow: none !important;
}

.skeleton-badge,
.skeleton-pill {
  height: 22px;
  border-radius: 9999px;
  border: none !important;
  box-shadow: none !important;
}

.skeleton-input {
  height: 38px;
  border-radius: 10px;
  background-color: var(--skeleton-bg, rgba(255, 255, 255, 0.038));
  border: none !important;
  box-shadow: none !important;
}

.skeleton-card {
  background-color: var(--skeleton-card-bg, rgba(255, 255, 255, 0.025));
  border: none !important;
  box-shadow: none !important;
  border-radius: 14px;
  padding: 16px;
}

/* Zero-CLS Pre-render Overlay de Página */
#appPageSkeleton {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 100%;
  padding: 20px 24px;
  background-color: var(--ui-page-bg, #09090b);
  z-index: 40;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.15s ease-out, visibility 0.15s ease-out;
}

#appPageSkeleton.skeleton-hidden {
  opacity: 0;
  visibility: hidden;
}

.ui-table-skeleton-row {
  height: 44px;
  border: none !important;
}

.ui-table-skeleton-row td {
  padding: 10px 16px;
  border: none !important;
  border-bottom: none !important;
}

/* ══════════════════════════════════════════════════════════════════════════════
   ACCESIBILIDAD
   ══════════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
    scroll-behavior: auto;
  }
}

/* ==========================================================================
   TICKET DETAIL WORKSPACE: Layout Estricto Contenido al Viewport
   ========================================================================== */
@media (min-width: 1024px) {
  #ticketDetailFullView {
    height: calc(100vh - 125px) !important;
    max-height: calc(100vh - 125px) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  #ticketDetailFullView > .grid {
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  #mobileStaffConversation {
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  #detail_timeline_chat {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  #mobileStaffInfo {
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  #mobileStaffInfo > div.overflow-y-auto {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }
}


/* ══════════════════════════════════════════════════════════════════════════════
   CATÁLOGO ÚNICO EVA (T1, T3, T7) — WCAG AA >= 4.5:1 MEDIDO
   ══════════════════════════════════════════════════════════════════════════════ */

.eva-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  border-radius: 9999px;
  border: 1px solid transparent;
  font-family: var(--ui-font);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.eva-status-badge--nuevo {
  background-color: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.36);
  color: #93c5fd; /* 9.85:1 sobre #121318 */
}

.eva-status-badge--en_curso {
  background-color: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.36);
  color: #d8b4fe; /* 9.42:1 sobre #121318 */
}

.eva-status-badge--esperando_cliente {
  background-color: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.36);
  color: #fcd34d; /* 12.15:1 sobre #121318 */
}

.eva-status-badge--resuelto {
  background-color: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.36);
  color: #86efac; /* 12.40:1 sobre #121318 */
}

.eva-status-badge--cerrado {
  background-color: rgba(161, 161, 170, 0.14);
  border-color: rgba(161, 161, 170, 0.34);
  color: #d4d4d8; /* 11.98:1 sobre #121318 */
}

.eva-status-badge--cancelado,
body .badge-cancelado {
  background-color: rgba(113, 113, 122, 0.14);
  border-color: rgba(113, 113, 122, 0.32);
  color: #b4b4be; /* 8.35:1 sobre #121318 (sin rojo) */
}

/* Prioridades: pastilla rectangular de 6px (distinta forma y paleta que Estado) */
.eva-prio-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 23px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-family: var(--ui-font);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.eva-prio-badge--critica {
  background-color: rgba(249, 115, 22, 0.15);
  border-color: rgba(249, 115, 22, 0.38);
  color: #fdba74; /* 10.42:1 */
}

.eva-prio-badge--alta {
  background-color: rgba(234, 179, 8, 0.14);
  border-color: rgba(234, 179, 8, 0.36);
  color: #fde047; /* 13.50:1 */
}

.eva-prio-badge--media {
  background-color: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.30);
  color: #cbd5e1; /* 11.50:1 */
}

.eva-prio-badge--baja {
  background-color: rgba(113, 113, 122, 0.10);
  border-color: rgba(113, 113, 122, 0.28);
  color: #b4b4be; /* 8.35:1 */
}

/* Producto chip */
.eva-product-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.30);
  font-family: var(--ui-font);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.eva-badge--sm {
  height: 20px;
  padding: 0 7px;
  font-size: 12px;
}

/* SLA Badges — Compactos: Rojo (Vencido), Naranja (1ra resp. demorada), Amarillo (1ra resp. / próximo), Verde (Resuelto), Gris (Cerrado) */
.eva-sla-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 23px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-family: var(--ui-font);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.eva-sla-badge--overdue {
  background-color: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.44);
  color: #fca5a5; /* Rojo - 9.29:1 */
}

.eva-sla-badge--orange {
  background-color: rgba(249, 115, 22, 0.16);
  border-color: rgba(249, 115, 22, 0.42);
  color: #fdba74; /* Naranja - 10.42:1 */
}

.eva-sla-badge--warning {
  background-color: rgba(234, 179, 8, 0.15);
  border-color: rgba(234, 179, 8, 0.38);
  color: #fde047; /* Amarillo - 13.50:1 */
}

.eva-sla-badge--ok {
  background-color: rgba(56, 189, 248, 0.13);
  border-color: rgba(56, 189, 248, 0.32);
  color: #7dd3fc; /* Azul claro - 10.60:1 */
}

.eva-sla-badge--paused {
  background-color: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.30);
  color: #cbd5e1; /* Pizarra - 11.50:1 */
}

.eva-sla-badge--met {
  background-color: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.36);
  color: #86efac; /* Verde - 12.40:1 */
}

.eva-sla-badge--neutral {
  background-color: rgba(161, 161, 170, 0.12);
  border-color: rgba(161, 161, 170, 0.30);
  color: #d4d4d8; /* Gris - 11.98:1 */
}

/* Indicador de entorno no productivo (T3) */
.eva-env-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background-color: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.42);
  color: #fcd34d;
  font-family: var(--ui-font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* KPI neutro para Reportes (solo rojo en alertas) */
.kpi-card--neutral {
  border-left-color: #3f3f46;
}
.kpi-card--neutral .kpi-label {
  color: #b4b4be;
}


/* Fix para select/inputs dentro de modales para evitar que el texto interior quede cortado */
#newTicketModal select,
#newTicketModal input:not([type="checkbox"]):not([type="radio"]),
#newTicketModal button#nt_cat_dropdown_btn,
#clientNewTicketModal select,
#clientNewTicketModal input:not([type="checkbox"]):not([type="radio"]),
.modal-dialog-content select,
.modal-dialog-content input:not([type="checkbox"]):not([type="radio"]) {
  height: 42px !important;
  min-height: 42px !important;
  line-height: 22px !important;
  padding-top: 9px !important;
  padding-bottom: 9px !important;
  padding-left: 14px !important;
  padding-right: 36px !important;
  box-sizing: border-box !important;
}

#newTicketModal select option,
#clientNewTicketModal select option {
  padding: 8px 12px !important;
  background-color: #14151f !important;
  color: #f4f4f5 !important;
}


#nt_nro_maquina,
#newTicketModal #nt_nro_maquina {
  padding-left: 36px !important;
}
