:root {
  --light-bg: #f4f4f4;
  --dark-bg: #1f1f1f;
  --light-box: #ffffff;
  --dark-box: #2a2a2a;
  --light-text: #000000;
  --dark-text: #ffffff;
}

/* IMPORTANT:
   Prevent generic aside styling from overriding the real sidebar system */
aside {
  all: unset;
}

body {
  display: flex;
  font-size: 1.1rem;
  height: 100vh;
  margin: 0;
  background-color: var(--pico-background-color);
}

main {
  flex-grow: 1;
  padding: 2rem;
  overflow-y: auto;
  color: var(--light-text);
}

html[data-theme='dark'] main {
  color: var(--dark-text);
}

.score-box {
  background-color: var(--light-box);
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  transition: background-color 0.3s ease;
  min-width: 0;
}

html[data-theme='dark'] .score-box {
  background-color: var(--dark-box);
}

.score-box h2 {
  margin-top: 0;
}

.score-number {
  font-size: clamp(1.5rem, 5vw, 3rem);
  font-weight: bold;
  color: green;
  word-break: break-word;
}

.score-description {
  color: #777;
}

.metrics ul {
  list-style: none;
  padding-left: 0;
}

.metrics li {
  margin-bottom: 0.75rem;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.status-badge {
  background: #f0ad4e;
  color: white;
  padding: 0.3rem 0.7rem;
  border-radius: 1rem;
  font-size: 0.9rem;
}

.top-bar button {
  margin-left: 1rem;
}

@media (max-width: 600px) {
  .top-bar img {
    height: 50px !important;
    margin-right: 0.25rem;
  }

  .top-bar strong {
    font-size: 0.95rem;
  }
}

.alert {
  border-left: 5px solid var(--primary);
  background-color: var(--pico-background-muted, #f5f5f5);
  padding: 1rem;
  margin: 1rem 0;
  border-radius: var(--pico-border-radius, 0.5rem);
  font-size: 1rem;
}

.alert.warning {
  border-left-color: orange;
  background-color: #fff8e1;
}

.alert.success {
  border-left-color: green;
  background-color: #e6f9ea;
}

.alert.error {
  border-left-color: red;
  background-color: #fbeaea;
}

.timeline.horizontal {
  display: flex;
  justify-content: space-between;
  list-style: none;
  padding: 0;
  counter-reset: stage;
  margin: 0 0 1rem 0;
}
.timeline.horizontal li {
  position: relative;
  text-align: center;
  flex: 1;
  color: #ccc;
}
.timeline.horizontal li::before {
  counter-increment: stage;
  content: counter(stage);
  background: #ccc;
  color: #fff;
  border-radius: 50%;
  width: 2.2rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.5rem auto;
  font-weight: bold;
}
.timeline.horizontal li.active {
  color: #000;
}
.timeline.horizontal li.active::before {
  background: green;
}

.score-number {
  font-size: 4rem;
  font-weight: bold;
  margin: 0.5rem 0;
}

.score-good {
  color: green;
}

.score-warning {
  color: orange;
}

.score-danger {
  color: red;
}

.score-empty {
  color: grey;
}

.status-cell {
  white-space: nowrap;
  text-align: left;
}

.badge-ok {
  color: green;
  font-weight: bold;
}

.badge-fail {
  color: red;
  font-weight: bold;
}

.admin-bar {
  background-color: #f6f6f6;
  border-bottom: 1px solid #ccc;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.admin-bar-header {
  cursor: pointer;
  font-weight: bold;
  text-align: right;
}

.admin-dropdown {
  display: none;
  margin-top: 0.5rem;
}

.admin-dropdown ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-dropdown ul li {
  margin: 0.2rem 0;
}

.admin-dropdown ul li a {
  color: #333;
  text-decoration: none;
}

.admin-dropdown ul li a:hover {
  text-decoration: underline;
}

.credit-pill {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background-color: var(--pico-muted-border-color);
  color: var(--pico-color);
  text-decoration: none;
  font-weight: 500;
  border: 1px solid var(--pico-muted-border-color);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.credit-pill:hover {
  background-color: var(--pico-muted-color);
  border-color: var(--pico-muted-color);
  color: var(--pico-contrast);
}

/* --- Sidebar / Nav controls --- */
:root{
  --inboxsy-blue: #2d6cdf;
}

/* Buttons must always sit above content */
.sidebar-burger,
.sidebar-collapse{
  z-index: 4000 !important;
  pointer-events: auto !important;
  color: var(--pico-color);
}

/* Lucide SVG should always inherit visible stroke */
.sidebar-burger svg,
.sidebar-collapse svg,
.sidebar-nav svg{
  stroke: currentColor;
}

/* Burger button (mobile/tablet) */
.sidebar-burger{
  display:none;
  position: fixed;
  top: 14px;
  left: 14px;
  width: 44px;
  height: 44px;
  border-radius: var(--pico-border-radius);
  border: 1px solid var(--pico-muted-border-color);
  background: var(--pico-card-background-color);
  align-items:center;
  justify-content:center;
  cursor:pointer;
}

/* Make the burger icon actually visible and nicely sized */
.sidebar-burger svg{
  width: 22px;
  height: 22px;
}

/* Sidebar container */
.sidebar{
  width: 150px;
  flex-shrink: 0;
  display:flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0;
  gap: 1.25rem;
  border-right: 1px solid var(--pico-muted-border-color);
  background: var(--pico-background-color);
  z-index: 3000;
}

/* Top row holds collapse button aligned right-ish within sidebar */
.sidebar-top{
  width: 100%;
  display:flex;
  justify-content: center; /* matches your old centered style */
  padding: .25rem 0 .25rem 0;
}

/* Collapse button (desktop/tablet) */
.sidebar-collapse{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 38px;
  height: 38px;
  border-radius: var(--pico-border-radius);
  border: 1px solid var(--pico-muted-border-color);
  background: var(--pico-card-background-color);
  cursor:pointer;
}

/* Make collapse icon bigger (so it doesn’t look like an empty square) */
.sidebar-collapse svg{
  width: 22px;
  height: 22px;
}

/* Nav links: BIG icon, label underneath (your original style) */
.sidebar-nav{
  width: 100%;
  display:flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem; /* gives that airy spacing you had */
}

.sidebar-nav a{
  display:flex;
  flex-direction: column;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  color: #555;
  width: 100%;
}

/* Active state */
.sidebar-nav a.active{
  font-weight: 700;
  color: var(--pico-primary);
}

/* Icon size (bigger like before) */
.sidebar-nav a svg{
  width: 26px;
  height: 26px;
}

/* Label under icon */
.sidebar-nav a span{
  margin-top: .35rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Backdrop for mobile drawer */
.sidebar-backdrop{
  display:none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 2500;
  pointer-events:auto;
}

/* Desktop collapsed state: icons only */
body.sidebar-collapsed .sidebar{
  width: 90px; /* closer to your old small sidebar */
}

body.sidebar-collapsed .sidebar-nav a span{
  display:none;
}

/* Keep collapse button centered even when collapsed */
body.sidebar-collapsed .sidebar-top{
  justify-content:center;
}

/* --- Mobile / Tablet off-canvas --- */
@media (max-width: 1024px){

  .sidebar-burger{
    display:inline-flex;
  }

  /* Off-canvas sidebar */
  .sidebar{
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 270px;
    transform: translateX(-110%);
    transition: transform 220ms ease;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    align-items: flex-start;
    padding: 1rem;
  }

  /* On mobile, make nav items left-aligned but still icon+label stacked */
  .sidebar-nav{
    align-items: flex-start;
    width: 100%;
  }

  .sidebar-nav a{
    align-items: flex-start;
  }

  body.sidebar-open .sidebar{
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-backdrop{
    display:block;
  }

  /* Ignore collapsed state on mobile (drawer should always show labels) */
  body.sidebar-collapsed .sidebar{
    width: 270px;
  }
  body.sidebar-collapsed .sidebar-nav a span{
    display:inline;
  }
}
/* --- Ensure Lucide icons are visible inside sidebar buttons --- */
.sidebar-burger,
.sidebar-collapse{
  color: var(--pico-color); /* forces lucide SVG stroke to a visible color */
}

html[data-theme="dark"] .sidebar-burger,
html[data-theme="dark"] .sidebar-collapse{
  color: var(--pico-color); /* pico provides correct contrast in dark mode too */
}

.sidebar-burger:hover,
.sidebar-collapse:hover{
  color: var(--pico-contrast);
}

/* Make sure the lucide SVG actually renders and isn't visually squashed */
.sidebar-burger i,
.sidebar-collapse i{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.sidebar-burger svg,
.sidebar-collapse svg{
  stroke: currentColor !important;
  width: 20px;
  height: 20px;
}
