/* ==========================================================================
   SISTEMA DE DISEÑO — IT SUPPORT PANEL
   Inspirado en Linear / Vercel — dark theme profesional
   ========================================================================== */

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

/* ── Tokens de diseño — MODO OSCURO (default) ──────────────────────────── */
:root {
  /* Fondos — spread suficiente para jerarquía visual clara */
  --bg:            #0a0a12;
  --bg-2:          #0e0e1c;   /* sidebar: tinte azul-oscuro distinto del main */
  --surface:       #15152a;   /* cards: +11 por canal vs bg → visiblemente más claros */
  --surface-2:     #1b1b32;
  --surface-3:     #21213c;
  --surface-hover: #282848;

  /* Bordes — más visibles sin ser agresivos */
  --border:        rgba(255,255,255,0.10);
  --border-2:      rgba(255,255,255,0.16);
  --border-focus:  rgba(99,102,241,0.60);

  /* Acento */
  --primary:        #6366f1;
  --primary-dark:   #4f46e5;
  --primary-light:  rgba(99,102,241,0.15);
  --primary-glow:   rgba(99,102,241,0.28);

  /* Semánticos (modo oscuro: vibrantes, alta visibilidad) */
  --success:   #10b981;
  --warning:   #f59e0b;
  --danger:    #ef4444;
  --info:      #3b82f6;
  --purple:    #8b5cf6;

  /* Texto — contraste verificado sobre --surface #15152a */
  --text:      #e8edf5;   /* 15.8:1 ✓ */
  --text-2:    #8fa3bd;   /* 6.1:1  ✓ */
  --text-3:    #5c7396;   /* 3.2:1  ✓ decorativo */

  /* Radios */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Transiciones */
  --transition:    all 0.15s ease;
  --transition-md: all 0.25s cubic-bezier(.4,0,.2,1);

  /* Sombras — elevación real + highlight superior tipo Linear */
  --shadow:        0 1px 4px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,0.05);
  --shadow-lg:     0 8px 40px rgba(0,0,0,.8), 0 2px 8px rgba(0,0,0,.4);
  --shadow-primary: 0 4px 16px rgba(99,102,241,.35);

  /* Sidebar */
  --sidebar-w: 240px;

  /* Alias de compatibilidad */
  --text-main:        var(--text);
  --text-muted:       var(--text-2);
  --glass-bg:         var(--surface);
  --glass-bg-hover:   var(--surface-hover);
  --glass-border:     var(--border);
  --glass-blur:       blur(0px);
  --glass-shadow:     rgba(0,0,0,.55);
  --primary-hover:    var(--primary-dark);
  --accent:           var(--purple);
  --border-radius-lg: var(--radius-lg);
  --border-radius-md: var(--radius);
  --border-radius-sm: var(--radius-sm);
  --transition-smooth: var(--transition-md);

  /* Colores de estado de tickets (modo oscuro) */
  --color-abierto:    #3b82f6;
  --color-en_progreso:#f97316;
  --color-en_espera:  #8b5cf6;
  --color-resuelto:   #10b981;
  --color-cerrado:    #64748b;
  --color-baja:       #10b981;
  --color-media:      #f59e0b;
  --color-alta:       #ef4444;
  --color-critica:    #b91c1c;
}

/* ── Reset base ────────────────────────────────────────────────────────── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

html { font-size: 14px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar          { width:5px; height:5px; }
::-webkit-scrollbar-track    { background:transparent; }
::-webkit-scrollbar-thumb    { background:rgba(255,255,255,.1); border-radius:99px; }
::-webkit-scrollbar-thumb:hover { background:rgba(255,255,255,.18); }

/* ── Lucide icons base ─────────────────────────────────────────────────── */
.lucide { width:16px; height:16px; stroke-width:1.75; flex-shrink:0; }
.lucide-lg { width:20px; height:20px; }
.lucide-sm { width:14px; height:14px; }

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.07) transparent;
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  text-decoration: none;
}

