/* ===================================
   SG-SST SISTEMA DE GESTIÓN - STYLES
   =================================== */

:root {
  --primary: #0284c7;
  /* Sky 600 */
  --primary-dark: #0369a1;
  /* Sky 700 */
  --primary-light: #7dd3fc;
  /* Sky 300 */
  --secondary: #0d9488;
  /* Teal 600 */
  --accent: #f59e0b;
  /* Amber 500 */
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;

  --bg-dark: #f8fafc;
  /* Slate 50 - Fondo de página */
  --bg-card: #ffffff;
  --bg-card2: #f1f5f9;
  /* Slate 100 */
  --bg-sidebar: #ffffff;
  --border: #e2e8f0;
  /* Slate 200 */
  --border-hover: #cbd5e1;

  --text-primary: #0f172a;
  /* Slate 900 */
  --text-secondary: #475569;
  /* Slate 600 */
  --text-muted: #94a3b8;
  /* Slate 400 */

  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --glow: 0 0 20px rgba(2, 132, 199, 0.05);

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.desktop-only {
  display: flex !important;
}

.mobile-only {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 99px;
  border: 2px solid var(--bg-dark);
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ===== GLASS CARD ===== */
.glass-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(circle at 10% 20%, rgba(2, 132, 199, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(13, 148, 136, 0.04) 0%, transparent 40%),
    var(--bg-dark);
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: floatOrb 8s ease-in-out infinite;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: rgba(99, 102, 241, 0.2);
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.orb-2 {
  width: 350px;
  height: 350px;
  background: rgba(139, 92, 246, 0.15);
  bottom: -80px;
  right: -80px;
  animation-delay: -3s;
}

.orb-3 {
  width: 250px;
  height: 250px;
  background: rgba(16, 185, 129, 0.1);
  top: 50%;
  left: 50%;
  animation-delay: -5s;
}

@keyframes floatOrb {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(30px, -20px) scale(1.05);
  }

  66% {
    transform: translate(-20px, 30px) scale(0.95);
  }
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 24px;
}

.login-card {
  padding: 40px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 36px;
}

.logo-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.5));
}

.logo-icon svg {
  width: 100%;
  height: 100%;
}

.logo-text h1 {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.login-form-wrapper h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.login-form-wrapper .subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
  margin-top: 4px;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
}

.input-icon svg {
  width: 18px;
  height: 18px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 12px 14px 12px 44px;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

input:not(.input-wrapper input),
select:not(.input-wrapper select) {
  padding: 12px 14px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.1);
}

.input-wrapper input {
  padding-right: 44px;
}

.toggle-pass {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  padding: 4px;
}

.toggle-pass svg {
  width: 18px;
  height: 18px;
}

select {
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

select option {
  background: #1a1a2e;
  color: var(--text-primary);
}

textarea {
  padding: 12px 14px;
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card2);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
}

.btn svg {
  width: 18px;
  height: 18px;
}

/* Login specific */
.login-footer {
  margin-top: 24px;
  text-align: center;
}

.login-footer p {
  font-size: 12px;
  color: var(--text-muted);
}

.demo-hint {
  margin-top: 12px;
  padding: 10px 16px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-sm);
}

.demo-hint span {
  font-size: 12px;
  color: var(--primary-light);
  font-family: monospace;
}

.login-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
}

