/* =====================================================
   HSP WorkPlanner — Stylesheet
   Heidelberg Spain SLU — Servicio Técnico
   ===================================================== */

/* --- CSS Variables --- */
:root {
  --hsp-navy:       #0d2b4e;
  --hsp-blue:       #0070c0;
  --hsp-blue-light: #3a9ad9;
  --hsp-blue-pale:  #e8f3fb;
  --hsp-steel:      #4a6080;
  --hsp-silver:     #b8c5d3;
  --hsp-metal:      #d8e2ec;
  --hsp-bg:         #f0f3f8;
  --hsp-surface:    #ffffff;
  --hsp-border:     #d0dbe8;
  --hsp-text:       #1a2a3a;
  --hsp-muted:      #6b7e94;
  --hsp-sidebar-w: 210px;
  --hsp-navbar-h:  74px;
  --radius:         6px;
  --shadow-sm:      0 1px 4px rgba(0,40,80,0.08);
  --shadow-md:      0 3px 12px rgba(0,40,80,0.12);
  --shadow-lg:      0 8px 28px rgba(0,40,80,0.16);
  --transition:     0.18s ease;
}

/* --- Dark mode ---
   Reuses the exact same custom-property names, so every component that was
   already built on top of them (cards, tables, forms, sidebar...) picks up
   the dark palette automatically — no per-component rewrite needed. A
   handful of hardcoded colors outside these variables (e.g. input
   backgrounds) get explicit dark overrides below. */
:root[data-theme="dark"] {
  --hsp-blue-pale:  #16324a;
  --hsp-silver:     #7c8ba0;
  --hsp-steel:      #a3b3c7;
  --hsp-metal:      #2c3a4f;
  --hsp-bg:         #0f1620;
  --hsp-surface:    #1a2332;
  --hsp-border:     #2c3a4f;
  --hsp-text:       #e2e8f0;
  --hsp-muted:      #93a3b8;
}
:root[data-theme="dark"] body { color: var(--hsp-text); }
:root[data-theme="dark"] .form-control.hsp-input,
:root[data-theme="dark"] .form-select.hsp-select {
  background: var(--hsp-surface);
  color: var(--hsp-text);
  border-color: var(--hsp-border);
}
:root[data-theme="dark"] .hsp-table tbody tr:hover { background: var(--hsp-blue-pale); }
:root[data-theme="dark"] .pno-code { background: var(--hsp-metal); color: var(--hsp-text); }
:root[data-theme="dark"] .badge.bg-light { background: var(--hsp-metal) !important; color: var(--hsp-text) !important; }
:root[data-theme="dark"] .table > :not(caption) > * > * { color: var(--hsp-text); }
/* --hsp-navy doubles as navbar/footer BACKGROUND (kept dark on purpose) and
   as heading TEXT color (unreadable once the surface behind it goes dark
   too) — repoint just the text usages. */
:root[data-theme="dark"] .page-title,
:root[data-theme="dark"] .section-title,
:root[data-theme="dark"] .stat-value,
:root[data-theme="dark"] .exec-title { color: var(--hsp-text); }

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Barlow', system-ui, sans-serif;
  font-weight: 400;
  color: var(--hsp-text);
  background: var(--hsp-bg);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =====================================================
   NAVBAR
   ===================================================== */
.hsp-navbar {
  background: linear-gradient(90deg, var(--hsp-navy) 0%, #0a3a6a 100%);
  box-shadow: 0 2px 12px rgba(0,20,50,0.3);
  position: relative;
  top: 0;
  z-index: 1040;
  border-bottom: 2px solid var(--hsp-blue);
  padding: 0;
}

/* Three-column flex layout: brand | center | user */
.hsp-navbar-inner {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 16px;
  min-height: var(--hsp-navbar-h);
  gap: 12px;
}

/* LEFT: brand pill */
.hsp-brand-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.hsp-brand-pill:hover { background: rgba(255,255,255,0.08); }

/* CENTER: logo image + nav links stacked */
.hsp-navbar-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 0;
}

.hsp-hd-logo-link { display: block; line-height: 0; }
.hsp-hd-logo {
  height: 37px;
  width: auto;
  max-width: 299px;
  object-fit: contain;
  opacity: 0.95;
  transition: opacity var(--transition);
}
.hsp-hd-logo-link:hover .hsp-hd-logo { opacity: 1; }

