:root {
  --alerto-primary: #1f6feb;
  --alerto-dark: #0b1f3a;
  --alerto-danger: #e5484d;
}

body { background: #f3f5f9; color: #1c2433; }

/* ---------- Brand ---------- */
.brand-badge {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--alerto-danger), #ff7a45);
  color: #fff; font-size: 1.4rem;
}
.brand-badge.sm { width: 32px; height: 32px; font-size: 1rem; border-radius: 9px; }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0b1f3a, #15325f);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 2.25rem; width: 100%; max-width: 380px;
  box-shadow: 0 25px 60px rgba(0,0,0,.35);
}

/* ---------- Navbar ---------- */
.app-navbar {
  background: var(--alerto-dark);
  position: sticky; top: 0; z-index: 1030;
  gap: .5rem;
}
.app-navbar .navbar-brand { font-weight: 600; }
.app-navbar .nav-link { color: rgba(255,255,255,.7); border-radius: 8px; font-size: .9rem; }
.app-navbar .nav-link:hover { color: #fff; background: rgba(255,255,255,.08); }
.app-navbar .nav-link.active { color: #fff; background: rgba(255,255,255,.14); }

/* ---------- Shift button ---------- */
.shift-btn { border: 1px solid transparent; font-weight: 500; }
.shift-btn.on { background: #1e7e4f; color: #fff; }
.shift-btn.on:hover { background: #1a6e45; color: #fff; }
.shift-btn.off { background: rgba(255,255,255,.12); color: rgba(255,255,255,.85); }
.app-navbar .shift-btn.off { color: rgba(255,255,255,.85); }
table .shift-btn.off { background: #e9ecef; color: #6c757d; }

/* ---------- Activity timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ''; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: #e9edf3;
}
.timeline-item { position: relative; padding: 0 0 1rem 2.5rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: .9rem; z-index: 1;
}
.timeline-body { padding-top: 4px; }

/* ---------- Toasts ---------- */
.alerto-toast { box-shadow: 0 8px 30px rgba(10,20,40,.25); }
.alerto-toast.toast-danger { border-left: 5px solid var(--alerto-danger); }
.alerto-toast.toast-warning { border-left: 5px solid #f5a623; }
.alerto-toast.toast-success { border-left: 5px solid #2fa84f; }
.header-search { position: relative; max-width: 620px; }
.header-search .form-control:focus { box-shadow: none; }
.search-results {
  position: absolute; top: 110%; left: 0; right: 0; z-index: 1050;
  background: #fff; border-radius: 10px; overflow: hidden; display: none; max-height: 60vh; overflow-y: auto;
}
.search-results.show { display: block; }
.search-item {
  display: block; width: 100%; text-align: left; border: 0; background: #fff;
  padding: .6rem .9rem; border-bottom: 1px solid #eef1f5;
}
.search-item:hover { background: #f5f8ff; }
.search-empty { padding: .9rem; color: #6b7280; font-size: .9rem; }

/* ---------- Stat cards ---------- */
.stat-card { background: #fff; border-radius: 12px; padding: 1rem 1.1rem; box-shadow: 0 2px 8px rgba(20,30,60,.05); }
.stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1; }
.stat-label { color: #6b7280; font-size: .82rem; margin-top: .25rem; }

/* ---------- Alert cards ---------- */
.alert-card {
  position: relative;
  background: #fff; border-radius: 14px; padding: 1.1rem; height: 100%;
  box-shadow: 0 2px 10px rgba(20,30,60,.06); border-left: 5px solid #dfe3ea;
  transition: box-shadow .15s ease, transform .15s ease;
}
.alert-card:hover { box-shadow: 0 6px 20px rgba(20,30,60,.12); }
.alert-card.sev-critical { border-left-color: var(--alerto-danger); }
.alert-card.sev-high { border-left-color: #f5a623; }
.alert-card.sev-medium { border-left-color: #3aa0ff; }
.alert-card.status-new.sev-critical { animation: pulseBorder 1.8s infinite; }
@keyframes pulseBorder {
  0%,100% { box-shadow: 0 2px 10px rgba(20,30,60,.06); }
  50% { box-shadow: 0 0 0 4px rgba(229,72,77,.18); }
}
.alert-card.status-resolved { opacity: .82; }
.alert-card.escalated { border-left-color: var(--alerto-danger); box-shadow: 0 0 0 2px rgba(229,72,77,.35), 0 2px 10px rgba(20,30,60,.06); }
.alert-card.escalated::before {
  content: ''; position: absolute; inset: 0; border-radius: 14px; pointer-events: none;
  animation: escGlow 1.6s ease-in-out infinite;
}
@keyframes escGlow {
  0%,100% { box-shadow: 0 0 0 0 rgba(229,72,77,0); }
  50% { box-shadow: 0 0 0 4px rgba(229,72,77,.18); }
}

.alert-type-icon {
  width: 48px; height: 48px; min-width: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.alert-type-icon.lg { width: 58px; height: 58px; min-width: 58px; font-size: 1.7rem; border-radius: 14px; }
.min-w-0 { min-width: 0; }
.alert-meta { color: #4b5563; }

/* ---------- Profile ---------- */
.avatar {
  width: 52px; height: 52px; border-radius: 50%; background: var(--alerto-primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 600;
}

/* ---------- Contacts drawer ---------- */
.contacts-drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 400px; max-width: 92vw;
  background: #fff; z-index: 1080; transform: translateX(100%); transition: transform .25s ease;
  display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.2);
}
.contacts-drawer.open { transform: translateX(0); }
.contacts-drawer-header { background: var(--alerto-danger); color: #fff; padding: 1rem 1.1rem; }
.contacts-drawer-body { padding: 1.1rem; overflow-y: auto; }
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(8,16,32,.45); z-index: 1070; opacity: 0; visibility: hidden;
  transition: opacity .25s ease;
}
.drawer-backdrop.show { opacity: 1; visibility: visible; }
.drawer-wearer { padding-bottom: .75rem; border-bottom: 1px solid #eef1f5; }
.drawer-contact { padding: .75rem 0; border-bottom: 1px solid #eef1f5; }
.drawer-contact:last-child { border-bottom: 0; }
.contact-row:hover { background: #fbfcfe; }
