/* ============================================================
   CN SEGURIDAD — Panel Admin CSS
   Palette: #ff0000 (red) · #000 (black) · #fff (white)
   Fonts:   Exo 2 (display) · DM Sans (body)
   ============================================================ */

:root {
  --red:           #ff0000;
  --red-soft:      rgba(255,0,0,.08);
  --red-border:    rgba(255,0,0,.2);
  --sidebar-w:     240px;
  --sidebar-bg:    #0d0d0d;
  --sidebar-hover: #1a1a1a;
  --topbar-h:      60px;
  --white:         #ffffff;
  --bg:            #f4f5f7;
  --card-bg:       #ffffff;
  --border:        #e8e8e8;
  --text-main:     #111111;
  --text-sub:      #6b7280;
  --font-display:  'Exo 2', sans-serif;
  --font-body:     'DM Sans', sans-serif;
  --radius:        10px;
  --shadow-sm:     0 1px 4px rgba(0,0,0,.06);
  --shadow-md:     0 4px 16px rgba(0,0,0,.10);
  --transition:    .2s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body.panel-body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg);
  margin: 0;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform var(--transition), width var(--transition);
  border-right: 1px solid #1a1a1a;
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: var(--topbar-h);
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
}
.sidebar-logo {
  height: 32px;
  width: auto;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}
.sidebar-brand-text {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: .04em;
  white-space: nowrap;
}

/* Nav */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-menu { list-style: none; padding: 0; margin: 0; }
.sidebar-item { margin: 2px 8px; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #888;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
}
.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: var(--white);
}
.sidebar-item.active .sidebar-link {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.sidebar-item.active .sidebar-link .sidebar-icon {
  color: var(--red);
}

.sidebar-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  color: #555;
  transition: color var(--transition);
}
.sidebar-link:hover .sidebar-icon { color: var(--white); }
.sidebar-label { transition: opacity var(--transition); }

/* Sidebar section label */
.sidebar-section {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #333;
  padding: 16px 22px 6px;
}

/* Footer */
.sidebar-footer {
  border-top: 1px solid #1a1a1a;
  padding: 8px;
  flex-shrink: 0;
}
.sidebar-logout:hover {
  background: rgba(255,0,0,.1) !important;
  color: var(--red) !important;
}
.sidebar-logout:hover .sidebar-icon { color: var(--red) !important; }

/* ── Collapsed sidebar (desktop) ── */
.sidebar.collapsed {
  width: 64px;
}
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-section { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 10px; gap: 0; }
.sidebar.collapsed .sidebar-icon { width: auto; font-size: 18px; }
.sidebar.collapsed .sidebar-brand { justify-content: center; }
.sidebar.collapsed .sidebar-logo { height: 28px; }

/* ── Mobile ── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
}

/* ============================================================
   OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1039;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   MAIN WRAPPER
   ============================================================ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}
.main-wrapper.collapsed { margin-left: 64px; }

@media (max-width: 991.98px) {
  .main-wrapper { margin-left: 0; }
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar-panel {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* Toggle button */
.sidebar-toggle {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-sub);
  transition: all var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg); color: var(--text-main); }

/* Breadcrumb */
.breadcrumb { font-size: 13px; }
.breadcrumb-item a { color: var(--red); }
.breadcrumb-item.active { color: var(--text-sub); }
.breadcrumb-item + .breadcrumb-item::before { color: #ccc; }

/* Search */
.topbar-search {
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  width: 220px;
}
.topbar-search i { color: #bbb; font-size: 13px; }
.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-main);
  width: 100%;
  font-family: var(--font-body);
}
.topbar-search input::placeholder { color: #bbb; }

/* Icon buttons */
.topbar-icon-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-sub);
  transition: all var(--transition);
}
.topbar-icon-btn:hover { background: var(--bg); color: var(--text-main); }

/* Notification badge */
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--red);
  color: var(--white);
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-display);
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--white);
}

/* User button */
.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all var(--transition);
}
.topbar-user-btn:hover { background: var(--bg); }
.topbar-user-btn::after { display: none; } /* remove BS caret */

.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

