/* ==========================================================================
   SIDDEL - Sistema Integrado de Documentación en Línea
   Hoja de estilos principal y tokens de diseño
   ========================================================================== */

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

:root {
  --brand-navy: #0A2540;
  --brand-navy-light: #132F4C;
  --brand-cyan: #00B4D8;
  --brand-cyan-dark: #0096B7;
  --brand-orange: #FF6B35;
  --brand-orange-dark: #E55A2B;
  --brand-gray: #6B7280;
  --primary: var(--brand-navy);
  --primary-dark: #071A2E;
  --primary-light: var(--brand-cyan);
  --accent: var(--brand-orange);
  --success: #10b981;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,.12);
  --shadow-xl: 0 25px 50px -12px rgba(0,0,0,.25);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 9999px;
  --drawer-width: 540px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  zoom: 0.9;
  width: 100%;
  min-height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   LOGO & BRANDING REUTILIZABLE
   ========================================================================== */
.siddel-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}

.siddel-logo.vertical {
  flex-direction: column;
  text-align: center;
  gap: 8px;
}

.siddel-logo-mark {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.siddel-logo.lg .siddel-logo-mark {
  width: 58px;
  height: 58px;
}

.siddel-logo.xl .siddel-logo-mark {
  width: 72px;
  height: 72px;
}

.siddel-logo.sm .siddel-logo-mark {
  width: 32px;
  height: 32px;
}

.siddel-logo-text-group {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.siddel-logo-brand {
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 1.5px;
  background: linear-gradient(135deg, var(--brand-cyan), var(--brand-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.siddel-logo.lg .siddel-logo-brand {
  font-size: 28px;
  letter-spacing: 2px;
}

.siddel-logo.xl .siddel-logo-brand {
  font-size: 34px;
  letter-spacing: 2.5px;
}

.siddel-logo-sub {
  font-size: 9.5px;
  letter-spacing: .4px;
  margin-top: 3px;
  text-transform: uppercase;
  font-weight: 600;
  opacity: .75;
}

.siddel-logo.theme-dark .siddel-logo-sub {
  color: rgba(255,255,255,.8);
}

.siddel-logo.theme-light .siddel-logo-sub {
  color: var(--text-muted);
}

.siddel-logo-credit {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  letter-spacing: .2px;
}

/* ==========================================================================
   COMPONENTES UI GLOBALES: BOTONES & INPUTS
   ========================================================================== */
.btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .2s ease;
  font-family: inherit;
  text-decoration: none;
  line-height: 1.2;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-navy-light) 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(10,37,64,.15);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-navy-light) 0%, var(--brand-navy) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(10,37,64,.25);
  color: white;
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-accent {
  background: linear-gradient(135deg, var(--brand-cyan) 0%, var(--brand-orange) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(255,107,53,.25);
}

.btn-accent:hover {
  background: linear-gradient(135deg, var(--brand-cyan-dark) 0%, var(--brand-orange-dark) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255,107,53,.35);
  color: white;
}

.btn-accent:active {
  transform: translateY(0);
}

.btn-ghost {
  background: white;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg);
  border-color: #cbd5e1;
}

.btn-block {
  width: 100%;
}

/* Formularios */
.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: .2px;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: 16px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: white;
  color: var(--text);
  font-family: inherit;
  transition: all .2s ease;
}

.form-control.has-icon {
  padding-left: 42px;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 3.5px rgba(0, 180, 216, .18);
  background: white;
}

.form-control::placeholder {
  color: #94a3b8;
  font-size: 13.5px;
}

.password-toggle-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: color .2s;
}

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

/* Alertas */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  line-height: 1.4;
}

.alert-danger {
  background: var(--danger-bg);
  border-color: #fca5a5;
  color: #991b1b;
}

.alert-success {
  background: #d1fae5;
  border-color: #a7f3d0;
  color: #065f46;
}

.alert-warning {
  background: var(--warning-bg);
  border-color: #fde68a;
  color: #92400e;
}

