/* =============================================
   styles.css — IncidentTrack (Light Theme)
   Paleta: #C10230 · #ED5E17 · #FF8300 · #A21A19 · #6F6F6E
============================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  /* ——— Brand Colors ——— */
  --brand-crimson:  #C10230;
  --brand-orange:   #ED5E17;
  --brand-amber:    #FF8300;
  --brand-dark-red: #A21A19;
  --brand-gray:     #6F6F6E;

  /* ——— Derived / dims ——— */
  --accent:         var(--brand-orange);
  --accent-dim:     rgba(237,94,23,0.10);
  --accent-glow:    rgba(237,94,23,0.25);
  --crimson-dim:    rgba(193,2,48,0.10);
  --crimson-glow:   rgba(193,2,48,0.30);

  /* ——— Backgrounds (Light) ——— */
  --bg-900:   #FFFFFF;
  --bg-800:   #FAF6F5;
  --bg-700:   #F2EEEC;
  --bg-600:   #E8E0DE;
  --bg-500:   #DDD4D2;
  --surface:  #FFFFFF;
  --surface-2:#FEF8F6;

  /* ——— Borders ——— */
  --border:       rgba(193,2,48,0.12);
  --border-hover: rgba(193,2,48,0.25);

  /* ——— Semantic colors ——— */
  --red:        #C10230;
  --red-dim:    rgba(193,2,48,0.10);
  --green:      #1a6b46;
  --green-dim:  rgba(26,107,70,0.10);
  --blue:       #1a4fa8;
  --blue-dim:   rgba(26,79,168,0.10);
  --orange:     #ED5E17;
  --orange-dim: rgba(237,94,23,0.10);

  /* ——— Text ——— */
  --text-primary:   #1A0808;
  --text-secondary: #6F6F6E;
  --text-muted:     #A89E9C;

  /* ——— Typography ——— */
  --font-mono: 'Space Mono', monospace;
  --font-sans: 'DM Sans', sans-serif;

  /* ——— Misc ——— */
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 4px 24px rgba(193,2,48,0.08);
  --shadow-lg: 0 8px 56px rgba(193,2,48,0.14);
  --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
}

/* =============================================
   RESET & BASE
============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg-900);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ——— SCROLLBAR ——— */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-700); }
::-webkit-scrollbar-thumb { background: var(--bg-500); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-gray); }

/* ——— UTILITIES ——— */
.hidden { display: none !important; }
.mono   { font-family: var(--font-mono); }
.flex   { display: flex; }
.items-center { align-items: center; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }

/* ——— SUBTLE GRID BG ——— */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(193,2,48,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(193,2,48,0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
  z-index: 0;
}

/* =============================================
   AUTH SCREEN — Split panel
============================================= */
#auth-screen {
  position: fixed; inset: 0;
  display: flex;
  z-index: 100;
  background: var(--bg-900);
  animation: authFadeIn 0.5s ease;
}

@keyframes authFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ——— LEFT PANEL (brand) — claro, estilo Prepa Tres ——— */
.auth-brand-panel {
  flex: 0 0 45%;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 52px;
  overflow: hidden;
  background: var(--bg-900);
}

/* Cluster de hexágonos — pegado a la esquina inferior derecha de toda la pantalla */
.brand-hex-cluster {
  position: absolute;
  right: -25px; bottom: -25px;
  width: 260px; height: 260px;
  opacity: 0.9;
  pointer-events: none;
  z-index: 5;
}

.auth-brand-top { position: relative; z-index: 1; }

.auth-brand-eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.auth-brand-headline {
  font-size: clamp(30px, 3.5vw, 40px);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
  margin-top: 8px;
}

.auth-brand-center {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-left: -52px;
  margin-right: -52px;
}

.auth-brand-glow {
  position: absolute;
  left: 0px; top: 50%;
  transform: translateY(-50%);
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(255,131,0,0.35) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
}

.auth-brand-logo-img {
  width: min(360px, 85%);
  height: auto;
  margin-left: 0;
  filter: drop-shadow(0 12px 28px rgba(162,26,25,0.25));
}

.auth-brand-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
}
.auth-brand-uaeh-mark { object-fit: contain; opacity: 0.75; }
.auth-brand-bottom p { font-size: 12px; color: var(--text-muted); }

/* ——— RIGHT PANEL (form) ——— */
.auth-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  overflow-y: auto;
  background: #FFFFFF;
  position: relative;
}

.auth-form-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 1px; height: 100%;
  background: linear-gradient(to bottom, transparent, rgba(193,2,48,0.3), transparent);
}