.brand-logo {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-primary);
}
.brand-logo svg { width:18px; height:18px; stroke: #fff; }

.brand-text h1 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.brand-text span {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: .3px;
  text-transform: uppercase;
}

/* Nav */
.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 10px;
  flex: 1;
}

.menu-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 16px 8px 6px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--text-2);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.menu-item svg { color: var(--text-3); transition: var(--transition); }

.menu-item:hover {
  background: rgba(255,255,255,.05);
  color: var(--text);
}
.menu-item:hover svg { color: var(--text-2); }

.menu-item.active {
  background: var(--primary-light);
  color: #a5b4fc;
}
.menu-item.active svg { color: var(--primary); }
.menu-item.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 2.5px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.menu-icon { display:flex; align-items:center; }

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

/* WhatsApp status */
.wa-status-sidebar {
  padding: 10px 14px;
  margin: 0 10px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.wa-status-sidebar label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-3);
  margin-bottom: 7px;
}

.wa-connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.wa-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%; flex-shrink: 0;
}
.wa-status-dot.connected    { background:#10b981; box-shadow:0 0 0 3px rgba(16,185,129,.2); }
.wa-status-dot.awaiting_qr  { background:#f59e0b; animation:pulse-dot 1.5s infinite; }
.wa-status-dot.disconnected { background:#ef4444; }
.wa-status-dot.reconnecting { background:#8b5cf6; animation:pulse-dot 1.5s infinite; }
.wa-status-dot.disconnecting{ background:#64748b; }

@keyframes pulse-dot {
  0%,100% { opacity:1; }
  50%      { opacity:.4; }
}

/* Agent selector */
.agent-selector-container {
  padding: 8px 14px;
  margin: 0 10px 8px;
}
.agent-selector-container label {
  display:block; font-size:10px; font-weight:600;
  text-transform:uppercase; letter-spacing:.6px;
  color:var(--text-3); margin-bottom:6px;
}
.agent-select {
  width: 100%;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}
.agent-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Footer */
.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-3);
}
.pulse-indicator {
  width: 7px; height: 7px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(16,185,129,.2);
  animation: pulse-glow 2.5s infinite;
}
@keyframes pulse-glow {
  0%,100% { box-shadow:0 0 0 0 rgba(16,185,129,.4); }
  50%      { box-shadow:0 0 0 5px rgba(16,185,129,0); }
}

/* ==========================================================================
   MAIN LAYOUT
   ========================================================================== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.app-header {
  height: 56px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(8,8,14,.8);
  backdrop-filter: blur(12px);
  position: sticky; top:0; z-index:50;
  flex-shrink: 0;
}

.header-search { display:flex; align-items:center; gap:12px; }

.header-profile { display:flex; align-items:center; gap:10px; }

.agent-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(16,185,129,.1);
  color: #34d399;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid rgba(16,185,129,.2);
}
.agent-badge::before {
  content: '';
  width: 6px; height: 6px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16,185,129,.25);
}

.avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.12);
  cursor: pointer;
}

.page-container {
  padding: 32px 36px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  animation: pageIn 0.2s ease-out;
}

@keyframes pageIn {
  from { opacity:0; transform:translateY(8px); }
  to   { opacity:1; }
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--text-2); border-radius: 2px;
  transition: var(--transition-md);
}

/* ==========================================================================
   GRIDS
   ========================================================================== */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px,100%), 1fr));
  gap: 14px;
  margin-bottom: 24px;
  min-width: 0;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px,100%), 1fr));
  gap: 18px;
  margin-bottom: 24px;
  min-width: 0;
}
.grid-3 { display:grid; grid-template-columns:2fr 1fr; gap:24px; min-width:0; }

/* ==========================================================================
   PAGE HEADER
   ========================================================================== */