/* ==========================================================================
   PÁGINA DE LOGIN MODERNA (ESTILO SIDDEL)
   ========================================================================== */
.login-body-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--brand-navy) 0%, #0d2e50 50%, var(--brand-navy-light) 100%);
  position: relative;
  overflow: hidden;
  padding: 24px;
}

/* Efectos visuales de fondo */
.login-bg-glow {
  position: absolute;
  width: 550px;
  height: 550px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(100px);
  opacity: .25;
}

.login-bg-glow.glow-cyan {
  top: -150px;
  left: -150px;
  background: var(--brand-cyan);
}

.login-bg-glow.glow-orange {
  bottom: -150px;
  right: -150px;
  background: var(--brand-orange);
}

.login-container {
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 10;
}

.login-card {
  position: relative;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, .4);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 255, 255, .1);
  overflow: hidden;
  transition: transform .2s ease;
}

.login-company-logo {
  position: absolute;
  top: 18px;
  left: 20px;
  display: flex;
  align-items: center;
  z-index: 5;
}

.login-company-logo img {
  height: 48px;
  width: auto;
  object-fit: contain;
  transition: transform .2s ease;
}

.login-company-logo img:hover {
  transform: scale(1.05);
}


.login-card-header {
  padding: 36px 32px 24px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.login-card-header .siddel-logo {
  margin-bottom: 12px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.login-card-body {
  padding: 32px;
  background: #ffffff;
}

.login-card-footer {
  padding: 16px 32px 24px;
  text-align: center;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.login-card-footer a {
  color: var(--brand-cyan-dark);
  text-decoration: none;
  font-weight: 600;
}

.login-card-footer a:hover {
  text-decoration: underline;
}

.login-legal {
  margin-top: 18px;
  text-align: center;
  color: rgba(255, 255, 255, .55);
  font-size: 11.5px;
  letter-spacing: .2px;
}

/* ==========================================================================
   ESTRUCTURA DE APLICACIÓN (SIDEBAR & MAIN)
   ========================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,37,64,.5);
  backdrop-filter: blur(2px);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: all .3s;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--brand-navy) 0%, var(--brand-navy-light) 100%);
  color: white;
  padding: 0;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform .3s ease;
  box-shadow: 2px 0 16px rgba(10,37,64,.2);
}

/* 1. Header Compacto */
.sidebar-header-compact {
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-version-badge {
  font-size: 9.5px;
  font-weight: 800;
  color: var(--brand-cyan);
  background: rgba(0,180,216,.15);
  border: 1px solid rgba(0,180,216,.25);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .5px;
}

.sidebar-credit-compact {
  font-size: 9px;
  opacity: .45;
  margin-top: 4px;
  font-style: italic;
  letter-spacing: .2px;
}

/* 2. Buscador Rápido (Quick Search) */
.sidebar-quick-search {
  padding: 7px 12px;
  position: relative;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.08);
}

.sidebar-quick-search input {
  width: 100%;
  padding: 5.5px 24px 5.5px 38px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  font-size: 11.5px;
  color: white;
  outline: none;
  font-family: inherit;
  transition: all .2s;
}

#sidebarNavSearch {
  padding-left: 38px !important;
}

.sidebar-quick-search input:focus {
  background: rgba(255,255,255,.14);
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 2px rgba(0,180,216,.2);
}

.sidebar-quick-search input::placeholder {
  color: rgba(255,255,255,.45);
}

.sidebar-search-icon {
  position: absolute;
  left: 19px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  opacity: .5;
  pointer-events: none;
}

.sidebar-search-clear {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}

.sidebar-search-clear:hover {
  color: white;
  background: rgba(255,255,255,.15);
}

/* 3. Zona Central con Scroll Independiente */
.sidebar-nav-container {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px;
  min-height: 0;
}

/* Slim scrollbar para el menú */
.sidebar-nav-container::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav-container::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav-container::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 4px;
}
.sidebar-nav-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,.3);
}

.nav-section {
  margin-bottom: 4px;
  overflow: hidden;
}