.auth-form-inner {
  width: 100%;
  max-width: 420px;
  animation: formSlideIn 0.45s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes formSlideIn {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}

.auth-form-header { margin-bottom: 36px; }
.auth-form-header h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.auth-form-header p { font-size: 14px; color: var(--text-secondary); }

/* ——— PILL TAB SWITCHER ——— */
.auth-tab-switcher {
  display: inline-flex;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 4px;
  margin-bottom: 32px;
  position: relative;
}

.auth-tab-pill {
  position: relative;
  padding: 9px 28px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 50px;
  transition: color var(--transition);
  z-index: 1;
  white-space: nowrap;
}
.auth-tab-pill.active { color: #fff; }

.auth-tab-indicator {
  position: absolute;
  top: 4px; left: 4px;
  height: calc(100% - 8px);
  background: linear-gradient(135deg, var(--brand-crimson), var(--brand-orange));
  border-radius: 50px;
  transition: transform var(--transition), width var(--transition);
  box-shadow: 0 2px 12px rgba(193,2,48,0.35);
  pointer-events: none;
}

/* ——— FORM ELEMENTS ——— */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--brand-orange);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(237,94,23,0.12);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236F6F6E' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 42px;
}

/* ——— BUTTONS ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-crimson) 0%, var(--brand-orange) 100%);
  color: #fff;
  width: 100%;
  padding: 14px;
  font-size: 15px;
  letter-spacing: 0.2px;
  box-shadow: 0 4px 20px rgba(193,2,48,0.22);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #d8022e 0%, #ff6a1f 100%);
  box-shadow: 0 6px 28px rgba(193,2,48,0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-700);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-600); border-color: var(--border-hover); }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #145e3c; }

.btn-danger { background: var(--brand-crimson); color: #fff; }
.btn-danger:hover { background: var(--brand-dark-red); }

.btn-warning { background: var(--brand-orange); color: #fff; }
.btn-warning:hover { background: #d14f0f; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-700); color: var(--text-primary); }

.btn-sm   { padding: 7px 14px; font-size: 13px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ——— AUTH FOOTER ——— */
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}
.auth-footer a {
  color: var(--brand-orange);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}
.auth-footer a:hover { color: var(--brand-crimson); }

/* ——— DEMO ACCOUNTS STRIP ——— */
.demo-strip {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  align-items: center;
  flex-wrap: wrap;
}
.demo-strip-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  white-space: nowrap;
}
.demo-btn {
  padding: 5px 12px;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-sans);
}
.demo-btn:hover {
  background: var(--accent-dim);
  border-color: var(--brand-orange);
  color: var(--brand-orange);
}

/* ——— ERROR MSG ——— */
.error-msg {
  background: var(--red-dim);
  border: 1px solid rgba(193,2,48,0.25);
  color: var(--brand-crimson);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* ——— DIVIDER ——— */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* =============================================
   MOBILE AUTH
============================================= */
@media (max-width: 768px) {
  #auth-screen { flex-direction: column; }

  .auth-brand-panel {
    flex: 0 0 auto;
    padding: 24px 24px 20px;
    min-height: auto;
  }
  .brand-hex-cluster   { width: 150px; height: 150px; right: -20px; bottom: -20px; opacity: 0.7; }
  .auth-brand-headline { font-size: 24px; }
  .auth-brand-center   { margin-top: 16px; margin-left: -24px; margin-right: -24px; justify-content: flex-start; }
  .auth-brand-glow     { left: 0; transform: translateY(-50%); width: 200px; height: 200px; }
  .auth-brand-logo-img { width: min(240px, 78%); }
  .auth-brand-bottom   { display: none; }

  .auth-form-panel  { flex: 1; padding: 32px 20px 40px; align-items: flex-start; }
  .auth-form-panel::before { display: none; }
  .auth-form-inner  { max-width: 100%; }
  .auth-form-header { margin-bottom: 24px; }
  .auth-form-header h2 { font-size: 22px; }
  .auth-tab-pill    { padding: 9px 20px; font-size: 13px; }
}

@media (max-width: 380px) {
  .auth-tab-pill    { padding: 8px 16px; }
}

/* =============================================
   APP LAYOUT
============================================= */
#app-screen { display: none; min-height: 100vh; }

/* ——— SIDEBAR ——— */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 260px;
  background: var(--bg-800);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo .logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--brand-crimson), var(--brand-dark-red));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 16px rgba(193,2,48,0.25);
}
.logo-text {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.logo-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-user-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.sidebar-user-role {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 5px;
  text-transform: capitalize;
}
.role-admin        { background: var(--crimson-dim);  color: var(--brand-crimson); border: 1px solid rgba(193,2,48,0.25); }
.role-mantenimiento{ background: var(--accent-dim);   color: var(--brand-orange);  border: 1px solid rgba(237,94,23,0.25); }
.role-usuario      { background: var(--blue-dim);     color: var(--blue);          border: 1px solid rgba(26,79,168,0.25); }
.role-director     { background: var(--green-dim);    color: var(--green);         border: 1px solid rgba(26,107,70,0.25); }

.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-align: left;
  position: relative;
}
.nav-item:hover { background: var(--bg-700); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-dim);
  color: var(--brand-orange);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: linear-gradient(to bottom, var(--brand-crimson), var(--brand-orange));
  border-radius: 0 3px 3px 0;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 16px 12px 8px;
}