.page-header { margin-bottom: 24px; }
.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin-bottom: 4px;
}
.page-header p { color: var(--text-2); font-size: 13.5px; }

/* ==========================================================================
   CARDS
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: var(--transition-md);
  min-width: 0;
  box-sizing: border-box;
}
.card:hover {
  border-color: var(--border-2);
}

/* Stat cards */
.stat-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  cursor: default;
}
.stat-info  { display:flex; flex-direction:column; gap:6px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.stat-label { font-size: 12px; color: var(--text-2); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.stat-icon-container {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--surface-3);
  font-size: 18px;
}

/* Section titles inside cards */
.section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-3);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.section-title svg { width:14px; height:14px; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn svg { width:14px; height:14px; flex-shrink:0; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: var(--shadow-primary);
}
.btn-primary:disabled {
  opacity: .5; cursor:not-allowed;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-2);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover { background:var(--surface-hover); color:var(--text); }

.btn-danger {
  background: rgba(239,68,68,.1);
  color: var(--danger);
  border-color: rgba(239,68,68,.25);
}
.btn-danger:hover { background:rgba(239,68,68,.2); }

.btn-success {
  background: rgba(16,185,129,.12);
  color: var(--success);
  border-color: rgba(16,185,129,.25);
}
.btn-success:hover { background:rgba(16,185,129,.2); }

.btn-small { padding: 5px 12px; font-size: 12px; }
.btn-lg    { padding: 10px 22px; font-size: 14px; }

/* ==========================================================================
   BADGES / ESTADOS
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-abierto    { background:rgba(59,130,246,.12);  color:#60a5fa; }
.badge-en_progreso{ background:rgba(249,115,22,.12);  color:#fb923c; }
.badge-en_espera  { background:rgba(139,92,246,.12);  color:#a78bfa; }
.badge-resuelto   { background:rgba(16,185,129,.12);  color:#34d399; }
.badge-cerrado    { background:rgba(100,116,139,.12); color:#94a3b8; }
.badge-pendiente  { background:rgba(245,158,11,.12);  color:#fbbf24; }
.badge-en_revision{ background:rgba(139,92,246,.12);  color:#a78bfa; }
.badge-en_proceso { background:rgba(249,115,22,.12);  color:#fb923c; }
.badge-completado { background:rgba(16,185,129,.12);  color:#34d399; }
.badge-rechazado  { background:rgba(239,68,68,.12);   color:var(--danger); }

.badge-baja         { background:rgba(16,185,129,.12);  color:#34d399; }
.badge-media        { background:rgba(245,158,11,.12);  color:#fbbf24; }
.badge-alta         { background:rgba(239,68,68,.12);   color:var(--danger); }
.badge-critica      { background:rgba(185,28,28,.15);   color:var(--danger); }
.badge-siguiente_dia{ background:rgba(99,102,241,.12);  color:#a5b4fc; }

/* ==========================================================================
   TABLES
   ========================================================================== */
.table-container { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead tr {
  border-bottom: 1px solid var(--border);
}
thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid rgba(255,255,255,.04);
  transition: var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.03); }
tbody td {
  padding: 12px 14px;
  vertical-align: middle;
  color: var(--text);
}
tbody tr[onclick] { cursor: pointer; }

/* ==========================================================================
   FORMS
   ========================================================================== */
.form-group { display:flex; flex-direction:column; gap:5px; margin-bottom:16px; }
.form-group:last-child { margin-bottom:0; }

label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: .2px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: var(--transition);
  width: 100%;
  box-sizing: border-box;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: rgba(99,102,241,.05);
}

input::placeholder, textarea::placeholder {
  color: var(--text-3);
}

select { cursor: pointer; }
select option  { background: var(--surface-3); color: var(--text); }
select optgroup { background: var(--surface-2); color: var(--text-3); font-style: normal; font-weight: 700; }

textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filter-bar .form-group { margin:0; min-width:140px; flex:1; }