.info-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* ===== APP LAYOUT ===== */
.app-page {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon-sm {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.logo-icon-sm svg {
  width: 100%;
  height: 100%;
}

.logo-title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.logo-sub {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
}

.sidebar-toggle svg {
  width: 20px;
  height: 20px;
}

.sidebar-user {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-info {
  overflow: hidden;
}

.user-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section {
  margin-bottom: 20px;
}

.nav-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item:hover {
  background: var(--bg-card2);
  color: var(--primary);
}

.nav-item:hover svg {
  opacity: 1;
}

.nav-item.active {
  background: rgba(2, 132, 199, 0.08);
  /* primary light alpha */
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active svg {
  opacity: 1;
  color: var(--primary);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--bg-card2);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--border);
}

.nav-item.active .nav-badge {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.btn-add-section {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.btn-add-section svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.btn-add-section:hover {
  background: #ffffff;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.15);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.btn-logout svg {
  width: 16px;
  height: 16px;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  filter: brightness(1.1);
}

/* MAIN CONTENT */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

/* TOPBAR */
.topbar {
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  z-index: 1001;
}

.menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.menu-btn svg {
  width: 20px;
  height: 20px;
}

.breadcrumb {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-right {
  display: flex !important;
  align-items: center;
  gap: 20px;
}

.notif-wrapper {
  position: relative;
}

.notif-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.notif-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--primary);
  border-color: var(--primary);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #0f172a;
}

.notif-panel {
  position: absolute;
  top: 52px;
  right: 0;
  width: 340px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}

.notif-panel.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.notif-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notif-header h4 {
  margin: 0;
  font-size: 14px;
}

.notif-list {
  max-height: 350px;
  overflow-y: auto;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  gap: 12px;
  cursor: default;
  transition: background 0.2s;
}

.notif-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.notif-icon-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-content p {
  margin: 0;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}

.notif-content span {
  font-size: 11px;
  color: var(--text-muted);
}

.notif-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.topbar-time {
  font-size: 13px;
  color: var(--text-muted);
  font-family: monospace;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-menu span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* CONTENT */
.content-area {
  padding: 24px;
  flex: 1;
}

/* SECTION */
.section {
  display: none;
}

.section.active {
  display: block;
  animation: fadeSlide 0.3s ease;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.section-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.section-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.stat-icon.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.stat-icon.secondary {
  background: linear-gradient(135deg, var(--secondary), #0d9488);
  color: white;
}

.stat-icon.warning {
  background: linear-gradient(135deg, var(--warning), #d97706);
  color: white;
}

.stat-icon.danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
}

.stat-icon.info {
  background: linear-gradient(135deg, var(--info), #2563eb);
  color: white;
}

.stat-icon svg {
  width: 26px;
  height: 26px;
  stroke: white;
}

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* CHARTS */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.module-charts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}

.chart-card:hover {
  border-color: var(--border-hover);
}

.chart-card.mini {
  padding: 16px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-period {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: 99px;
}

.chart-wrapper {
  height: 200px;
  position: relative;
}

.chart-wrapper-sm {
  height: 150px;
  position: relative;
}

/* TABLE CARD */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-toolbar {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.search-box input {
  padding-left: 36px !important;
  padding-right: 12px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  background: rgba(255, 255, 255, 0.02);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.filter-grid {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex: 1;
  flex-wrap: wrap;
}

.filter-header {
  display: none;
}

.filter-group {
  display: flex;
  gap: 8px;
}

.filter-group select {
  padding: 8px 12px !important;
  width: auto;
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.table-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

/* Table elements */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge-success {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #d1fae5;
}

.badge-warning {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fef3c7;
}

.badge-danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fee2e2;
}

.badge-info {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #dbeafe;
}

.badge-purple {
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ede9fe;
}

.badge-gray {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.action-btns {
  display: flex;
  gap: 6px;
}

.btn-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon svg {
  width: 14px;
  height: 14px;
}

.btn-icon-edit {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
}

.btn-icon-edit:hover {
  background: rgba(99, 102, 241, 0.3);
}

.btn-icon-delete {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.btn-icon-delete:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-icon-view {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}

.btn-icon-view:hover {
  background: rgba(16, 185, 129, 0.25);
}

.file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 99px;
  color: #60a5fa;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-link:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.no-file {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* MODALS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-lg {
  max-width: 720px;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  transition: var(--transition);
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.2);
  transform: rotate(90deg);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Icon Picker */
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-opt {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.icon-opt:hover {
  background: rgba(255, 255, 255, 0.1);
}

.icon-opt.selected {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
}

/* Custom columns */
.col-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.col-name {
  flex: 2;
}

.col-type {
  flex: 1;
}

.btn-remove-col {
  background: rgba(239, 68, 68, 0.1);
  border: none;
  color: #f87171;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.btn-remove-col:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-add-col {
  background: rgba(99, 102, 241, 0.1);
  border: 1px dashed rgba(99, 102, 241, 0.3);
  color: var(--primary-light);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}

.btn-add-col:hover {
  background: rgba(99, 102, 241, 0.2);
}

/* File input */
.file-input-wrapper {
  position: relative;
}

.file-drop-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(255, 255, 255, 0.02);
}

.file-drop-area:hover,
.file-drop-area.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.file-drop-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.file-drop-text {
  font-size: 13px;
  color: var(--text-muted);
}

.file-drop-text strong {
  color: var(--primary-light);
}

.file-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #60a5fa;
}

/* ADMIN */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* Status badges */
.status-active {
  color: #34d399;
}

.status-inactive {
  color: #f87171;
}

/* TOAST */
.data-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px;
  padding: 0 16px;
  width: calc(100% + 32px);
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--bg-card2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text-primary);
  min-width: 260px;
  max-width: 380px;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-success {
  border-left: 3px solid #34d399;
}

.toast-error {
  border-left: 3px solid #f87171;
}

.toast-info {
  border-left: 3px solid #60a5fa;
}

.toast-icon {
  font-size: 16px;
}

/* SIDEBAR COLLAPSED */
.sidebar.collapsed {
  transform: translateX(-100%);
}

.main-content.expanded {
  margin-left: 0;
}

/* FILE VIEWER */
.file-viewer {
  text-align: center;
}

.file-viewer img {
  max-width: 100%;
  max-height: 500px;
  border-radius: var(--radius-sm);
}

.file-viewer iframe {
  width: 100%;
  height: 500px;
  border: none;
  border-radius: var(--radius-sm);
}

.file-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

/* EMPTY STATE */
.empty-state {
  padding: 60px 20px;
  text-align: center;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-muted);
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  .content-area {
    padding: 16px;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  .charts-grid,
  .module-charts,
  .module-charts-2,
  .stats-grid {
    grid-template-columns: 1fr !important;
    width: 100% !important;
    gap: 16px !important;
  }

  .chart-card {
    width: 100% !important;
    margin-bottom: 8px;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: flex !important;
  }

  .section-actions .search-box {
    display: none !important;
  }

  .filter-bar {
    display: none !important;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    padding: 20px !important;
    margin-top: 0 !important;
  }

  .filter-bar.active {
    display: flex !important;
    animation: fadeIn 0.25s ease;
  }

  .filter-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
    width: 100%;
  }

  .filter-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
  }

  .btn-close-filter {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
  }

  .filter-grid {
    background: var(--bg-card);
    background-image: linear-gradient(rgba(255, 255, 255, 0.05), transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 380px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  }

  .filter-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .filter-item label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
  }

  .filter-item input,
  .filter-item select {
    width: 100% !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--border) !important;
    height: 42px !important;
  }

  .filter-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
  }

  .filter-item {
    width: 100%;
  }

  .filter-item input,
  .filter-item select {
    width: 100% !important;
  }

  canvas {
    max-width: 100% !important;
  }

  .content-area {
    padding: 16px;
    width: 100%;
    overflow-x: hidden;
  }

  .table-wrapper {
    margin: 0 -16px;
    padding: 0 16px;
    width: calc(100% + 32px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .section-actions {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .content-area {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* MOBILE TABLE OPTIMIZATIONS */
@media (max-width: 768px) {
  /* Hide certain non-critical columns on mobile to save space */
  /* Hide Trabajador Cédula (2nd cell in some tables) or similar if needed */
  /* Actually, better to hide secondary text columns */

  .data-table th:nth-child(4),
  .data-table td:nth-child(4) {
    display: none;
    /* Often 'Cargo' or 'Días' or 'Observaciones' */
  }

  .topbar-time {
    display: none;
    /* Hide time in topbar on mobile */
  }

  .modal {
    width: 95% !important;
    max-height: 90vh;
    overflow-y: auto;
  }

  .sidebar {
    width: 260px;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }

  .sidebar-overlay {
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(4px) !important;
  }
}

/* Better table scroll */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Print / PDF styles */
@media print {

  .sidebar,
  .topbar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .section {
    display: block !important;
  }

  .table-card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* ===== EXTRA: XL MODAL ===== */
.modal-xl {
  max-width: 900px;
}

/* ===== FILE PREVIEW MODAL ===== */
.file-preview-area {
  width: 100%;
  min-height: 400px;
  background: #0a0a14;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.file-preview-area img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 0;
  display: block;
}

.file-preview-area iframe {
  width: 100%;
  height: 70vh;
  border: none;
  display: block;
  background: #fff;
}

.file-preview-area .no-preview {
  padding: 40px;
  text-align: center;
}

.file-preview-area .no-preview .icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.file-preview-area .no-preview p {
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== UPLOAD PROGRESS ===== */
.upload-progress-wrap {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  display: none;
}

.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 99px;
  transition: width 0.3s ease;
}

.upload-status {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.upload-status.success {
  color: #34d399;
}

.upload-status.error {
  color: #f87171;
}

.file-drop-area.has-file {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.04);
}

/* ===== LINK BUTTON IN TABLE ===== */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 99px;
  color: var(--primary-light);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

.link-btn:hover {
  background: rgba(99, 102, 241, 0.3);
  color: white;
}

.link-btn svg {
  width: 12px;
  height: 12px;
}

/* ===== COL-OPTS (opciones desplegable) ===== */
.col-opts {
  flex: 1.5;
  font-size: 12px !important;
  padding: 8px 10px !important;
}

.col-row {
  flex-wrap: wrap;
}

/* ===== MODULE-CHARTS 2-col variant ===== */
.module-charts-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}