/* Dropdown */
.panel-dropdown {
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  min-width: 200px;
  font-size: 13.5px;
}
.panel-dropdown .dropdown-item {
  padding: 9px 16px;
  color: var(--text-main);
  border-radius: 6px;
  margin: 2px 4px;
  width: calc(100% - 8px);
  transition: background var(--transition);
}
.panel-dropdown .dropdown-item:hover { background: var(--bg); }
.panel-dropdown .dropdown-item.text-danger:hover { background: rgba(255,0,0,.06); }

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
  flex: 1;
  padding: 24px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.page-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 2px;
  line-height: 1.2;
}
.page-subtitle { font-size: 13px; color: var(--text-sub); margin: 0; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  height: 100%;
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.red   { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-border); }
.stat-icon.blue  { background: rgba(59,130,246,.08); color: #3b82f6; border: 1px solid rgba(59,130,246,.2); }
.stat-icon.green { background: rgba(16,185,129,.08); color: #10b981; border: 1px solid rgba(16,185,129,.2); }
.stat-icon.amber { background: rgba(245,158,11,.08); color: #f59e0b; border: 1px solid rgba(245,158,11,.2); }
.stat-icon.purple{ background: rgba(139,92,246,.08); color: #8b5cf6; border: 1px solid rgba(139,92,246,.2); }

.stat-body { flex: 1; min-width: 0; }
.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-sub);
  margin-bottom: 4px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  margin-bottom: 6px;
}
.stat-change {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-change.up   { color: #10b981; }
.stat-change.down { color: var(--red); }

/* ============================================================
   PANEL CARD (generic)
   ============================================================ */
.panel-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}
.panel-card-body { padding: 20px; }
.panel-card-body.p-0 { padding: 0; }

/* ============================================================
   TABLE
   ============================================================ */
.panel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.panel-table th {
  background: var(--bg);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-sub);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.panel-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}
.panel-table tr:last-child td { border-bottom: none; }
.panel-table tbody tr:hover td { background: #fafafa; }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: .04em;
}
.status-badge.success { background: rgba(16,185,129,.1);  color: #059669; }
.status-badge.warning { background: rgba(245,158,11,.1);  color: #d97706; }
.status-badge.danger  { background: rgba(255,0,0,.1);     color: var(--red); }
.status-badge.info    { background: rgba(59,130,246,.1);  color: #2563eb; }
.status-badge.neutral { background: #f3f4f6;              color: #6b7280; }

/* ============================================================
   MINI CHART BARS (CSS-only sparklines)
   ============================================================ */
.spark-bar {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 36px;
}
.spark-bar span {
  flex: 1;
  background: var(--red-soft);
  border-radius: 3px 3px 0 0;
  transition: background var(--transition);
  border: 1px solid var(--red-border);
}
.spark-bar span.active,
.spark-bar span:hover { background: var(--red); border-color: var(--red); }

/* ============================================================
   ACTIVITY FEED
   ============================================================ */
.activity-feed { list-style: none; padding: 0; margin: 0; }
.activity-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; padding-bottom: 0; }
.activity-dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}
.activity-dot.red    { background: var(--red-soft);           color: var(--red); }
.activity-dot.blue   { background: rgba(59,130,246,.08);      color: #3b82f6; }
.activity-dot.green  { background: rgba(16,185,129,.08);      color: #10b981; }
.activity-dot.amber  { background: rgba(245,158,11,.08);      color: #f59e0b; }
.activity-text { font-size: 13px; color: var(--text-sub); line-height: 1.5; }
.activity-text strong { color: var(--text-main); font-weight: 600; }
.activity-time { font-size: 11px; color: #bbb; margin-top: 3px; display: block; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.panel-progress {
  height: 6px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.panel-progress-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--red);
  transition: width .6s ease;
}
.panel-progress-bar.blue   { background: #3b82f6; }
.panel-progress-bar.green  { background: #10b981; }
.panel-progress-bar.amber  { background: #f59e0b; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-panel {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .05em;
  border-radius: 8px;
  padding: 8px 18px;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn-panel-primary   { background: var(--red); color: #fff; }
.btn-panel-primary:hover { background: #cc0000; box-shadow: 0 4px 12px rgba(255,0,0,.3); }
.btn-panel-secondary { background: var(--bg); color: var(--text-main); border: 1px solid var(--border); }
.btn-panel-secondary:hover { background: #eee; }
.btn-panel-ghost     { background: transparent; color: var(--text-sub); border: 1px solid var(--border); }
.btn-panel-ghost:hover { background: var(--bg); }
.btn-sm-icon {
  width: 30px; height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px;
  color: var(--text-sub);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-sm-icon:hover { background: var(--bg); color: var(--text-main); }
.btn-sm-icon.danger:hover { background: rgba(255,0,0,.08); color: var(--red); border-color: var(--red-border); }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-red { color: var(--red) !important; }
.fw-display { font-family: var(--font-display) !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 0; }
.avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