.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  cursor: pointer;
  user-select: none;
  border-radius: 6px;
  transition: background .15s;
}

.nav-section-header:hover {
  background: rgba(255,255,255,.06);
}

.nav-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  opacity: .5;
  font-weight: 800;
  flex: 1;
}

.nav-section-toggle {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  transition: transform .25s ease;
  opacity: .5;
}

.nav-section-toggle svg {
  width: 12px;
  height: 12px;
  stroke: white;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-section.open .nav-section-toggle {
  transform: rotate(180deg);
  opacity: .85;
}

.nav-section.open .nav-label {
  opacity: .75;
}

.nav-section.fixed .nav-section-header {
  cursor: default;
  padding-bottom: 4px;
}

.nav-section.fixed .nav-section-header:hover {
  background: transparent;
}

.nav-section.fixed .nav-section-toggle {
  display: none;
}

.nav-section.fixed .nav-label {
  opacity: .5;
}

.nav-section.fixed .nav-items {
  max-height: none;
  opacity: 1;
}

.nav-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s cubic-bezier(0.4, 0, 0.2, 1), opacity .2s ease;
  opacity: 0;
}

.nav-section.open .nav-items {
  max-height: 800px;
  opacity: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 12px;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  transition: all .15s;
  margin-bottom: 1px;
  cursor: pointer;
  border-radius: 6px;
  line-height: 1.25;
}

.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: white;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(0,180,216,.22), rgba(0,180,216,.06));
  color: white;
  box-shadow: inset 3px 0 0 var(--brand-cyan);
  font-weight: 600;
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.nav-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-badge {
  margin-left: auto;
  background: var(--brand-orange);
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 800;
  line-height: 1.2;
}

/* 4. Footer Ultra-Compacto de Usuario (Fijo abajo) */
.sidebar-user-footer {
  flex-shrink: 0;
  padding: 7px 10px;
  border-top: 1px solid rgba(255,255,255,.09);
  background: rgba(0,0,0,.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.sidebar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-cyan), var(--brand-orange));
  color: white;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.sidebar-user-meta {
  min-width: 0;
  flex: 1;
}

.sidebar-user-name {
  font-size: 11.5px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.sidebar-user-role {
  font-size: 9.5px;
  color: rgba(255,255,255,.5);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.sidebar-action-btn {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: 12px;
  transition: all .15s;
  border: 1px solid transparent;
}

.sidebar-action-btn:hover {
  background: rgba(255,255,255,.12);
  color: white;
}

.sidebar-action-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-action-btn.logout:hover {
  background: rgba(239,68,68,.25);
  color: #fca5a5;
  border-color: rgba(239,68,68,.3);
}

/* ==========================================================================
   MAIN, HEADER & PANELS
   ========================================================================== */
.main {
  margin-left: 260px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100% - 260px);
  width: calc(100% - 260px);
  min-height: 100vh;
  box-sizing: border-box;
  overflow-x: hidden;
  position: relative;
  transition: margin-right .3s;
}

.main.drawer-open {
  margin-right: var(--drawer-width);
  max-width: calc(100% - 260px - var(--drawer-width));
  width: calc(100% - 260px - var(--drawer-width));
}

.header {
  background: var(--surface);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.4px;
  color: var(--brand-navy);
}

.header-left p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.search-box {
  position: relative;
}

.search-box input {
  padding: 9px 14px 9px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 240px;
  background: var(--bg);
  transition: all .2s;
  font-family: inherit;
}

.search-box input:focus {
  outline: none;
  border-color: var(--brand-cyan);
  background: white;
  box-shadow: 0 0 0 3px rgba(0,180,216,.15);
}

.search-box::before {
  content: "🔍";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: .5;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 16px;
  position: relative;
  transition: all .2s;
}

.icon-btn:hover {
  background: var(--bg);
}

.icon-btn .dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  background: var(--brand-orange);
  border-radius: 50%;
  border: 2px solid white;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 5px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .2s;
}

.user-menu:hover {
  background: var(--bg);
}