/* ── Modal scroll lock ── */
body.modal-open { overflow: hidden; }

/* ── Inventario filter bar ── */
.inv-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  margin-bottom: 16px;
}
.inv-search-wrap {
  flex: 1;
  position: relative;
  min-width: 180px;
}
.inv-search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  flex-shrink: 0;
}
.inv-search-wrap input {
  width: 100%;
  padding: 7px 10px 7px 32px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}
.inv-search-wrap input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.inv-search-wrap input::placeholder { color: var(--text-3); }
.inv-filter-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}
.inv-area-input {
  width: 140px;
  padding: 7px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}
.inv-area-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.inv-area-input::placeholder { color: var(--text-3); }
.inv-clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
}
.inv-clear-btn.visible {
  opacity: 1;
  pointer-events: auto;
}
.inv-clear-btn:hover {
  background: rgba(239,68,68,.1);
  color: var(--danger);
}

/* ==========================================================================
   INTERNAL NOTES
   ========================================================================== */
.internal-notes-section { display:flex; flex-direction:column; gap:12px; }

.note-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
}
.note-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 8px;
}
.notes-list { display:flex; flex-direction:column; gap:8px; }

/* ==========================================================================
   MESSAGES / TIMELINE
   ========================================================================== */
.timeline-card { display:flex; flex-direction:column; }
.timeline-messages {
  flex:1; overflow-y:auto; max-height:480px;
  display:flex; flex-direction:column; gap:12px;
  padding: 4px 2px 12px;
  scrollbar-width: thin;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: var(--radius);
  max-width: 80%;
  font-size: 13px;
  line-height: 1.55;
}
.message-bubble.user   { background:var(--surface-3); align-self:flex-start; border-bottom-left-radius:3px; }
.message-bubble.bot    { background:var(--primary-light); border:1px solid rgba(99,102,241,.2); align-self:flex-start; border-bottom-left-radius:3px; }
.message-bubble.agent  { background:rgba(16,185,129,.1); border:1px solid rgba(16,185,129,.2); align-self:flex-end; border-bottom-right-radius:3px; }

.message-meta {
  display:flex; justify-content:space-between;
  font-size:10px; color:var(--text-3); margin-top:6px;
}

.reply-form { display:flex; gap:10px; margin-top:16px; }
.reply-form textarea { min-height:60px; flex:1; }

/* ==========================================================================
   TICKET DETAIL GRID
   ========================================================================== */
.ticket-detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

.info-details-list { display:flex; flex-direction:column; }
.info-details-item {
  display:flex; justify-content:space-between; align-items:center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.info-details-item:last-child { border-bottom:none; }
.info-details-label { font-size:12px; color:var(--text-3); font-weight:500; flex-shrink:0; }
.info-details-val   { font-size:13px; font-weight:500; text-align:right; }

/* ==========================================================================
   TOASTS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toastIn .2s ease-out;
  max-width: 360px;
  min-width: 240px;
}
@keyframes toastIn {
  from { opacity:0; transform:translateX(16px); }
  to   { opacity:1; transform:translateX(0); }
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--info); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-icon { font-size:15px; }

/* Loading spinner */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-3);
  gap: 14px;
  font-size: 13px;
}
.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border-2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform:rotate(360deg); } }

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
  color: var(--text-3);
  gap: 12px;
  text-align: center;
}
.empty-state-icon {
  width: 48px; height: 48px;
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 4px;
}
.empty-state p { font-size: 13.5px; max-width: 260px; line-height: 1.6; }

/* ==========================================================================
   TABS
   ========================================================================== */
