:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --danger: #f87171;
  --ok: #4ade80;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}

.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }

.brand-logo {
  display: block;
  height: 36px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.login-brand {
  text-align: center;
  margin-bottom: 0.5rem;
}

.login-logo {
  display: block;
  margin: 0 auto 0.75rem;
  max-height: 72px;
  max-width: 220px;
  width: auto;
  object-fit: contain;
}

.logo-preview {
  margin: 0.5rem 0 0.75rem;
  padding: 0.75rem;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: inline-block;
}

.logo-preview img {
  display: block;
  max-height: 80px;
  max-width: 240px;
  object-fit: contain;
}

.nav {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav a:hover { color: var(--accent); }

.user-meta {
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #0c4a6e;
  color: #bae6fd;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.main {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
}

.card h1, .card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.muted { color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-top: 0.25rem;
}

a.stat-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.15rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}

a.stat-card:hover {
  text-decoration: none;
  border-color: #38bdf8;
  background: #172033;
  transform: translateY(-1px);
}

a.stat-card .n {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

a.stat-card .l {
  margin-top: 0.35rem;
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

a.stat-card .stat-hint {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

a.stat-urgente .n { color: #f87171; }
a.stat-espera .n { color: #c4b5fd; }
a.stat-recientes .n { color: #38bdf8; }
a.stat-cerrados .n { color: #94a3b8; }
a.stat-aprobados .n { color: #4ade80; }

.tickets-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}
.tickets-actions .btn.is-active {
  border-color: #38bdf8;
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.12);
}

.tickets-search-bar {
  margin-bottom: 1rem;
}
.tickets-search-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  max-width: 420px;
}
.tickets-search-form > input[type="search"] {
  flex: 1 1 200px;
  min-width: 160px;
  max-width: 280px;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  font: inherit;
}
.filter-menu {
  position: relative;
}
.filter-popover {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: min(340px, 92vw);
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  padding: 0.85rem;
  z-index: 40;
}
.filter-menu.open .filter-popover,
.filter-popover:not([hidden]) {
  display: block;
}
.filter-popover[hidden] {
  display: none !important;
}
.filter-popover-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}
.filter-popover .field {
  margin: 0;
}
.filter-popover .field label {
  font-size: 0.8rem;
}
.filter-popover .field input,
.filter-popover .field select {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  font: inherit;
}
.filter-popover-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid #334155;
}

.stat {
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}

.stat .n {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.stat .l { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }

.btn {
  display: inline-block;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  background: var(--accent-2);
  color: #082f49;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
}

.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
}

.password-toggle-wrap {
  position: relative;
}

.password-toggle-wrap input {
  padding-right: 2.75rem;
}

.password-toggle-btn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 0.75rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.password-toggle-btn:hover { color: var(--text); }

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
  font-size: 0.9rem;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  cursor: pointer;
}

.check-inline input { width: auto; }

.actions-cell {
  white-space: nowrap;
}

.actions-cell a + a {
  margin-left: 0.65rem;
}

/* Inventario — búsqueda, tabla y detalle */
.activos-search-form {
  max-width: none;
  width: 100%;
}
.activos-search-form > input[type="search"] {
  flex: 1 1 260px;
  max-width: 520px;
}
.table-inventario {
  width: 100%;
}
.table-inventario th,
.table-inventario td {
  padding: 0.55rem 0.85rem;
  vertical-align: middle;
}
.table-inventario .col-nombre { width: 18%; min-width: 130px; }
.table-inventario .col-tipo { width: 11%; min-width: 88px; white-space: nowrap; }
.table-inventario .col-usuario { width: 22%; min-width: 140px; }
.table-inventario .col-ubicacion { width: 22%; min-width: 140px; }
.table-inventario .col-estado { width: 12%; min-width: 96px; white-space: nowrap; }
.table-inventario .col-actions { width: 1%; white-space: nowrap; }
.activo-detalle-layout {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  max-width: none;
}
.activo-meta-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.55rem;
}

.ticket-form-card {
  max-width: 820px;
}
.ticket-vinculos-block {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.45);
}
.ticket-vinculos-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
}
.vinculos-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.4rem;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b1220;
}
.vinculo-check {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.35rem 0.4rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
}
.vinculo-check:hover { background: rgba(56, 189, 248, 0.06); }
.vinculo-check input { margin-top: 0.2rem; flex-shrink: 0; }
.vinculo-check strong { display: block; font-weight: 600; line-height: 1.25; }
.vinculo-check small { display: block; line-height: 1.3; }