.user-dropdown-item:hover {
  background: #f1f5f9 !important;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-cyan), var(--brand-orange));
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

.content {
  padding: 24px 28px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
}

/* Contenedores con scroll horizontal aislado (solo ese elemento se desplaza) */
.table-wrap,
.table-responsive,
.siddel-table-container,
.kanban-wrapper {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar,
.kanban-wrapper::-webkit-scrollbar {
  height: 6px;
}
.table-wrap::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track,
.kanban-wrapper::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.table-wrap::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb,
.kanban-wrapper::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.table-wrap::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover,
.kanban-wrapper::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--brand-navy);
}

.panel-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-group {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 3px;
  border-radius: var(--radius-sm);
}

.filter-btn {
  padding: 7px 14px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .2s;
  font-family: inherit;
}

.filter-btn.active {
  background: white;
  color: var(--brand-navy);
  box-shadow: var(--shadow-sm);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  padding: 18px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  transition: transform .2s, box-shadow .2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.kpi-card.clickable {
  cursor: pointer;
}

.kpi-card.clickable:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.kpi-card.clickable.active-filter {
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 2px rgba(0,180,216,.2), var(--shadow);
}

.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 700;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  margin-top: 6px;
  letter-spacing: -.5px;
}

.kpi-sub {
  font-size: 11px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.kpi-sub.up { color: var(--success); }
.kpi-sub.down { color: var(--danger); }

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.kpi-icon.blue { background: rgba(0,180,216,.12); }
.kpi-icon.orange { background: rgba(255,107,53,.12); }
.kpi-icon.red { background: rgba(239,68,68,.1); }
.kpi-icon.green { background: rgba(16,185,129,.1); }

/* Table styling */
.table-wrap { overflow-x: auto; }
table.siddel-table { width: 100%; border-collapse: collapse; }
table.siddel-table thead th {
  background: #f8fafc;
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

table.siddel-table thead th.sortable {
  cursor: pointer;
  transition: background .15s, color .15s;
  position: relative;
  padding-right: 28px;
}

table.siddel-table thead th.sortable:hover {
  background: #eef2f7;
  color: var(--brand-navy);
}

table.siddel-table thead th.sortable .sort-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  opacity: .3;
  display: flex;
  flex-direction: column;
  line-height: 1;
  gap: 1px;
}

table.siddel-table thead th.sortable:hover .sort-icon { opacity: .5; }
table.siddel-table thead th.sortable.active .sort-icon { opacity: 1; color: var(--brand-cyan); }
table.siddel-table thead th.sortable.active .sort-icon .arrow-up,
table.siddel-table thead th.sortable.active .sort-icon .arrow-down { opacity: .3; }
table.siddel-table thead th.sortable.active.asc .sort-icon .arrow-up { opacity: 1; color: var(--brand-cyan); }
table.siddel-table thead th.sortable.active.desc .sort-icon .arrow-down { opacity: 1; color: var(--brand-cyan); }

table.siddel-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}

table.siddel-table tbody tr {
  cursor: pointer;
  transition: background .15s;
  border-left: 3px solid transparent;
}