.tab-btn {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tab-btn:hover { color: var(--text-2); }
.tab-active { color: var(--text) !important; border-bottom-color: var(--primary) !important; }
.tab-count {
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
  font-weight: 600;
}

/* ==========================================================================
   TECH REQUESTS — filas de tabla
   ========================================================================== */
.tr-row:hover { background:var(--surface-hover) !important; cursor:pointer; }

/* ==========================================================================
   QR WHATSAPP
   ========================================================================== */

/* ==========================================================================
   OVERLAY SIDEBAR MÓVIL
   ========================================================================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 99;
  backdrop-filter: blur(3px);
}

/* ==========================================================================
   DASHBOARD ESPECÍFICO
   ========================================================================== */
.chart-container { position:relative; height:240px; width:100%; }

/* ==========================================================================
   FAQ
   ========================================================================== */
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 8px;
  transition: var(--transition);
}
.faq-item:hover { border-color: var(--border-2); }

/* ==========================================================================
   RESPONSIVE — MOBILE
   ========================================================================== */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    z-index: 200;
    width: 260px;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; }

  .main-content { margin-left: 0; }
  .app-header { padding: 0 16px; }
  .page-container { padding: 20px 16px; }
  .hamburger { display: flex; }

  .ticket-detail-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .filter-bar .form-group { min-width: 120px; }
}

@media (max-width: 600px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  table thead { display: none; }
  table tbody tr { display: flex; flex-direction: column; padding: 12px 0; }
  table tbody td { padding: 4px 14px; border: none; }
  table tbody td:first-child { font-weight: 700; color: var(--primary); }
}

/* ==========================================================================
   ANIMACIONES UTILITARIAS
   ========================================================================== */
.fade-in { animation: pageIn .2s ease-out forwards; }
.text-muted { color: var(--text-2); }
.text-subtle { color: var(--text-3); }

/* Scrollbar de sidebar */
.sidebar::-webkit-scrollbar { width:3px; }
.sidebar::-webkit-scrollbar-thumb { background:rgba(255,255,255,.08); border-radius:99px; }

/* body.sidebar-open */
body.sidebar-open .hamburger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.sidebar-open .hamburger span:nth-child(2) { opacity: 0; }
body.sidebar-open .hamburger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
}
.modal-content {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  width: 100%;
  margin: auto;
  box-shadow: var(--shadow-lg);
  max-height: none;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 0;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 20px; line-height: 1;
  padding: 2px 6px; border-radius: 4px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }
.modal-body  { padding: 20px 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 0 24px 20px;
}