/* Soporte a Usuario — empleado + equipo (formulario nuevo ticket) */
.soporte-usuario-panel {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.35);
}
.soporte-usuario-hint {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
}
.vinculos-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}
.vinculo-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  font-size: 0.84rem;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #e2e8f0;
}
.vinculo-chip button {
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.15rem;
}
.vinculo-chip button:hover { color: #f87171; }
.vinculos-editor {
  margin: 0.5rem 0 0.65rem;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #0b1220;
}
.vinculos-editor-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.soporte-lista-filtrada {
  margin-top: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0f172a;
  max-height: 200px;
  overflow-y: auto;
}
.soporte-lista-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.65rem;
  border: none;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  background: transparent;
  color: #e2e8f0;
  font-size: 0.88rem;
  cursor: pointer;
}
.soporte-lista-item:last-child { border-bottom: none; }
.soporte-lista-item:hover { background: rgba(56, 189, 248, 0.08); }

.vinculos-lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.vinculos-lista li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 0.9rem;
}
.vinculos-add-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.vinculos-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.vinculos-add-form select {
  flex: 1 1 200px;
  min-width: 160px;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  font: inherit;
}

.link-btn {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
  margin-left: 0.6rem;
  text-decoration: underline;
}

.link-btn:hover { filter: brightness(1.1); }

.field { margin: 0.9rem 0; }
.field label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  font: inherit;
}

.field textarea { resize: vertical; min-height: 120px; }

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.btn-small {
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
}

.btn-danger {
  background: #b91c1c;
  color: #fef2f2;
}

.aviso-24h {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  background: #422006;
  border: 1px solid #a16207;
  color: #fde68a;
  font-size: 0.92rem;
  line-height: 1.45;
}

.field-check label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  cursor: pointer;
}

.field-check input { width: auto; }

