:root {
  --alt-green:   #7cb342;
  --alt-dark:    #1a1a1a;
  --alt-mid:     #3a3a3a;
  --alt-light:   #f5f5f5;
  --alt-border:  #d0d0d0;
  --alt-error:   #c0392b;
  --alt-radius:  6px;
  --alt-font-heading: 'Unbounded', sans-serif;
  --alt-font-body:    'Kufam', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--alt-font-body);
  color: var(--alt-dark);
  background: var(--alt-light);
}

h1 {
  font-family: var(--alt-font-heading);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

a { color: var(--alt-green); }

.alt-muted { color: var(--alt-mid); font-size: 14px; margin-bottom: 10px; }
.alt-error { color: var(--alt-error); font-size: 14px; margin-bottom: 10px; }

.alt-shell { display: flex; align-items: flex-start; min-height: 100vh; }

.alt-sidebar {
  width: 260px;
  flex: none;
  height: 100vh;
  background: var(--alt-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  overflow: hidden; /* only .alt-sidebar-nav scrolls internally — see below */
}
.alt-sidebar-brand {
  font-family: var(--alt-font-heading);
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  font-size: 14px;
  padding: 20px 20px 16px;
  flex: none; /* fixed chrome — only .alt-sidebar-nav absorbs the shrink */
}
.alt-sidebar-nav {
  flex: 1 1 auto;
  /* REQUIRED for the internal scroll to work at all (2026-08-18 fix: "navbar
     has no independent scroll"). A flex item defaults to min-height:auto,
     which refuses to shrink below its content — so `overflow-y:auto` never
     engaged, the nav simply grew past the sidebar's `overflow:hidden`, and
     the links at the bottom were clipped with no way to reach them. */
  min-height: 0;
  overflow-y: auto;
  /* Keep a nav scroll from chaining into the page behind it once it bottoms
     out — that scroll-through is what makes the two feel coupled. */
  overscroll-behavior: contain;
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* Slim, dark-appropriate scrollbar so the nav's own scroll is visible without
   dominating the rail (WebKit; Firefox uses scrollbar-* above). */
.alt-sidebar-nav { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }
.alt-sidebar-nav::-webkit-scrollbar { width: 8px; }
.alt-sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.alt-sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }
.alt-sidebar-nav:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,.32); }

.alt-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 14px;
  padding: 9px 10px;
  border-radius: var(--alt-radius);
}
.alt-sidebar-item i { font-size: 16px; width: 18px; text-align: center; flex: none; }
.alt-sidebar-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.alt-sidebar-item.active { color: #fff; background: var(--alt-green); font-weight: 600; }

.alt-sidebar-group { display: flex; flex-direction: column; }
.alt-sidebar-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  color: rgba(255,255,255,.75);
  font-family: var(--alt-font-body);
  font-size: 14px;
  padding: 9px 10px;
  border-radius: var(--alt-radius);
  cursor: pointer;
  text-align: left;
}
.alt-sidebar-group-header:hover { color: #fff; background: rgba(255,255,255,.06); }
.alt-sidebar-group-icon { font-size: 15px; width: 18px; text-align: center; flex: none; color: rgba(255,255,255,.5); }
.alt-sidebar-group-header span { flex: 1; }
.alt-sidebar-chevron { font-size: 13px; flex: none; transition: transform .15s ease; transform: rotate(90deg); }
.alt-sidebar-group[data-expanded="0"] > .alt-sidebar-group-header .alt-sidebar-chevron { transform: none; }

/* Default (and no-JS fallback) is expanded — sidebar.js sets data-expanded="0"
   to collapse a group, so a broken/blocked script degrades to "always open"
   instead of hiding every menu item. */
.alt-sidebar-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 14px;
  overflow: hidden;
  max-height: 600px;
  transition: max-height .18s ease;
}
.alt-sidebar-group[data-expanded="0"] > .alt-sidebar-group-items { max-height: 0; }
.alt-sidebar-group-items .alt-sidebar-item { font-size: 13px; }

.alt-sidebar-footer { padding: 10px; border-top: 1px solid rgba(255,255,255,.1); margin-top: 8px; flex: none; }

.alt-sidebar-user {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 12px;
  color: rgba(255,255,255,.75);
  flex: none; /* stays pinned at the bottom; never squeezed out by a long nav */
}
.alt-sidebar-user button {
  align-self: flex-start;
  background: none;
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  border-radius: var(--alt-radius);
  padding: 4px 10px;
  cursor: pointer;
  font-family: var(--alt-font-body);
  font-size: 12px;
}

.alt-page { padding: 32px; max-width: 1280px; margin: 0 auto; flex: 1; min-width: 0; }

@media (max-width: 860px) {
  .alt-shell { flex-direction: column; }
  .alt-sidebar { width: 100%; height: auto; position: static; overflow: visible; }
  .alt-sidebar-nav { overflow-y: visible; }
  .alt-page { padding: 20px; }
}

.alt-card {
  background: #fff;
  border: 1px solid var(--alt-border);
  border-radius: 10px;
  padding: 24px 28px;
  box-shadow: 0 2px 16px rgba(0,0,0,.06);
}
.alt-card-narrow { max-width: 380px; margin: 60px auto; text-align: center; }
.alt-card-wide { width: 100%; }