/* Horizontal nav links row below logo */
.hsp-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* RIGHT: user badge */
.hsp-navbar-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Logo badge (H circle) */
.hsp-logo-badge {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--hsp-blue) 0%, #005a9e 100%);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,112,192,0.4);
  flex-shrink: 0;
}
.hsp-logo-h {
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.hsp-brand-text { line-height: 1; }
.brand-hsp {
  display: block;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  letter-spacing: 0.06em;
}
.brand-wp {
  display: block;
  font-family: 'Barlow', sans-serif;
  font-weight: 300;
  font-size: 0.66rem;
  color: var(--hsp-silver);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hsp-nav-link {
  color: rgba(255,255,255,0.75);
  font-family: 'Barlow', sans-serif;
  font-weight: 500;
  font-size: 0.82rem;
  padding: 4px 11px;
  border-radius: var(--radius);
  transition: all var(--transition);
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.hsp-nav-link:hover,
.hsp-nav-link.active {
  color: #fff;
  background: rgba(255,255,255,0.12);
}

/* User badge in navbar */
.hsp-user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 40px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
}
.user-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--hsp-blue) 0%, var(--hsp-blue-light) 100%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  flex-shrink: 0;
}
.user-info { line-height: 1.2; }
.user-name {
  display: block;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
}
.user-role {
  display: block;
  color: var(--hsp-silver);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* =====================================================
   LAYOUT: SIDEBAR + MAIN
   ===================================================== */
.hsp-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--hsp-navbar-h) - 36px);
}