table.siddel-table tbody tr:hover { background: #f8fafc; }
table.siddel-table tbody tr:last-child td { border-bottom: none; }
table.siddel-table tbody tr.row-warning { border-left-color: var(--warning); }
table.siddel-table tbody tr.row-danger { border-left-color: var(--danger); }

.rrs-id {
  font-weight: 700;
  color: var(--brand-navy);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rrs-id .arrow { font-size: 12px; color: var(--text-muted); transition: transform .2s; }
table.siddel-table tbody tr:hover .rrs-id .arrow { transform: translateX(3px); color: var(--brand-cyan); }

.alert-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.alert-indicator.warn { background: var(--warning-bg); color: #92400e; }
.alert-indicator.alert { background: var(--danger-bg); color: #991b1b; animation: pulseAlert 2s infinite; }
@keyframes pulseAlert { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }

.date-cell { display: flex; flex-direction: column; gap: 2px; }
.date-main { font-weight: 600; font-size: 13px; }
.date-time { font-size: 11px; color: var(--text-muted); }
.elapsed-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; margin-top: 4px; width: fit-content; }
.elapsed-badge.warn { background: var(--warning-bg); color: #92400e; }
.elapsed-badge.alert { background: var(--danger-bg); color: #991b1b; animation: pulseAlert 2s infinite; }

.contract-cell { display: flex; flex-direction: column; gap: 4px; }
.contract-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--brand-cyan-dark); text-decoration: none; transition: all .2s; padding: 2px 0; }
.contract-link:hover { color: var(--brand-navy); text-decoration: underline; }
.contract-link::before { content: "📄"; font-size: 12px; opacity: .7; }
.client-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--brand-orange-dark); text-decoration: none; transition: all .2s; padding: 2px 0; }
.client-link:hover { color: var(--brand-navy); text-decoration: underline; }
.client-link::before { content: "👥"; font-size: 12px; opacity: .7; }
.service-text { font-size: 12px; color: var(--text-muted); font-weight: 500; padding-left: 2px; }

.responsible-cell { display: flex; align-items: center; gap: 10px; }
.responsible-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: white; flex-shrink: 0; border: 2px solid white; box-shadow: 0 0 0 1px var(--border); }
.responsible-name { font-size: 13px; font-weight: 600; }
.responsible-role { font-size: 11px; color: var(--text-muted); }
.role-badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }
.role-badge.inspector { background: #dbeafe; color: #1e40af; }
.role-badge.operador { background: #e0e7ff; color: #3730a3; }
.role-badge.ayudante { background: #f3e8ff; color: #6b21a8; }
.role-badge.administrador { background: #fef3c7; color: #92400e; }
.role-badge.administracion { background: #d1fae5; color: #065f46; }

.stage-cell { display: flex; flex-direction: column; gap: 6px; }
.stage-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 16px; font-size: 11px; font-weight: 700; width: fit-content; }
.stage-pill.preparacion { background: #f1f5f9; color: #475569; }
.stage-pill.ejecucion { background: #e0f2fe; color: #0369a1; }
.stage-pill.revelado { background: #ffedd5; color: #c2410c; }
.stage-pill.evaluacion { background: #e0f2fe; color: #0284c7; }
.stage-pill.digitacion { background: #f3e8ff; color: #7e22ce; }
.stage-pill.parcial { background: #fef3c7; color: #92400e; }
.stage-pill.revision { background: #fed7aa; color: #d97706; }
.stage-pill.subido { background: #dbeafe; color: #1e40af; }
.stage-pill.entregado { background: #dcfce7; color: #166534; }
.stage-pill.en-curso { background: #dbeafe; color: #1e40af; }
.stage-pill.aprobacion { background: #a7f3d0; color: #065f46; }
.stage-pill.entrega { background: #99f6e4; color: #115e59; }
.stage-pill.manager { background: #bae6fd; color: #075985; }
.stage-pill.terminado { background: #d1fae5; color: #064e3b; }
.stage-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.stage-person { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #f8fafc; border-radius: 8px; border: 1px solid var(--border); }
.stage-person-avatar { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; font-weight: 700; color: white; flex-shrink: 0; }
.stage-person-info { display: flex; flex-direction: column; gap: 1px; }
.stage-person-name { font-weight: 600; color: var(--text); font-size: 12px; }
.stage-person-role { font-size: 10px; color: var(--text-muted); }

.stage-assigned-date { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--text-muted); padding: 2px 6px; background: rgba(0,180,216,.08); border-radius: 4px; font-weight: 500; width: fit-content; }
.stage-assigned-date .cal-icon { font-size: 10px; opacity: .7; }

.download-cell { text-align: center; }
.download-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: white; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; color: var(--brand-cyan-dark); transition: all .2s; position: relative; }
.download-btn:hover { background: var(--brand-cyan); color: white; border-color: var(--brand-cyan); transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,180,216,.3); }
.download-btn:active { transform: translateY(0); }
.download-btn.downloading { background: var(--success); color: white; border-color: var(--success); pointer-events: none; }
.download-btn .tooltip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--brand-navy); color: white; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; white-space: nowrap; opacity: 0; visibility: hidden; transition: all .2s; margin-bottom: 6px; pointer-events: none; }
.download-btn .tooltip::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 4px solid transparent; border-top-color: var(--brand-navy); }
.download-btn:hover .tooltip { opacity: 1; visibility: visible; }

.table-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-muted); background: #fafbfc; flex-wrap: wrap; gap: 12px; }
.legend { display: flex; gap: 16px; font-size: 12px; align-items: center; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.legend-line { width: 3px; height: 14px; border-radius: 2px; }
.legend-line.normal { background: transparent; border: 1px solid var(--border); }
.legend-line.warn { background: var(--warning); }
.legend-line.alert { background: var(--danger); }
.pagination { display: flex; gap: 4px; }
.page-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: white; cursor: pointer; font-size: 13px; font-weight: 600; transition: all .2s; font-family: inherit; }
.page-btn:hover { background: var(--bg); }
.page-btn.active { background: var(--brand-navy); color: white; border-color: var(--brand-navy); }

/* Drawer / Modal Details */
.drawer-overlay { position: fixed; inset: 0; background: rgba(10,37,64,.4); backdrop-filter: blur(2px); z-index: 200; opacity: 0; visibility: hidden; transition: all .3s; }
.drawer-overlay.active { opacity: 1; visibility: visible; }
.drawer { position: fixed; top: 0; right: 0; width: var(--drawer-width); height: 100vh; background: var(--surface); z-index: 300; transform: translateX(100%); transition: transform .35s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column; box-shadow: var(--shadow-xl); }
.drawer.active { transform: translateX(0); }
.drawer-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; background: linear-gradient(135deg, var(--brand-navy), var(--brand-navy-light)); color: white; }
.drawer-header-left h2 { font-size: 22px; font-weight: 800; font-family: 'JetBrains Mono', monospace; letter-spacing: -.5px; }
.drawer-header-left p { font-size: 13px; opacity: .8; margin-top: 4px; }
.drawer-close { width: 34px; height: 34px; border-radius: 8px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.1); color: white; cursor: pointer; display: grid; place-items: center; font-size: 18px; transition: all .2s; }
.drawer-close:hover { background: rgba(255,255,255,.2); }
.drawer-body { flex: 1; overflow-y: auto; padding: 24px; }
.drawer-body::-webkit-scrollbar { width: 6px; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.info-section { margin-bottom: 24px; }
.info-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.info-section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.info-item { background: var(--bg); padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.info-item.full { grid-column: 1 / -1; }
.info-label { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); font-weight: 700; margin-bottom: 4px; }
.info-value { font-size: 14px; font-weight: 600; color: var(--text); }
.info-value.mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.current-stage-card { background: linear-gradient(135deg, rgba(0,180,216,.08), rgba(255,107,53,.05)); border: 2px solid var(--brand-cyan); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; display: flex; align-items: center; gap: 14px; }
.current-stage-icon { width: 48px; height: 48px; background: linear-gradient(135deg, var(--brand-cyan), var(--brand-orange)); border-radius: 12px; display: grid; place-items: center; font-size: 22px; color: white; flex-shrink: 0; }
.current-stage-info h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--brand-cyan-dark); font-weight: 700; }
.current-stage-info .stage-name { font-size: 16px; font-weight: 700; margin-top: 2px; color: var(--brand-navy); }
.current-stage-info .stage-responsible { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.team-card { background: linear-gradient(135deg, rgba(255,107,53,.06), rgba(255,107,53,.02)); border: 1.5px solid rgba(255,107,53,.25); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
.team-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.team-card-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark)); border-radius: 10px; display: grid; place-items: center; font-size: 18px; color: white; }
.team-card-title { font-size: 13px; font-weight: 700; color: var(--brand-navy); }
.team-card-subtitle { font-size: 11px; color: var(--text-muted); }
.team-members { display: flex; flex-direction: column; gap: 8px; }
.team-member { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: white; border-radius: 8px; border: 1px solid var(--border); transition: all .2s; }
.team-member:hover { border-color: var(--brand-orange); box-shadow: 0 2px 4px rgba(255,107,53,.1); }
.team-member-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: white; flex-shrink: 0; }
.team-member-info { flex: 1; }
.team-member-name { font-size: 13px; font-weight: 600; color: var(--text); }
.team-member-role { font-size: 11px; color: var(--text-muted); }
.team-member-stage { font-size: 10px; padding: 3px 8px; border-radius: 12px; font-weight: 600; background: rgba(0,180,216,.1); color: var(--brand-cyan-dark); white-space: nowrap; }
.team-member-stage.current { background: var(--brand-orange); color: white; }

.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 18px; display: flex; gap: 14px; align-items: flex-start; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -22px; top: 4px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); background: white; display: grid; place-items: center; font-size: 10px; z-index: 1; }
.timeline-item.completed .timeline-dot { background: var(--success); border-color: var(--success); color: white; }
.timeline-item.active .timeline-dot { background: linear-gradient(135deg, var(--brand-cyan), var(--brand-orange)); border-color: var(--brand-cyan); color: white; box-shadow: 0 0 0 4px rgba(0,180,216,.2); animation: pulseDot 2s infinite; }
@keyframes pulseDot { 0%, 100% { box-shadow: 0 0 0 4px rgba(0,180,216,.2); } 50% { box-shadow: 0 0 0 8px rgba(0,180,216,.05); } }
.timeline-item.pending .timeline-dot { background: var(--bg); border-color: var(--border); }
.timeline-content { flex: 1; padding: 10px 14px; background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.timeline-item.active .timeline-content { background: linear-gradient(135deg, rgba(0,180,216,.06), rgba(255,107,53,.03)); border-color: var(--brand-cyan); border-width: 1.5px; }
.timeline-item.completed .timeline-content { opacity: .7; }
.timeline-stage { font-size: 13px; font-weight: 700; color: var(--text); }
.timeline-item.pending .timeline-stage { color: var(--text-muted); font-weight: 500; }
.timeline-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; flex-wrap: wrap; gap: 6px; }
.timeline-responsible { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); font-weight: 500; }
.timeline-responsible .mini-avatar { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; font-weight: 700; color: white; }
.timeline-date { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.timeline-item.active .timeline-date { color: var(--brand-cyan-dark); font-weight: 600; }
.drawer-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; background: #fafbfc; }
.drawer-footer .btn { flex: 1; justify-content: center; padding: 11px; }

/* Modal de Personalización */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,37,64,.5);
  backdrop-filter: blur(3px);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all .25s ease;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal-card {
  background: var(--surface);
  width: 90%;
  max-width: 520px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: translateY(20px);
  transition: transform .25s ease;
}
.modal-overlay.active .modal-card {
  transform: translateY(0);
}
.modal-header {
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-navy-light));
  color: white;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}
.modal-body {
  padding: 24px;
}
.modal-footer {
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.panel-option-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.panel-option-item:hover {
  background: #f8fafc;
  border-color: var(--brand-cyan);
}
.panel-option-item input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--brand-cyan);
  cursor: pointer;
}
.panel-option-info {
  flex: 1;
}
.panel-option-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-navy);
}
.panel-option-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}


/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: var(--shadow-xl);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
    max-width: 100%;
    width: 100%;
  }

  .main.drawer-open {
    margin-right: 0;
  }

  .header {
    padding: 12px 16px;
  }

  .content {
    padding: 16px;
  }

  .user-name, .user-role {
    display: none;
  }
}

@media (max-width: 480px) {
  .login-company-logo {
    top: 14px;
    left: 14px;
  }

  .login-company-logo img {
    height: 38px;
  }

  .login-card-header {
    padding: 28px 20px 20px;
  }


  .login-card-body {
    padding: 24px 20px;
  }

  .login-card-footer {
    padding: 16px 20px;
  }
}
