:root {
  --sl-navy: #17509C;
  --sl-navy-dark: #0E3670;
  --sl-teal: #17B4C9;
  --sl-amber: #F2A93B;
  --sl-amber-light: #FFC94A;
  --sl-bg: #F4F6F9;
  --sl-danger: #D64550;
  --sl-medium: #F2A93B;
  --sl-high: #D64550;
  --sl-normal: #2E9E6C;
  --sidebar-width: 250px;
}

body {
  background-color: var(--sl-bg);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---- Sidebar ---- */
.sl-sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: linear-gradient(180deg, var(--sl-navy) 0%, var(--sl-navy-dark) 100%);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 1030;
  transition: transform .2s ease-in-out;
}
.sl-brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1.1rem 1.1rem .9rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sl-brand img { width: 36px; height: 36px; }
.sl-brand-text { color: #fff; font-weight: 700; font-size: 1.15rem; line-height: 1.1; }
.sl-brand-sub { color: rgba(255,255,255,.55); font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; }

.sl-nav { padding: .75rem .6rem; }
.sl-nav .nav-section {
  color: rgba(255,255,255,.4);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 1rem .6rem .35rem;
}
.sl-nav .nav-link {
  color: rgba(255,255,255,.78);
  border-radius: .5rem;
  padding: .55rem .75rem;
  font-size: .92rem;
  display: flex; align-items: center; gap: .6rem;
  margin-bottom: 2px;
}
.sl-nav .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sl-nav .nav-link.active { background: var(--sl-teal); color: #fff; font-weight: 600; }
.sl-nav .nav-link .bi { font-size: 1.05rem; width: 1.2rem; text-align: center; }

.sl-content { margin-left: var(--sidebar-width); min-height: 100vh; }
.sl-topbar {
  background: #fff;
  border-bottom: 1px solid #e7eaef;
  padding: .7rem 1.4rem;
  position: sticky; top: 0; z-index: 1020;
}
.sl-main { padding: 1.4rem; }

@media (max-width: 991.98px) {
  .sl-sidebar { transform: translateX(-100%); }
  .sl-sidebar.show { transform: translateX(0); }
  .sl-content { margin-left: 0; }
}

/* ---- Cards / KPIs ---- */
.sl-kpi-card {
  border: none;
  border-radius: .9rem;
  box-shadow: 0 1px 3px rgba(15, 35, 60, .06), 0 1px 2px rgba(15,35,60,.04);
  display: block;
  transition: box-shadow .15s ease, transform .15s ease;
}
a.sl-kpi-card:hover, a.sl-kpi-card:focus {
  box-shadow: 0 6px 16px rgba(15, 35, 60, .12), 0 2px 4px rgba(15,35,60,.06);
  transform: translateY(-1px);
}
.sl-kpi-label { color: #6b7686; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.sl-kpi-value { font-size: 1.7rem; font-weight: 700; color: #1c2b39; }
.sl-kpi-icon {
  width: 42px; height: 42px; border-radius: .7rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: #fff;
}

.card { border: none; border-radius: .9rem; box-shadow: 0 1px 3px rgba(15, 35, 60, .06); }
.card-header { background: transparent; border-bottom: 1px solid #edf0f4; font-weight: 600; }

/* ---- Flags / badges ---- */
.flag-badge { font-weight: 600; font-size: .74rem; padding: .32em .6em; border-radius: .5rem; }
.flag-high { background: rgba(214,69,80,.12); color: var(--sl-high); }
.flag-medium { background: rgba(242,169,59,.15); color: #9a6413; }
.flag-normal { background: rgba(46,158,108,.14); color: var(--sl-normal); }

.status-badge { font-weight: 600; font-size: .72rem; padding: .3em .55em; border-radius: .5rem; }
.status-open, .status-pending, .status-overdue { background: rgba(214,69,80,.12); color: var(--sl-high); }
.status-completed, .status-closed, .status-active { background: rgba(46,158,108,.14); color: var(--sl-normal); }
.status-under_investigation, .status-action_pending, .status-standby { background: rgba(242,169,59,.15); color: #9a6413; }
.status-skipped, .status-decommissioned, .status-suspended, .status-cancelled { background: #eceff2; color: #6b7686; }
.status-requested { background: rgba(242,169,59,.15); color: #9a6413; }
.status-scheduled { background: rgba(23,180,201,.15); color: #0e7a89; }

.brand-icon-navy { background: var(--sl-navy); }
.brand-icon-teal { background: var(--sl-teal); }
.brand-icon-amber { background: var(--sl-amber); }
.brand-icon-danger { background: var(--sl-danger); }

/* ---- Auth page ---- */
.sl-auth-wrap {
  min-height: 100vh;
  background-image: url('../img/login-hero.jpg');
  background-size: cover;
  background-position: center 35%;
  background-repeat: no-repeat;
  background-color: var(--sl-navy-dark);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
  position: relative;
}
.sl-auth-wrap::before {
  /* very light scrim so form text stays readable without hiding the photo */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(6,20,38,.08) 0%, rgba(6,20,38,.22) 100%);
}
.sl-auth-glass {
  position: relative; z-index: 1;
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 1.1rem;
  box-shadow: 0 24px 60px rgba(6,20,38,.35);
  max-width: 420px;
  width: 100%;
  padding: 2.1rem 1.9rem;
}
.sl-glass-input { background: rgba(255,255,255,.75); border-color: rgba(255,255,255,.8); }
.sl-glass-input:focus { background: #fff; }
.sl-demo-user-btn { text-align: left; border: 1px solid rgba(255,255,255,.7); border-radius: .6rem; background: rgba(255,255,255,.55); }
.sl-demo-user-btn:hover { border-color: var(--sl-teal); background: rgba(255,255,255,.85); }

@media (max-width: 767.98px) {
  .sl-auth-wrap { justify-content: center; padding: 1.25rem; background-position: 30% center; }
  .sl-auth-glass { background: rgba(255,255,255,.72); }
}

/* ---- misc ---- */
.table > :not(caption) > * > * { vertical-align: middle; }
.sl-section-title { font-weight: 700; color: #1c2b39; }
.sl-muted { color: #8a93a3; }
.form-label { font-weight: 600; font-size: .86rem; color: #33414f; }
.sl-empty { text-align: center; padding: 2.5rem 1rem; color: #8a93a3; }

/* Highlights whichever card was jumped to via a #ls-site-N anchor link
   (e.g. clicking a fuel-theft alert through to that site's stock card). */
.list-group-item:target {
  background: rgba(242,169,59,.12);
  box-shadow: inset 3px 0 0 var(--sl-amber);
  animation: sl-target-fade 2.5s ease-out;
}
@keyframes sl-target-fade {
  0% { background: rgba(242,169,59,.32); }
  100% { background: rgba(242,169,59,.12); }
}

/* ---- offline logging ---- */
.sl-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px);
  background: var(--sl-navy-dark); color: #fff; padding: .75rem 1.25rem;
  border-radius: .6rem; font-size: .88rem; max-width: 90vw;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; z-index: 2000;
  transition: opacity .25s ease, transform .25s ease;
}
.sl-toast.show { opacity: 1; transform: translate(-50%, 0); }