/* SIDEBAR */
.hsp-sidebar {
  width: var(--hsp-sidebar-w);
  background: var(--hsp-surface);
  border-right: 1px solid var(--hsp-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;

  height: calc(100vh - var(--hsp-navbar-h));
  overflow-y: auto;
  box-shadow: 2px 0 8px rgba(0,20,60,0.06);
}

.sidebar-section { padding: 16px 12px 8px; }
.sidebar-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hsp-muted);
  padding: 0 6px;
  margin-bottom: 6px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--hsp-steel);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition);
}
.sidebar-item i { font-size: 0.95rem; width: 18px; text-align: center; }
.sidebar-item:hover { background: var(--hsp-blue-pale); color: var(--hsp-blue); }
.sidebar-item.active {
  background: var(--hsp-blue-pale);
  color: var(--hsp-blue);
  font-weight: 600;
  border-left: 3px solid var(--hsp-blue);
  margin-left: -1px;
}
.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--hsp-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.text-danger-light { color: #c0392b !important; }
.text-danger-light:hover { background: #fdf0ef !important; color: #c0392b !important; }

/* MAIN */
.hsp-main {
  flex: 1;
  padding: 24px;
  overflow-x: hidden;
  overflow-y: auto;
  min-width: 0;
}
.hsp-main--full { margin-left: 0; }

/* =====================================================
   FOOTER
   ===================================================== */
.hsp-footer {
  background: var(--hsp-navy);
  color: var(--hsp-silver);
  text-align: center;
  font-size: 0.75rem;
  padding: 9px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

/* =====================================================
   COMPONENTS
   ===================================================== */

/* Cards */
.hsp-card {
  background: var(--hsp-surface);
  border: 1px solid var(--hsp-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
}

/* Page header */
.page-header { padding-bottom: 12px; border-bottom: 1px solid var(--hsp-border); margin-bottom: 20px; }
.page-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--hsp-navy);
  letter-spacing: 0.01em;
}
.text-hsp-blue { color: var(--hsp-blue) !important; }

/* Buttons */
.btn-hsp-primary {
  background: linear-gradient(135deg, var(--hsp-blue) 0%, #005a9e 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 18px;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(0,112,192,0.25);
  transition: all var(--transition);
}
.btn-hsp-primary:hover {
  background: linear-gradient(135deg, #278BCE 0%, #278BCE 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(39,139,206,0.35);
  transform: translateY(-1px);
}
.btn-hsp-outline {
  background: transparent;
  color: var(--hsp-blue);
  border: 1.5px solid var(--hsp-blue);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 6px 14px;
  transition: all var(--transition);
}
.btn-hsp-outline:hover { background: #278BCE; color: #fff; }
.btn-hsp-ghost {
  background: transparent;
  color: var(--hsp-steel);
  border: 1px solid var(--hsp-border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  padding: 7px 14px;
  transition: all var(--transition);
}
.btn-hsp-ghost:hover { background: var(--hsp-bg); }

/* Forms */
.form-label-hsp {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--hsp-steel);
  margin-bottom: 5px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-label-hsp.required::after { content: ' *'; color: #e74c3c; }
.form-control.hsp-input,
.form-select.hsp-select {
  border: 1.5px solid var(--hsp-border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--hsp-text);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control.hsp-input:focus,
.form-select.hsp-select:focus {
  border-color: var(--hsp-blue);
  box-shadow: 0 0 0 3px rgba(0,112,192,0.12);
  outline: none;
}

/* Filter bar */
.filter-bar {
  background: var(--hsp-surface);
  border: 1px solid var(--hsp-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}
.filter-group { display: flex; flex-direction: column; gap: 3px; }
.filter-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--hsp-muted);
}
.hsp-badge-nav {
  background: var(--hsp-navy);
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius);
}

/* Badges */
.hsp-badge-code {
  background: var(--hsp-navy);
  color: #fff;
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.badge-superuser {
  background: #4a0080;
  color: #fff;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 3px;
}
.badge-coord {
  background: var(--hsp-blue);
  color: #fff;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 3px;
}
.badge-tech {
  background: #2e7d32;
  color: #fff;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 3px;
}
.badge-active {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 3px;
}
.badge-inactive {
  background: #fafafa;
  color: #999;
  border: 1px solid #ddd;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 3px;
}

/* Audit user type badge — used in templates/audit/users.html's list and
   templates/audit/user_detail.html's detail view, kept here (not a local
   <style> block) so both share one definition. */
.tipo-badge {
  display: inline-block; padding: 4px 10px; border-radius: 4px;
  font-size: 0.78rem; font-weight: 700; user-select: none;
  border: 1px solid transparent;
}
.tipo-badge:hover { opacity: 0.85; }
.tipo-usuario { background: #e8f5e9; color: #1a7f37; border-color: #a5d6a7; }
.tipo-sistema { background: #e3f2fd; color: #0d47a1; border-color: #90caf9; }
.tipo-super   { background: #4a0080; color: #fff; border-color: #4a0080; }
.tipo-inactivo  { background: #fff3e0; color: #b26a00; border-color: #ffcc80; }
.tipo-eliminado { background: #fdecea; color: #a61b1b; border-color: #f1a9a0; }
.tipo-desconocido, .tipo-otro { background: #f1f1f1; color: #666; border-color: #ddd; }

/* Table */
.hsp-table { font-size: 0.95rem; }
.hsp-table thead th {
  background: var(--hsp-navy);
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: none;
  padding: 10px 12px;
}
.hsp-table tbody tr { transition: background var(--transition); }
.hsp-table tbody tr:hover { background: var(--hsp-blue-pale); }
.hsp-table tbody td { padding: 10px 12px; border-color: var(--hsp-border); vertical-align: middle; }
.row-inactive td { opacity: 0.5; }

/* Permission control panel table (admin/permisos.html) */
.perm-table tbody tr:nth-child(even) { background: var(--hsp-bg); }
.perm-table tbody td { color: var(--hsp-text); }
.perm-table .bi-lock-fill { color: var(--hsp-blue); }

/* Personal number code */
.pno-code {
  background: var(--hsp-metal);
  color: var(--hsp-navy);
  font-size: 0.86rem;
  padding: 2px 6px;
  border-radius: 3px;
}

/* Mini avatar */
.mini-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--hsp-blue) 0%, var(--hsp-blue-light) 100%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Stats cards */
.stat-card {
  background: var(--hsp-surface);
  border: 1px solid var(--hsp-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
}
.stat-icon.bg-blue  { background: linear-gradient(135deg, var(--hsp-blue), var(--hsp-blue-light)); }
.stat-icon.bg-green { background: linear-gradient(135deg, #2e7d32, #43a047); }
.stat-icon.bg-orange{ background: linear-gradient(135deg, #e65100, #f57c00); }
.stat-icon.bg-red   { background: linear-gradient(135deg, #b71c1c, #e53935); }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--hsp-navy); line-height: 1; }
.stat-label { font-size: 0.86rem; color: var(--hsp-muted); margin-top: 2px; }

/* Breadcrumb */
.hsp-breadcrumb { font-size: 0.78rem; margin-bottom: 6px; }
.hsp-breadcrumb .breadcrumb-item a { color: var(--hsp-blue); text-decoration: none; }
.hsp-breadcrumb .breadcrumb-item.active { color: var(--hsp-muted); }

/* Section title in forms */
.section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.98rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--hsp-navy);
  border-bottom: 2px solid var(--hsp-blue-pale);
  padding-bottom: 6px;
}
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

/* Button actions in table cells */
.btn-edit-tech {
  display: none;
  font-size: 0.7rem;
  color: var(--hsp-muted);
  text-decoration: none;
}
.tech-info-cell:hover .btn-edit-tech { display: inline; }
.btn-cell-action {
  display: none;
  background: none;
  border: none;
  padding: 1px 4px;
  font-size: 0.72rem;
  color: var(--hsp-muted);
  cursor: pointer;
  border-radius: 3px;
  transition: all var(--transition);
}
.btn-cell-action:hover { background: var(--hsp-metal); color: var(--hsp-navy); }
.assign-cell:hover .btn-cell-action { display: inline-flex; }
.cell-actions { display: none; gap: 2px; }
.assign-cell:hover .cell-actions { display: inline-flex; }

/* Today highlight in planning */
.today-cell { background: rgba(0,112,192,0.06) !important; box-shadow: inset 0 0 0 1px rgba(0,112,192,0.2); }

/* Legend bar */
.legend-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  background: #A6C9EC;
  border: 1px solid #7aadd8;
  border-radius: var(--radius);
  font-size: 0.72rem;
}
.legend-title {
  font-weight: 700;
  color: #0d2b4e;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
}
.legend-item { display: inline-flex; align-items: center; }

/* Empty state */
.empty-state { color: var(--hsp-muted); }

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-body {
  background: var(--hsp-bg);
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}
.login-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Left panel */
.login-brand-panel {
  width: 420px;
  min-width: 340px;
  background: linear-gradient(160deg, var(--hsp-navy) 0%, #0a3e6e 60%, #0d5090 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 40px 32px;
  position: relative;
  overflow: hidden;
}
.login-brand-panel::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.login-brand-panel::after {
  content: '';
  position: absolute;
  bottom: 60px; left: -80px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(0,112,192,0.12);
}
.login-brand-content { position: relative; z-index: 1; }
.login-logo-big { margin-bottom: 24px; }
.logo-circle-big {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--hsp-blue) 0%, var(--hsp-blue-light) 100%);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 2.2rem;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,112,192,0.4);
}
.login-brand-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 2.4rem;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 12px;
}
.login-brand-title span { color: var(--hsp-blue-light); }
.login-brand-sub {
  color: var(--hsp-silver);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 36px;
}
.login-brand-features { display: flex; flex-direction: column; gap: 12px; }
.feat-item {
  color: rgba(255,255,255,0.75);
  font-size: 0.83rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.feat-item i { color: var(--hsp-blue-light); font-size: 1rem; }
.login-brand-footer {
  color: rgba(255,255,255,0.4);
  font-size: 0.72rem;
  text-align: center;
  position: relative;
  z-index: 1;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* Right panel */
.login-form-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #fff;
  padding: 0;
}
.login-form-content {
  max-width: 420px;
  width: 100%;
  margin: auto;
  padding: 48px 40px;
}
.login-form-header { margin-bottom: 32px; }
.login-form-header h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.8rem;
  color: var(--hsp-navy);
  margin-bottom: 4px;
}
.login-form-header p { color: var(--hsp-muted); font-size: 0.87rem; }
.login-form .form-group-hsp { }
.input-password-wrapper { position: relative; }
.btn-toggle-pass {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--hsp-muted);
  cursor: pointer;
  padding: 4px;
}
.btn-toggle-pass:hover { color: var(--hsp-blue); }

/* Demo credentials */
.login-hints { border-top: 1px dashed var(--hsp-border); padding-top: 16px; }
.demo-creds { display: flex; flex-direction: column; gap: 8px; }
.demo-item {
  background: var(--hsp-bg);
  border: 1px solid var(--hsp-border);
  border-radius: var(--radius);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.badge-role { font-size: 0.68rem; padding: 2px 7px; border-radius: 3px; font-weight: 700; flex-shrink: 0; }
.badge-role.coord { background: var(--hsp-blue); color: #fff; }
.badge-role.tech  { background: #2e7d32; color: #fff; }
.demo-item code { font-size: 0.75rem; color: var(--hsp-navy); background: none; padding: 0; }
.login-footer-text {
  text-align: center;
  font-size: 0.72rem;
  color: var(--hsp-muted);
  padding: 16px;
  border-top: 1px solid var(--hsp-border);
}

/* =====================================================
   CHANGE PASSWORD
   ===================================================== */
.change-pass-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--hsp-blue) 0%, var(--hsp-blue-light) 100%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  margin: 0 auto 20px;
}

/* =====================================================
   COMPANIES PAGE
   ===================================================== */
.company-badge {
  display: inline-block;
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--hsp-blue) 0%, var(--hsp-blue-light) 100%);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  font-family: 'Barlow Condensed', sans-serif;
  flex-shrink: 0;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
  .hsp-sidebar { display: none; }
  .hsp-main { padding: 16px; }
  .login-brand-panel { display: none; }
  .login-form-content { padding: 32px 24px; }
}

@media (max-width: 600px) {
  .filter-bar { padding: 10px; }
  .page-title { font-size: 1rem; }
  .hsp-card { padding: 14px; }
}

/* =====================================================
   SCROLLBAR
   ===================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--hsp-bg); }
::-webkit-scrollbar-thumb { background: var(--hsp-silver); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--hsp-steel); }

/* =====================================================
   BACKUP PAGE
   ===================================================== */
.backup-info-box {
  background: var(--hsp-bg);
  border: 1px solid var(--hsp-border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.restore-mode-card { display: block; cursor: pointer; margin: 0; }
.restore-mode-card .mode-card-inner {
  border: 2px solid var(--hsp-border);
  border-radius: var(--radius);
  padding: 14px;
  transition: all var(--transition);
  height: 100%;
}
.restore-mode-card:hover .mode-card-inner { border-color: var(--hsp-blue); }
.restore-mode-card.selected .mode-card-inner {
  border-color: var(--hsp-blue);
  background: var(--hsp-blue-pale);
  box-shadow: 0 0 0 3px rgba(0,112,192,0.12);
}

/* =====================================================
   SORTABLE TABLE HEADERS
   ===================================================== */
th[data-sort-col] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th[data-sort-col]:hover { background: #1a5a9a !important; }
th[data-sort-col].sort-asc  { background: #0a4a80 !important; }
th[data-sort-col].sort-desc { background: #0a4a80 !important; }
.sort-icon {
  display: inline-block;
  margin-left: 5px;
  font-size: 0.75em;
  opacity: 0.7;
  font-style: normal;
}

/* EXT badge — dark grey with white text */
.hsp-badge-code.badge-ext {
  background: #555;
  color: #fff;
}

/* Contenedor principal */
#filterTecnico + .ts-wrapper .ts-control {
  min-width: 250px;
  max-width: 300px;
  white-space: nowrap;
  overflow-x: auto;
}

/* Texto seleccionado */
#filterTecnico + .ts-wrapper .ts-control .item {
  white-space: nowrap;
}

/* Opciones del dropdown */
#filterTecnico + .ts-wrapper .ts-dropdown {
  min-width: 280px !important;
}

#filterTecnico + .ts-wrapper .ts-dropdown .option {
  white-space: nowrap;
}
/* ── Sidebar collapse ──
   Toggle button lives in the top navbar (not attached to the sidebar
   itself), so it stays in one fixed, always-visible spot regardless of
   collapsed state — no need to reposition it when the sidebar shrinks. */
.hsp-sidebar { transition: width 0.2s ease, opacity 0.2s ease, border-color 0.2s ease; }
html.sidebar-collapsed .hsp-sidebar {
  width: 0; min-width: 0; opacity: 0; overflow: hidden;
  border-color: transparent; pointer-events: none;
}
#sidebarToggleBtn {
  width: 34px; height: 34px; border-radius: 6px; border: none;
  background: transparent; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: background var(--transition);
}
#sidebarToggleBtn:hover { background: rgba(255,255,255,0.15); }

/* Fix TomSelect overflow when many items selected */
.ts-wrapper.multi .ts-control {
    max-height: 80px !important;
    overflow-y: auto !important;
}

/* TomSelect single line */
.ts-wrapper.multi .ts-control {
    max-height: 36px !important;
    overflow: hidden !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
}
.ts-wrapper.multi .ts-control .item {
    white-space: nowrap !important;
}

/* TomSelect single line fix v2 */
.ts-wrapper.multi .ts-control {
    max-height: 38px !important;
    overflow: hidden !important;
    flex-wrap: nowrap !important;
}
.ts-wrapper.multi .ts-dropdown {
    overflow: visible !important;
    max-height: 300px !important;
}
.ts-wrapper.multi.focus .ts-control {
    max-height: none !important;
    flex-wrap: wrap !important;
    overflow: visible !important;
}

/* TomSelect max 2 lines */
.ts-wrapper.multi .ts-control {
    max-height: 38px !important;
    overflow: hidden !important;
    flex-wrap: nowrap !important;
}
.ts-wrapper.multi.focus .ts-control {
    max-height: 70px !important;
    flex-wrap: wrap !important;
    overflow-y: auto !important;
}
.ts-wrapper .ts-dropdown {
    z-index: 9999 !important;
}

/* Planning: tooltip de asignación en 3 líneas (nombre/OT, área, ayuda Zendesk) */
.tooltip.assign-pill-tooltip .tooltip-inner {
    white-space: pre-line;
}

/* =====================================================
   PROCESSING OVERLAY — shown instantly on submit/click for
   operations known to take a few seconds (big exports, bulk
   imports, heavy reports), so the tab never *looks* frozen and
   the user isn't tempted to reload (which just restarts the
   same slow work). See app.js for the wiring.
   ===================================================== */
#tca-processing-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 43, 78, 0.82);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}
.tca-processing-box {
  background: var(--hsp-surface);
  color: var(--hsp-text);
  border-radius: 10px;
  padding: 2rem 2.5rem;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  max-width: 340px;
}
.tca-spinner {
  width: 42px; height: 42px;
  margin: 0 auto 1rem;
  border: 4px solid var(--hsp-border);
  border-top-color: var(--hsp-blue);
  border-radius: 50%;
  animation: tca-spin 0.8s linear infinite;
}
@keyframes tca-spin { to { transform: rotate(360deg); } }
.tca-processing-msg { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.tca-processing-elapsed { font-size: 0.78rem; color: var(--hsp-muted); font-variant-numeric: tabular-nums; margin-top: 6px; }
.tca-processing-hint { font-size: 0.82rem; color: var(--hsp-muted); margin-top: 10px; }
.tca-progress-track {
  width: 100%; height: 8px; border-radius: 4px; overflow: hidden;
  background: var(--hsp-metal); margin-top: 14px; position: relative;
}
.tca-progress-fill {
  height: 100%; background: var(--hsp-blue); border-radius: 4px;
  width: 0%; transition: width 0.3s ease;
}
.tca-progress-fill.tca-progress-indeterminate {
  width: 40% !important;
  position: absolute; top: 0; left: 0;
  animation: tca-progress-sweep 1.2s ease-in-out infinite;
}
@keyframes tca-progress-sweep {
  0%   { left: -40%; }
  100% { left: 100%; }
}
.tca-processing-step { font-size: 0.78rem; color: var(--hsp-muted); margin-top: 4px; }

/* =====================================================
   IMPORTAR — pill toggle between "Tablas" and "Usuarios"
   ===================================================== */
.import-pill-nav { display: flex; gap: 0; margin: -8px 0 20px; }
.import-pill {
  padding: 10px 36px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  border: 2px solid var(--hsp-blue);
  transition: all var(--transition);
}
.import-pill:first-child { border-radius: 40px 0 0 40px; }
.import-pill:last-child { border-radius: 0 40px 40px 0; border-left: none; }
.import-pill:only-child { border-radius: 40px; border-left: 2px solid var(--hsp-blue); }
.import-pill.active { background: var(--hsp-blue); color: #fff; box-shadow: 0 2px 8px rgba(0,112,192,0.3); }
.import-pill:not(.active) { background: var(--hsp-surface); color: var(--hsp-blue); }
.import-pill:not(.active):hover { background: var(--hsp-blue-pale); }