.error {
  background: #450a0a;
  color: #fecaca;
  border: 1px solid #7f1d1d;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.ok {
  background: #052e16;
  color: #bbf7d0;
  border: 1px solid #14532d;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.list { margin: 0.5rem 0 0; padding-left: 1.1rem; color: var(--muted); }
.list li { margin: 0.25rem 0; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.toolbar h1 {
  margin: 0;
  font-size: 1.35rem;
}

.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th,
.table td {
  text-align: left;
  padding: 0.65rem 0.4rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table .right { text-align: right; }

.badge-suspendido {
  background: #7f1d1d;
  color: #fecaca;
}
.badge-ok {
  background: #14532d;
  color: #bbf7d0;
}

.badge-off {
  background: #334155;
  color: #cbd5e1;
}

.badge-estado { font-size: 0.72rem; }
.badge-abierto { background: #1e3a5f; color: #bfdbfe; }
.badge-en_progreso { background: #713f12; color: #fde68a; }
.badge-resuelto { background: #164e63; color: #a5f3fc; }
.badge-aprobado { background: #14532d; color: #bbf7d0; }
.badge-cerrado { background: #334155; color: #e2e8f0; }
.badge-rechazado { background: #7f1d1d; color: #fecaca; }

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.detail-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.descripcion {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 8px;
  white-space: pre-wrap;
  line-height: 1.5;
}

.badge-pendiente_aprobacion { background: #4c1d95; color: #ddd6fe; }
.badge-prio-alta { background: #7f1d1d; color: #fecaca; }
.badge-prio-media { background: #78350f; color: #fde68a; }
.badge-prio-baja { background: #14532d; color: #bbf7d0; }

/* —— App shell (panel profesional) —— */
.has-shell { background: #0b1220; }
.app-shell {
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 240px;
  overflow-y: auto;
  background: linear-gradient(180deg, #0f2744 0%, #0b1a2e 100%);
  border-right: 1px solid #1e3a5f;
  padding: 1.1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 30;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.5rem 0.85rem;
  color: #e2e8f0;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
  border-bottom: 1px solid #1e3a5f;
}
.sidebar-brand:hover { text-decoration: none; color: #fff; }
.sidebar-logo { height: 34px; width: auto; max-width: 120px; object-fit: contain; }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.2rem; }
.nav-item {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.95rem;
}
.nav-item:hover { background: rgba(56,189,248,0.08); color: #e2e8f0; text-decoration: none; }
.nav-item.active { background: rgba(14,165,233,0.18); color: #7dd3fc; font-weight: 600; }
.nav-group { margin-bottom: 0.15rem; }
.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.15rem 0 0.35rem 0.9rem;
}
.nav-sub a {
  color: #64748b;
  font-size: 0.82rem;
  text-decoration: none;
  padding: 0.2rem 0;
}
.nav-sub a:hover { color: #bae6fd; }
.shell-main { display: flex; flex-direction: column; min-width: 0; margin-left: 240px; min-height: 100vh; }
.shell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: #111827;
  border-bottom: 1px solid #1f2937;
  flex-wrap: wrap;
}
.shell-top-title { font-size: 1.05rem; font-weight: 600; color: #e2e8f0; }
.shell-user { display: flex; align-items: center; gap: 0.75rem; }
.shell-user-meta { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.85rem; text-align: left; }

/* Menú emergente del usuario (perfil / marca / salir) */
.user-menu {
  position: relative;
}
.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}
.user-menu-trigger:hover,
.user-menu.open .user-menu-trigger {
  background: #1e293b;
  border-color: #334155;
}
.user-menu-gear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-left: 0.25rem;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid #475569;
  color: #e2e8f0;
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}
.user-menu.open .user-menu-gear {
  background: #0c4a6e;
  border-color: #38bdf8;
  color: #e0f2fe;
}
.user-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #94a3b8;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  padding: 0.35rem 0;
  z-index: 50;
}
/* Solo con clic (.open), nunca al pasar el mouse */
.user-menu.open .user-menu-dropdown {
  display: block;
}
.user-menu-dropdown[hidden] {
  display: none !important;
}
.user-menu-dropdown a,
.user-menu-logout button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.9rem;
  color: #1e293b;
  text-decoration: none;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}
.user-menu-dropdown a:hover,
.user-menu-logout button:hover {
  background: #e2e8f0;
  text-decoration: none;
}
.user-menu-logout {
  margin: 0;
  border-top: 1px solid #cbd5e1;
  padding-top: 0.2rem;
  margin-top: 0.2rem;
}

/* Formularios compactos (perfil, marca, altas) */
.shell-content.content-compact {
  width: min(520px, 100%);
  margin-left: 0;
}
.form-panel {
  max-width: 480px;
}
.form-panel .field input,
.form-panel .field select,
.form-panel .field textarea,
.form-panel .password-toggle-wrap {
  max-width: 100%;
}
.form-panel .card {
  padding: 1rem 1.1rem;
}
.avatar {
  width: 36px; height: 36px; border-radius: 999px; object-fit: cover;
  border: 1px solid #334155;
}
.avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: #0c4a6e; color: #e0f2fe; font-weight: 700;
}
.shell-content {
  padding: 1.25rem;
  width: min(1200px, 100%);
  margin: 0 auto;
}
.filters {
  display: grid;
  grid-template-columns: 1.4fr repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.filters input, .filters select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  font: inherit;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
}
.pagination .pages { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
}
.pagination a:hover { color: var(--accent); border-color: var(--accent); }
.pagination .current {
  background: #0c4a6e;
  border-color: #0369a1;
  color: #e0f2fe;
}
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover { background: rgba(56,189,248,0.06); }
.asunto-cell { font-weight: 600; color: #f1f5f9; }
.asunto-cell small { display: block; font-weight: 400; color: var(--muted); margin-top: 0.15rem; }

.shell-top-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.btn-menu {
  display: none;
  border: 1px solid var(--border);
  background: #1e293b;
  color: var(--text);
  border-radius: 8px;
  width: 2.4rem;
  height: 2.4rem;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}
.sidebar-backdrop {
  display: none;
}

/* Barra inferior móvil (todos los roles: cliente, técnico, admin) */
.nav-movil {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: #0f172a;
  border-top: 1px solid #1e3a5f;
  padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom));
  gap: 0.15rem;
}
.nav-movil-5 { grid-template-columns: repeat(5, 1fr); }
.nav-movil-4 { grid-template-columns: repeat(4, 1fr); }

.adjuntos-lista {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}
.adjuntos-lista li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.adjunto-thumb {
  display: block;
  max-width: 160px;
  max-height: 100px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.25rem;
  border: 1px solid var(--border);
}
.form-inline-upload {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

/* Campos de fecha con calendario nativo */
.date-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 100%;
  max-width: 220px;
}
.date-field input[type="date"] {
  width: 100%;
  padding: 0.5rem 2.2rem 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  font: inherit;
  min-height: 2.4rem;
  cursor: pointer;
  color-scheme: dark;
}
.date-field input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  position: absolute;
  right: 0;
  width: 2.4rem;
  height: 100%;
  cursor: pointer;
}
.date-field-icon {
  position: absolute;
  right: 0.45rem;
  pointer-events: auto;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  user-select: none;
}
.filter-popover .date-field {
  max-width: 100%;
}

.suspension-icon {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}
.suspension-motivo {
  display: inline-block;
  margin: 0.75rem 0 0;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  background: #450a0a;
  border: 1px solid #7f1d1d;
  color: #fecaca;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.suspension-info {
  text-align: left;
  margin-top: 1.1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: #0b1220;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}
.suspension-info p { margin: 0.35rem 0; }
.suspension-contacto {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: #422006;
  border: 1px solid #a16207;
  color: #fde68a;
  font-size: 0.92rem;
}
.nav-movil a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  padding: 0.35rem 0.15rem;
  border-radius: 8px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 600;
}
.nav-movil a:hover,
.nav-movil a.active {
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.12);
  text-decoration: none;
}
.nav-movil-ico { font-size: 1.05rem; line-height: 1; }
.nav-movil-nuevo {
  color: #38bdf8 !important;
}
.nav-movil-aprobar {
  color: #4ade80 !important;
}
.nav-movil-aprobar.active {
  background: rgba(74, 222, 128, 0.12) !important;
}

.aprobar-rapido {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}
.aprobar-rapido form { margin: 0; }
.btn-touch-ok {
  background: #15803d;
  color: #f0fdf4;
  min-height: 2.5rem;
  padding: 0.55rem 1rem;
  font-weight: 700;
}
.btn-touch {
  min-height: 2.5rem;
  padding: 0.55rem 1rem;
}
.aprobar-rapido-detalle {
  flex-direction: column;
}
.aprobar-rapido-detalle .btn,
.aprobar-rapido-detalle button {
  width: 100%;
}
.aprobar-cards-movil {
  display: none;
}
.aprobar-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  margin-bottom: 0.75rem;
  background: #0b1220;
}
.aprobar-card-link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: inherit;
  text-decoration: none;
  margin-bottom: 0.75rem;
}
.aprobar-card-link:hover { text-decoration: none; color: #7dd3fc; }

@media (max-width: 900px) {
  .shell-main {
    margin-left: 0;
  }
  .app-shell {
    grid-template-columns: 1fr;
  }
  .btn-menu { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    z-index: 60;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    border-right: 1px solid #1e3a5f;
    overflow-y: auto;
  }
  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.65);
    z-index: 50;
  }
  .sidebar-backdrop[hidden] { display: none !important; }

  .shell-user-meta { display: none; }
  .shell-content {
    padding: 1rem 0.85rem 5.5rem;
    width: 100%;
  }
  .shell-content.content-compact {
    width: 100%;
    max-width: 100%;
  }
  .form-panel { max-width: 100%; }

  .nav-movil { display: grid; }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .filters {
    grid-template-columns: 1fr;
  }
  .table-wrap,
  .card {
    overflow-x: auto;
  }
  .table {
    min-width: 640px;
  }
  .toolbar {
    align-items: flex-start;
  }
  .pagination {
    flex-direction: column;
    align-items: stretch;
  }

  /* Aprobación cómoda en celular */
  .card-con-aprobar-movil .table-desktop {
    display: none;
  }
  .card-con-aprobar-movil .aprobar-cards-movil {
    display: block;
  }
  .card-aprobar-movil {
    position: sticky;
    bottom: 4.5rem;
    z-index: 30;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.35);
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .shell-top {
    padding: 0.65rem 0.75rem;
  }
}

/* —— Auth (estilo sensores / eiotrack) —— */
.auth-body {
  margin: 0;
  min-height: 100vh;
  background: #0f172a;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #e2e8f0;
}
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.auth-card {
  width: min(420px, 100%);
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.45);
  padding: 2.25rem 2rem;
}
.auth-logo-wrap { text-align: center; margin-bottom: 1rem; }
.auth-logo {
  display: block;
  margin: 0 auto;
  max-height: 64px;
  max-width: 220px;
  object-fit: contain;
}
.auth-fallback {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f8fafc;
}
.auth-title {
  margin: 0 0 1.25rem;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
}
.auth-lead {
  text-align: center;
  margin: -0.5rem 0 1rem;
  font-size: 0.92rem;
  line-height: 1.45;
}
.auth-form .field label {
  color: #94a3b8;
  font-size: 0.875rem;
  font-weight: 500;
}
.auth-form .field input {
  background: #0f172a;
  border-color: #475569;
  padding: 0.75rem 1rem;
}
.auth-form .field input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.35);
}
.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
}
.auth-link {
  color: #60a5fa;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}
.auth-link:hover { color: #93c5fd; text-decoration: none; }
.btn-auth {
  width: 100%;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  border-radius: 8px;
}
.btn-auth:hover { background: #1d4ed8; filter: none; }

/* Informes IA — editor + vista previa */
.grid-informe {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 960px) {
  .grid-informe { grid-template-columns: 1fr; }
}
.informe-preview-body {
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  min-height: 280px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #1e293b;
}
.informe-preview-body h2,
.informe-preview-body h3 {
  margin: 1rem 0 0.5rem;
  color: #0f172a;
}
.shell-content:not(.content-compact) .form-panel {
  max-width: none;
}
.shell-content.ticket-detail-page {
  width: min(1320px, 100%);
  padding: 0.85rem 1.15rem 2rem;
}

/* —— Detalle de ticket (layout 2 columnas) —— */
.ticket-hero {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.ticket-back { flex-shrink: 0; margin-top: 0.15rem; }
.ticket-hero-main { min-width: 0; flex: 1; }
.ticket-hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.4rem;
}
.ticket-id {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}
.ticket-hero-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  color: #f1f5f9;
}
.ticket-flash { margin-bottom: 0.75rem; }
.error-detail { display: block; margin-top: 0.35rem; font-size: 0.88rem; opacity: 0.95; }

.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
  gap: 1rem;
  align-items: start;
}
.ticket-main { min-width: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.ticket-aside {
  position: sticky;
  top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.ticket-aside .card { margin-bottom: 0; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.45rem;
}
.meta-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}
.meta-item-wide { grid-column: 1 / -1; }
.meta-item .k {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.meta-item .v {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-top: 0.1rem;
  line-height: 1.3;
}

.card-compact {
  padding: 0.85rem 1rem;
  margin-bottom: 0;
}
.card-compact h2 {
  font-size: 1rem;
  margin: 0 0 0.55rem;
  font-weight: 600;
}
.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.card-head-row h2 { margin: 0; }

.descripcion-inline {
  margin: 0;
  padding: 0.65rem 0.75rem;
  font-size: 0.92rem;
}

.alcance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.55rem;
}
.alcance-box {
  background: #0b1220;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-size: 0.86rem;
  line-height: 1.45;
}
.alcance-box p { margin: 0.25rem 0 0; color: #cbd5e1; }
.alcance-incluye { border: 1px solid #0369a1; }
.alcance-excluye { border: 1px solid #475569; }
.alcance-notas { margin: 0.55rem 0 0; font-size: 0.85rem; }

.alert-stack { display: flex; flex-direction: column; gap: 0.45rem; }
.aviso-compact {
  padding: 0.55rem 0.75rem;
  font-size: 0.86rem;
  line-height: 1.45;
  margin: 0;
}
.aviso-info {
  background: #0c4a6e;
  border-color: #0369a1;
  color: #e0f2fe;
}

.ticket-time-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.time-chip {
  display: inline-flex;
  flex-direction: column;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem 0.55rem;
  font-size: 0.9rem;
  font-weight: 700;
}
.time-chip .k {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
}
.time-chip-accent { border-color: #0369a1; color: #7dd3fc; }

.table-compact { font-size: 0.86rem; }
.table-compact th, .table-compact td { padding: 0.4rem 0.5rem; }
.row-muted td { opacity: 0.65; }
.table-wrap { overflow-x: auto; margin: 0 -0.25rem; }
.cat-cell { max-width: 5.5rem; font-size: 0.78rem; }
.nowrap { white-space: nowrap; }
.footnote { margin: 0.45rem 0 0; font-size: 0.78rem; }
.inline-form { display: inline; }

.ticket-details {
  margin-top: 0.65rem;
  border-top: 1px solid var(--border);
  padding-top: 0.55rem;
}
.ticket-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
  user-select: none;
  list-style: none;
}
.ticket-details summary::-webkit-details-marker { display: none; }
.ticket-details[open] summary { margin-bottom: 0.65rem; }
.ticket-inline-form { margin-top: 0.5rem; }
.ticket-inline-form .field { margin-bottom: 0.55rem; }
.ticket-inline-form label { font-size: 0.78rem; margin-bottom: 0.2rem; }
.ticket-inline-form input,
.ticket-inline-form select,
.ticket-inline-form textarea {
  padding: 0.45rem 0.55rem;
  font-size: 0.88rem;
}
.field-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}
@media (max-width: 720px) {
  .field-row-3 { grid-template-columns: 1fr; }
}

.adjuntos-compact { font-size: 0.88rem; }
.adjuntos-compact .adjunto-thumb { max-height: 48px; }

.aside-stat {
  background: linear-gradient(135deg, #0c4a6e 0%, #1e293b 100%);
  border: 1px solid #0369a1;
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  text-align: center;
}
.aside-stat .k { display: block; font-size: 0.72rem; color: #94a3b8; text-transform: uppercase; }
.aside-stat .v { display: block; font-size: 1.25rem; font-weight: 700; color: #7dd3fc; margin-top: 0.15rem; }

.card-informe-ia {
  border-color: #1e4a6e;
  background: linear-gradient(145deg, #0c2238 0%, #1a2744 100%);
  padding: 0.85rem 1rem;
}
.card-informe-ia h2 {
  color: #7dd3fc;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.ia-icon { color: #38bdf8; font-size: 0.85rem; }
.ia-desc { font-size: 0.82rem; margin: 0 0 0.65rem; line-height: 1.4; }
.btn-ia {
  width: 100%;
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
}
.informes-ticket-lista {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  border-top: 1px solid #334155;
  padding-top: 0.5rem;
}
.informes-ticket-lista li {
  padding: 0.35rem 0;
  font-size: 0.8rem;
  line-height: 1.35;
  border-bottom: 1px solid #293548;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.informes-ticket-lista li:last-child { border-bottom: none; }
.informes-ticket-lista a { font-size: 0.82rem; }

.card-accent { border-color: #4c1d95; }
.aside-hint { font-size: 0.8rem; margin: 0 0 0.5rem; line-height: 1.35; }
.stack-actions { display: flex; flex-direction: column; gap: 0.4rem; }
.btn-block { width: 100%; justify-content: center; }

.ticket-aside h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

@media (max-width: 960px) {
  .ticket-layout {
    grid-template-columns: 1fr;
  }
  .ticket-aside {
    position: static;
    order: -1;
  }
  .ticket-hero-title { font-size: 1.15rem; }
}

.auth-footer {
  margin: 1.75rem 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: #64748b;
}