.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }

/* ——— TOPBAR ——— */
.main-content {
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0; z-index: 30;
  box-shadow: 0 1px 8px rgba(193,2,48,0.06);
}
.topbar-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.topbar-notif { position: relative; cursor: pointer; font-size: 18px; }
.notif-dot {
  position: absolute;
  top: -2px; right: -2px;
  width: 8px; height: 8px;
  background: var(--brand-crimson);
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 8px var(--brand-crimson);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
}

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

/* ——— SECTION HEADER ——— */
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.section-title    { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.section-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ——— STATS GRID ——— */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 0 var(--radius) 0 80px;
  opacity: 0.06;
}
.stat-card.red::after,
.stat-card.critica::after { background: var(--brand-crimson); }
.stat-card.orange::after,
.stat-card.alta::after    { background: var(--brand-orange); }
.stat-card.amber::after,
.stat-card.media::after   { background: var(--brand-amber); }
.stat-card.blue::after,
.stat-card.baja::after    { background: var(--blue); }
.stat-card.green::after   { background: var(--green); }
.stat-card.purple::after  { background: var(--brand-dark-red); }

.stat-icon  { font-size: 22px; margin-bottom: 14px; }
.stat-value { font-family: var(--font-mono); font-size: 30px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 6px; font-weight: 500; }
.stat-delta { font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.stat-delta.up   { color: var(--green); }
.stat-delta.down { color: var(--red); }

/* ——— FILTER BAR ——— */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}
.filter-input:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px rgba(237,94,23,0.10);
}
.filter-input::placeholder { color: var(--text-muted); }

.filter-select {
  padding: 10px 40px 10px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236F6F6E' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.filter-select:focus { border-color: var(--brand-orange); }

/* ——— DATA TABLE ——— */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 12px 16px;
  background: var(--bg-700);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 13px 16px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td  { border-bottom: none; }
.data-table tbody tr          { transition: var(--transition); background: #fff; }
.data-table tbody tr:hover    { background: var(--bg-700); }

/* ——— BADGES ——— */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge-critica { background: rgba(193,2,48,0.10);  color: var(--brand-crimson);  border: 1px solid rgba(193,2,48,0.22); }
.badge-alta    { background: var(--accent-dim);     color: var(--brand-orange);   border: 1px solid rgba(237,94,23,0.22); }
.badge-media   { background: rgba(255,131,0,0.10);  color: #b85e00;               border: 1px solid rgba(255,131,0,0.25); }
.badge-baja    { background: var(--blue-dim);        color: var(--blue);           border: 1px solid rgba(26,79,168,0.22); }

.badge-abierto     { background: rgba(193,2,48,0.08); color: var(--brand-crimson); border: 1px solid rgba(193,2,48,0.18); }
.badge-en_progreso { background: rgba(255,131,0,0.10);color: #b85e00;              border: 1px solid rgba(255,131,0,0.20); }
.badge-resuelto    { background: var(--green-dim);    color: var(--green);          border: 1px solid rgba(26,107,70,0.22); }
.badge-cerrado     { background: rgba(111,111,110,0.10); color: var(--brand-gray); border: 1px solid rgba(111,111,110,0.22); }

.badge-red    { background: rgba(193,2,48,0.10);  color: var(--brand-crimson); border: 1px solid rgba(193,2,48,0.22); }
.badge-green  { background: var(--green-dim);     color: var(--green);         border: 1px solid rgba(26,107,70,0.22); }
.badge-blue   { background: var(--blue-dim);      color: var(--blue);          border: 1px solid rgba(26,79,168,0.22); }
.badge-purple { background: rgba(162,26,25,0.10); color: var(--brand-dark-red);border: 1px solid rgba(162,26,25,0.22); }
.badge-amber  { background: rgba(255,131,0,0.10);  color: #b85e00;              border: 1px solid rgba(255,131,0,0.25); }

/* ——— INCIDENTS GRID ——— */
.incidents-grid { display: grid; gap: 14px; }

.incident-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.incident-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.incident-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.incident-card.critica::before { background: var(--brand-crimson); }
.incident-card.alta::before    { background: var(--brand-orange); }
.incident-card.media::before   { background: var(--brand-amber); }
.incident-card.baja::before    { background: var(--blue); }

.incident-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 12px;
}
.incident-code  { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.incident-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }

.incident-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-secondary);
  align-items: center;
}
.incident-meta span { display: flex; align-items: center; gap: 4px; }
.incident-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* =============================================
   MODAL
============================================= */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,8,8,0.45);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1); }