.alt-btn {
  display: inline-block;
  background: var(--alt-green);
  color: #fff;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: var(--alt-radius);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: var(--alt-font-body);
}
.alt-btn-primary { background: var(--alt-green); }

.alt-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.alt-table th, .alt-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--alt-border); }
.alt-table th { color: var(--alt-mid); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.alt-inline-form { display: flex; gap: 8px; align-items: center; }
.alt-inline-form select { padding: 4px 6px; border: 1px solid var(--alt-border); border-radius: 4px; }
.alt-inline-form button {
  background: var(--alt-green);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
}

.alt-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--alt-border); }
.alt-tabs a {
  padding: 8px 14px;
  text-decoration: none;
  color: var(--alt-mid);
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}
.alt-tabs a.active { color: var(--alt-green); border-bottom-color: var(--alt-green); }

.alt-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }

.alt-form { display: flex; flex-direction: column; gap: 14px; max-width: 560px; }
.alt-form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.alt-form-row > .alt-field { flex: 1; min-width: 160px; }
.alt-field { display: flex; flex-direction: column; gap: 4px; }
.alt-field label { font-size: 12px; font-weight: 600; color: var(--alt-mid); text-transform: uppercase; }
.alt-field input, .alt-field select, .alt-field textarea {
  padding: 8px 10px;
  border: 1px solid var(--alt-border);
  border-radius: 4px;
  font-family: var(--alt-font-body);
  font-size: 14px;
}
.alt-field textarea { resize: vertical; min-height: 60px; }
.alt-checkbox { flex-direction: row; align-items: center; gap: 8px; }
.alt-checkbox label { text-transform: none; font-size: 14px; }

.alt-section { margin-top: 28px; }
.alt-section h2 { font-family: var(--alt-font-heading); font-size: 15px; margin-bottom: 10px; }

.alt-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.alt-badge-confirmed, .alt-badge-active { background: #e3f2e1; color: #2e7d32; }
.alt-badge-hold { background: #fff3cd; color: #8a6d00; }
.alt-badge-cancelled, .alt-badge-expired, .alt-badge-inactive, .alt-badge-retired { background: #f1f1f1; color: #777; }
.alt-badge-maintenance { background: #fde3e3; color: #b71c1c; }
.alt-badge-manual { background: #e3ecfd; color: #1a4fb7; }
.alt-badge-error { background: #fde3e3; color: #b71c1c; }
.alt-badge-warning { background: #fff3cd; color: #8a6d00; }
.alt-badge-info { background: #eef1f4; color: #55606b; }

.alt-btn-sm { padding: 4px 10px; font-size: 12px; }
.alt-btn-danger { background: var(--alt-error); }
.alt-btn-secondary { background: var(--alt-mid); }
.alt-link-btn { background: none; border: none; color: var(--alt-green); cursor: pointer; font-size: 13px; padding: 0; text-decoration: underline; font-family: var(--alt-font-body); }

.alt-cal-layout { display: flex; gap: 24px; align-items: flex-start; }
.alt-cal-filters { width: 200px; flex: none; display: flex; flex-direction: column; gap: 20px; }
.alt-cal-filter-group h3 { font-size: 11px; text-transform: uppercase; color: var(--alt-mid); margin-bottom: 8px; }
.alt-cal-filter-group select { width: 100%; padding: 6px 8px; border: 1px solid var(--alt-border); border-radius: 4px; font-family: var(--alt-font-body); font-size: 13px; }
.alt-cal-swatch { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; cursor: pointer; }
.alt-cal-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.alt-cal-main { flex: 1; min-width: 0; }
#alt-calendar { font-size: 13px; }
#alt-calendar .fc-event { cursor: pointer; border: none; }
#alt-calendar .fc-toolbar-title { font-family: var(--alt-font-heading); font-size: 16px; }
#alt-calendar .fc-button-primary { background: var(--alt-mid); border-color: var(--alt-mid); }
#alt-calendar .fc-button-primary:hover { background: var(--alt-dark); border-color: var(--alt-dark); }
#alt-calendar .fc-button-active { background: var(--alt-green) !important; border-color: var(--alt-green) !important; }
@media (max-width: 860px) {
  .alt-cal-layout { flex-direction: column; }
  .alt-cal-filters { width: 100%; flex-direction: row; flex-wrap: wrap; gap: 16px; }
}

.alt-stat-row { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.alt-stat { background: #fff; border: 1px solid var(--alt-border); border-radius: 8px; padding: 14px 20px; min-width: 140px; }
.alt-stat .n { font-family: var(--alt-font-heading); font-size: 22px; font-weight: 700; }
.alt-stat .l { font-size: 11px; color: var(--alt-mid); text-transform: uppercase; }

.alt-log {
  background: var(--alt-dark);
  color: #d0d0d0;
  padding: 16px;
  border-radius: var(--alt-radius);
  font-family: monospace;
  font-size: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  max-height: 70vh;
  overflow-y: auto;
}