/* Form control alias */
.form-control {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: var(--transition);
  box-sizing: border-box;
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ── Inventario data table ── */
.inv-table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.inv-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 680px;
}
.data-table thead th {
  background: var(--surface-2);
  padding: 9px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .65px;
  color: var(--text-3);
  border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
  user-select: none;
}
.data-table thead th:last-child { text-align: right; width: 72px; }
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s ease;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table tbody td {
  padding: 10px 14px;
  vertical-align: middle;
  color: var(--text-2);
  line-height: 1.4;
}
.data-table .td-mono {
  font-family: ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text);
  letter-spacing: .2px;
  font-variant-numeric: tabular-nums;
}
.data-table .td-primary { font-weight: 600; color: var(--text); font-size: 13px; }
.data-table .td-sub    { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.data-table .td-actions { text-align: right; white-space: nowrap; padding-right: 10px; }
/* Action buttons */
.tbl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  background: transparent;
  color: var(--text-3);
}
.tbl-btn:hover { background: var(--surface-3); color: var(--text); }
.tbl-btn--del:hover { background: rgba(239,68,68,.12); color: var(--danger); }
.tbl-btn + .tbl-btn { margin-left: 2px; }
/* estado badges for celulares */
.badge-nuevo      { background: rgba(99,102,241,.12);  color: #a5b4fc; }
.badge-seminuevo  { background: rgba(245,158,11,.12);  color: #fbbf24; }
.badge-usado      { background: rgba(100,116,139,.12); color: #94a3b8; }

/* Role badge */
.badge-role { background:rgba(99,102,241,.12); color:#a5b4fc; }

/* ==========================================================================
   TEMA CLARO
   ========================================================================== */
[data-theme="light"] {
  /* Fondos — azul-gris medio para que los cards blancos resalten claramente */
  --bg:            #e4eaf4;
  --bg-2:          #d9e1ef;   /* sidebar: tono más oscuro, bien diferenciado */
  --surface:       #ffffff;   /* cards blancos contrastan fuerte con bg */
  --surface-2:     #f2f5fb;
  --surface-3:     #e8edf7;
  --surface-hover: #d8e0ee;

  /* Bordes — bien definidos */
  --border:        rgba(0,0,0,0.12);
  --border-2:      rgba(0,0,0,0.20);
  --border-focus:  rgba(79,70,229,0.65);

  /* Acento — variante oscura para mejor contraste sobre fondos claros */
  --primary:        #4f46e5;   /* indigo-600: 7.5:1 sobre blanco ✓ */
  --primary-dark:   #3730a3;
  --primary-light:  rgba(79,70,229,0.10);
  --primary-glow:   rgba(79,70,229,0.20);

  /* Semánticos oscurecidos para contraste sobre superficies claras */
  --success:   #059669;   /* 4.6:1 sobre blanco ✓ */
  --warning:   #b45309;   /* 5.7:1 sobre blanco ✓ */
  --danger:    #dc2626;   /* 5.0:1 sobre blanco ✓ */
  --info:      #1d4ed8;   /* 7.2:1 sobre blanco ✓ */
  --purple:    #6d28d9;

  /* Texto — contraste verificado sobre --surface #ffffff */
  --text:      #0f172a;   /* 18.8:1 ✓ */
  --text-2:    #354d66;   /* 9.1:1  ✓ */
  --text-3:    #4f6680;   /* 5.2:1  ✓ (pasa AA para texto pequeño) */

  /* Sombras — profundidad visible, ring que define el borde del card */
  --shadow:        0 1px 4px rgba(0,0,0,.10), 0 0 0 1px rgba(0,0,0,.06);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.15), 0 2px 8px rgba(0,0,0,.08);
  --shadow-primary: 0 4px 16px rgba(79,70,229,.30);

  /* Alias de compatibilidad */
  --text-main:      var(--text);
  --text-muted:     var(--text-2);
  --glass-bg:       var(--surface);
  --glass-bg-hover: var(--surface-hover);
  --glass-border:   var(--border);
  --glass-shadow:   rgba(0,0,0,.10);
  --primary-hover:  var(--primary-dark);
  --accent:         var(--purple);

  /* Colores de estado de tickets (más oscuros para texto sobre claro) */
  --color-abierto:    #1d4ed8;
  --color-en_progreso:#c2410c;
  --color-en_espera:  #6d28d9;
  --color-resuelto:   #059669;
  --color-cerrado:    #475569;
  --color-baja:       #059669;
  --color-media:      #b45309;
  --color-alta:       #dc2626;
  --color-critica:    #991b1b;
}

[data-theme="light"] ::-webkit-scrollbar-thumb        { background: rgba(0,0,0,.13); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover  { background: rgba(0,0,0,.22); }

/* ── Badges — overrides modo claro (colores oscuros para contraste sobre fondos pálidos) ── */
[data-theme="light"] .badge-abierto      { background:rgba(29,78,216,.10);  color:#1d4ed8; }
[data-theme="light"] .badge-en_progreso  { background:rgba(194,65,12,.10);  color:#c2410c; }
[data-theme="light"] .badge-en_espera    { background:rgba(109,40,217,.10); color:#6d28d9; }
[data-theme="light"] .badge-resuelto     { background:rgba(5,150,105,.10);  color:#059669; }
[data-theme="light"] .badge-cerrado      { background:rgba(71,85,105,.10);  color:#475569; }
[data-theme="light"] .badge-pendiente    { background:rgba(180,83,9,.10);   color:#b45309; }
[data-theme="light"] .badge-en_revision  { background:rgba(109,40,217,.10); color:#6d28d9; }
[data-theme="light"] .badge-en_proceso   { background:rgba(194,65,12,.10);  color:#c2410c; }
[data-theme="light"] .badge-completado   { background:rgba(5,150,105,.10);  color:#059669; }
[data-theme="light"] .badge-rechazado    { background:rgba(220,38,38,.10);  color:#dc2626; }
[data-theme="light"] .badge-baja         { background:rgba(5,150,105,.10);  color:#059669; }
[data-theme="light"] .badge-media        { background:rgba(180,83,9,.10);   color:#b45309; }
[data-theme="light"] .badge-alta         { background:rgba(220,38,38,.10);  color:#dc2626; }
[data-theme="light"] .badge-critica      { background:rgba(153,27,27,.12);  color:#991b1b; }
[data-theme="light"] .badge-siguiente_dia{ background:rgba(79,70,229,.10);  color:#4f46e5; }
[data-theme="light"] .badge-nuevo        { background:rgba(79,70,229,.10);  color:#4f46e5; }
[data-theme="light"] .badge-seminuevo    { background:rgba(180,83,9,.10);   color:#b45309; }
[data-theme="light"] .badge-usado        { background:rgba(71,85,105,.10);  color:#475569; }
[data-theme="light"] .badge-role         { background:rgba(79,70,229,.10);  color:#4f46e5; }

/* ── select optgroup modo claro ─────────────────────────────────────────── */
[data-theme="light"] select option  { background: var(--surface-3); color: var(--text); }
[data-theme="light"] select optgroup { background: var(--surface-2); color: var(--text-3); }

/* ── Botón de tema ──────────────────────────────────────────────────────── */
.btn-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-theme-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-focus);
}

/* Header buttons visibility fix */
#btn-logout {
  background: var(--surface-2) !important;
  border: 1px solid var(--border-2) !important;
  color: var(--text) !important;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500 !important;
}
#btn-logout:hover {
  background: var(--surface-3) !important;
  border-color: var(--border-focus) !important;
  color: var(--primary) !important;
}

#current-user-label {
  color: var(--text) !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  padding: 0 8px;
  border-right: 1px solid var(--border);
}

.btn-theme-toggle {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-2) !important;
}
.btn-theme-toggle:hover {
  background: var(--surface-3) !important;
  color: var(--primary) !important;
  border-color: var(--border-focus) !important;
}
.btn-theme-toggle svg { width: 15px; height: 15px; stroke-width: 1.75; flex-shrink: 0; }

/* Icono visible según tema */
.btn-theme-toggle .icon-sun  { display: none; }
.btn-theme-toggle .icon-moon { display: block; }
[data-theme="light"] .btn-theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .btn-theme-toggle .icon-moon { display: none; }

/* ==========================================================================
   COMPATIBILIDAD CON ESTILOS INLINE EXISTENTES (overrides mínimos)
   ========================================================================== */

/* ── Tech-requests: responsive card layout ─────────────────────────────── */
.tr-cards { display: none; flex-direction: column; gap: 10px; padding: 8px 4px; }

.tr-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.tr-card:hover { background: var(--surface-hover); border-color: var(--border-focus); }

.tr-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.tr-card-num { font-weight: 700; color: var(--primary); font-size: 13px; }
.tr-card-name { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.tr-card-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.tr-card-cedula { font-size: 11px; color: var(--text-3); margin-bottom: 8px; }
.tr-card-extra { font-size: 12px; color: var(--text-2); margin-bottom: 12px; }
.tr-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.tr-card-time { font-size: 11px; color: var(--text-muted); }
.tr-card .btn-tr-edit {
  padding: 6px 14px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.tr-card .btn-tr-edit:hover { background: var(--surface-hover); color: var(--text); }

@media (max-width: 768px) {
  .tr-table-wrap { display: none; }
  .tr-cards { display: flex; }
}