.modal-header {
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0;
  background: #fff;
  z-index: 1;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--text-primary); }

.modal-close {
  width: 32px; height: 32px;
  background: var(--bg-700);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 18px;
  transition: var(--transition);
}
.modal-close:hover { background: var(--bg-600); color: var(--text-primary); }

.modal-body   { padding: 24px 28px; }
.modal-footer {
  padding: 16px 28px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* =============================================
   TIMELINE / HISTORY
============================================= */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -22px; top: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--brand-orange);
  border: 2px solid #fff;
}
.timeline-time   { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.timeline-action { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.timeline-desc   { font-size: 13px; color: var(--text-secondary); }

/* DETAIL VIEW*/
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

.detail-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.detail-card-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.detail-field       { margin-bottom: 16px; }
.detail-field-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted); margin-bottom: 6px;
}
.detail-field-value { font-size: 14px; color: var(--text-primary); line-height: 1.5; }

/*TOAST */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 1000;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.3s ease;
  min-width: 280px; max-width: 360px;
  color: var(--text-primary);
}
.toast.success { border-left: 3px solid var(--green);        }
.toast.error   { border-left: 3px solid var(--brand-crimson);}
.toast.info    { border-left: 3px solid var(--brand-orange); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* PROGRESS BAR */
.progress-bar { height: 6px; background: var(--bg-600); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.progress-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--brand-crimson), var(--brand-orange));
  transition: width 0.6s ease;
}

/* ——— EMPTY STATE ——— */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.35; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.empty-state p  { font-size: 14px; }

/* ——— MINI CHART ——— */
.mini-chart { display: flex; align-items: flex-end; gap: 4px; height: 40px; }
.chart-bar  {
  flex: 1; border-radius: 3px 3px 0 0;
  transition: height 0.6s ease;
  min-height: 4px;
  background: linear-gradient(to top, var(--brand-crimson), var(--brand-amber));
}

/* ——— WELCOME BANNER ——— */
.welcome-banner {
  background: linear-gradient(135deg, rgba(193,2,48,0.06) 0%, rgba(237,94,23,0.04) 100%);
  border: 1px solid rgba(193,2,48,0.15);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.welcome-banner::after {
  content: '⚠';
  position: absolute;
  right: 24px; top: 50%;
  transform: translateY(-50%);
  font-size: 72px;
  opacity: 0.04;
}
.welcome-banner h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; color: var(--text-primary); }
.welcome-banner p  { font-size: 14px; color: var(--text-secondary); }

textarea.form-control { resize: vertical; min-height: 90px; }

.tiempo-display {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--brand-orange);
}

/* ——— USER INFO (sidebar) ——— */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-crimson), var(--brand-orange));
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 4px;
  text-transform: capitalize;
  margin-top: 3px;
}

/* ——— NAV BADGE ——— */
.nav-badge {
  margin-left: auto;
  background: var(--brand-crimson);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 50px;
  min-width: 20px;
  text-align: center;
}

/* ——— PULSE DOT ——— */
.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.pulse-dot.active {
  background: var(--green);
  box-shadow: 0 0 0 0 var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(26,107,70,0.4); }
  70%  { box-shadow: 0 0 0 8px rgba(26,107,70,0); }
  100% { box-shadow: 0 0 0 0 rgba(26,107,70,0); }
}

/*  RESPONSIVE — APP */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  #dashCharts { grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .page-content { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(26,8,8,0.45);
    z-index: 49;
  }
  #dashCharts { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .incident-header { flex-direction: column; }
  .topbar { padding: 0 16px; }
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(26,8,8,0.45);
  z-index: 49;
  cursor: pointer;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
}
.sidebar-overlay.active {
  display: block;
  pointer-events: auto;
  opacity: 1;
}
/* ══════════════════════════════════════════
   PÁGINA AGREGAR — separador visual y badge de nav
══════════════════════════════════════════ */

/* Separador visual antes del ítem "Agregar" en el sidebar */
#nav-agregar {
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* Badge de rol en el empty state de Mis Asignaciones */
#misAsignacionesList .empty-state p {
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.6;
}
