body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #f3f4f6;
}

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden; /* sidebar stays fixed; main scrolls */
}

.sidebar {
  width: 230px;
  background-color: #0f172a;
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  position: relative;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
  font-size: 1.1rem;
}

}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar .nav-link {
  color: #cbd5f5;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.nav-icon{
  width: 28px;
  display: inline-grid;
  place-items: center;
  font-size: 1.05rem;
  line-height: 1;
  flex: 0 0 28px;
}

.nav-text{ flex: 1 1 auto; min-width: 0; }

/* Sidebar collapse / expand */
.sidebar-toggle{
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.10);
  background: #ffffff;
  color: #0f172a;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  z-index: 50;
}

.sidebar-toggle:focus{ outline: none; box-shadow: 0 0 0 3px rgba(13,110,253,0.25), 0 6px 18px rgba(0,0,0,0.08); }

.sidebar.collapsed{
  width: 72px;
  padding: 0.75rem 0.5rem;
}
.sidebar.collapsed .brand-mark{ width: 52px; height: 44px; border-radius: 12px; }
.sidebar.collapsed .brand-company,
.sidebar.collapsed .brand-subtitle,
.sidebar.collapsed .nav-text{ display: none; }
.sidebar.collapsed .sidebar-nav{ gap: 0.35rem; }
.sidebar.collapsed .nav-link{ justify-content: center; padding: 0.6rem 0.5rem; border-radius: 14px; }
.sidebar.collapsed .nav-icon{ flex: 0 0 auto; width: auto; }
.sidebar.collapsed .sidebar-footer{ display: none; }

.sidebar .nav-link:hover {
  background-color: #1e293b;
  color: #f9fafb;
}

.sidebar .nav-link.active {
  background-color: #f97316;
  color: #111827;
  font-weight: 600;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  padding: 1rem 1.5rem 0.5rem;
}

.topbar-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
}

.card-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin-bottom: 0.35rem;
}

.card-value {
  font-size: 1.8rem;
  font-weight: 600;
}

.schedule-pill {
  background-color: #0f172a;
  color: #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.25rem 0.4rem;
}

.schedule-pill .tiny {
  font-size: 0.7rem;
}

.alert-sm {
  font-size: 0.85rem;
}


/* ---------- Weekly Schedule Grids ---------- */

.schedule-grid {
  /* Let the page scroll naturally; avoids a "scroll inside a scroll" feeling */
  max-height: none;
}

/* ---------- Table Sorting (shared) ---------- */

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 6px;
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid rgba(0,0,0,0.25);
  opacity: 0.0; /* hidden until sorted */
}

th.sortable.sort-asc::after {
  opacity: 1.0;
  transform: rotate(180deg);
}

th.sortable.sort-desc::after {
  opacity: 1.0;
}

.schedule-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.schedule-table thead tr:nth-child(2) th {
  top: 34px; /* approximate height of first header row */
  z-index: 2;
}

.schedule-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--bs-body-bg);
  min-width: 180px;
  white-space: nowrap;
}

.schedule-table thead .sticky-col {
  background: #f8f9fa;
}

.schedule-cell {
  min-width: 220px;
  vertical-align: top;
  padding: 8px;
}

.load-card {
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
  background: #fff;
}

.load-card.solo1 {
  border-left: 6px solid #198754; /* green */
}

.load-card.solo2 {
  border-left: 6px solid #0d6efd; /* blue */
}

.load-card.unknown {
  border-left: 6px solid #6c757d; /* gray */
}

.badge-solo1 {
  background: #198754;
}

.badge-solo2 {
  background: #0d6efd;
}

.badge-unknown {
  background: #6c757d;
}

.unassigned-row th {
  background: #fff;
}


/* ---------- UI Shell Foundation (v1) ---------- */

.content-wrap {
  padding: 0 20px 20px;
  flex: 1 1 auto;
  overflow-y: auto; /* only main content scrolls */
  overflow-x: hidden;
  min-height: 0;
}

/* ---------- Sidebar: collapsible + icons-only mode ---------- */

.sidebar-toggle {
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #ffffff;
  color: #111827;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  cursor: pointer;
  z-index: 60;
}

.sidebar-toggle:focus { outline: 2px solid rgba(13,110,253,0.35); outline-offset: 2px; }

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-icon {
  width: 24px;
  display: inline-grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
}

.nav-text { min-width: 0; }

.sidebar.collapsed {
  width: 76px;
  padding: 0.75rem 0.6rem;
}

.sidebar.collapsed .brand-company,
.sidebar.collapsed .brand-subtitle,
.sidebar.collapsed .sidebar-user-switch,
.sidebar.collapsed .sidebar-company,
.sidebar.collapsed .sidebar-meta {
  display: none !important;
}

.sidebar.collapsed .brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 14px;
}

.sidebar.collapsed .sidebar-nav .nav-link {
  justify-content: center;
  padding: 0.55rem 0.5rem;
}

.sidebar.collapsed .sidebar-nav .nav-text {
  display: none;
}

.sidebar.collapsed .sidebar-footer {
  padding-top: 8px;
}

.sidebar.collapsed .nav-icon { font-size: 18px; }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 10px;
}
.topbar-left { min-width: 0; }
.topbar-title { margin: 0; font-size: 20px; font-weight: 700; }
.topbar-subtitle { font-size: 12px; color: #6b7280; margin-top: 2px; min-height: 16px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topbar-actions-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.user-menu-btn { display: inline-flex; align-items: center; gap: 8px; }
.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(15,23,42,0.08);
  font-weight: 700;
  font-size: 12px;
}

/* ---------- Home: upload cards ---------- */

.upload-dropzone {
  border: 1px dashed rgba(15,23,42,0.25);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  background: rgba(15,23,42,0.02);
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.upload-dropzone:hover {
  background: rgba(15,23,42,0.04);
  transform: translateY(-1px);
}

.upload-dropzone.dragover {
  border-color: rgba(249,115,22,0.8);
  background: rgba(249,115,22,0.08);
}

.upload-dropzone-inner { display: flex; gap: 10px; align-items: center; }
.upload-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(15,23,42,0.06);
}

.chart-wrap { max-width: 280px; margin: 0 auto; }

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 12px 14px 10px;
  margin: 0 0 10px 0;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-mark {
  width: 120px;
  height: 76px;
  border-radius: 16px;
  overflow: hidden;
  background: transparent;
  border: 0;
  display: grid;
  place-items: center;
}

.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-fallback { width: 22px; height: 22px; border-radius: 7px; background: rgba(255,255,255,0.25); }
.brand-company { font-weight: 700; font-size: 18px; line-height: 1.1; color: #e5e7eb; margin: 0; }
.brand-subtitle { font-size: 12px; color: rgba(229,231,235,0.75); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-meta .meta-label { font-size: 11px; color: rgba(229,231,235,0.7); }
.sidebar-meta .meta-value { font-size: 12px; font-weight: 600; color: #e5e7eb; }


/* Weekly schedule week navigation */
.week-nav-inline{display:flex;align-items:center;gap:8px;}
.week-nav-inline .week-label{font-weight:600;min-width:72px;text-align:center;}


/* ---------- Topbar 3-column layout ---------- */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.topbar-left { flex: 0 0 auto; min-width: 240px; }
.topbar-center { flex: 1 1 auto; display: flex; justify-content: center; padding-top: 2px; }
.topbar-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }
.topbar-actions-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.schedule-search { max-width: 520px; width: 100%; }
.week-nav-inline { display: inline-flex; align-items: center; gap: 10px; }
.week-nav-inline .week-label { font-weight: 700; font-size: 16px; line-height: 1; }
.week-nav-inline .btn { font-size: 16px; padding: 6px 10px; }


/* Weekly summary tiles: label and value on one line */
.tile-body .tile-line{display:flex;align-items:center;justify-content:space-between;gap:12px;}
.tile-body .card-label{margin:0;font-size:13px;color:#6b7280;}
.tile-body .card-value{margin:0;font-size:18px;font-weight:700;color:#111827;}

.truncate{max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}

/* Reports: compact pills inside tiles */
.nav-pills-sm .nav-link {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

/* --- Simulator UI --- */

.card-soft {
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  border-radius: 16px;
}

.kpi {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.kpi-label {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
  letter-spacing: 0.02em;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.kpi-sub {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
  margin-top: 4px;
}


.brand-logo { display: block; width: 40px; height: auto; max-height: 40px; }

.sidebar-company { font-size: 12px; color: rgba(229,231,235,0.85); padding: 10px 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* Prevent tab bars from wrapping (stabilizes layout across zoom levels) */
.tab-nowrap{flex-wrap:nowrap !important; overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch; white-space:nowrap;}
.tab-nowrap .nav-link{white-space:nowrap;}
.tab-nowrap::-webkit-scrollbar{height:6px;}

.sidebar-user-switch{margin-bottom:10px;}
.sidebar-user-switch .meta-label{font-size:11px; text-transform:uppercase; letter-spacing:.04em; opacity:.8; margin-bottom:4px;}

/* Keep tab rows from wrapping/stacking on zoom; allow horizontal scroll */
.tabs, .nav-tabs, .tab-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  white-space: nowrap;
  gap: 8px;
}
.tabs button, .nav-tabs button, .tab-row button {
  flex: 0 0 auto;
}


/* Home: sticky action row */
.home-actions-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}


/* ---------- Home layout hardening (zoom-safe) ---------- */
*, *::before, *::after { box-sizing: border-box; }

.home-actions-sticky{
  position: sticky;
  top: 0;
  z-index: 40;
  background: #f5f6f8;
  padding: 10px 0; /* slimmer sticky row */
}

/* Reduce padding inside the sticky row cards so the row stays "skinny" */
.home-actions-sticky .card-body{
  padding: 6px 16px;
}
.home-actions-sticky .card-title{
  font-size: 1.15rem;
  margin-bottom: .35rem;
}
.home-actions-sticky p{
  margin-bottom: .6rem;
}

/* Upload dropzones: hide the native file input so it never bleeds at 100% zoom */
.upload-dropzone{
  position: relative;
  overflow: hidden;
  padding: 12px;
}
.upload-dropzone input[type="file"]{
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-dropzone-inner{ gap: 8px; }
.upload-icon{
  width: 30px;
  height: 30px;
  border-radius: 10px;
  font-size: 14px;
}

/* Distribution tiles should be taller than summary tiles (as in original) */
.home-distribution-row .card{
  min-height: 280px;
}
.home-summary-row .card{
  min-height: 220px;
}

/* Make charts readable and proportional */
.chart-wrap{
  width: min(360px, 100%);
  max-width: 100%;
  margin: 0 auto;
}
.chart-wrap canvas{
  width: 100% !important;
  height: auto !important;
  max-height: 180px;
}

/* Prevent text overflow/bleed in tiles at browser zoom changes */
.tile-small{
  font-size: .95rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.metric-label{
  font-size: .85rem;
  color: rgba(15,23,42,0.7);
}
.metric-big{
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.metric-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  align-items: end;
}
.metric-right{ text-align: right; }

@media (max-width: 992px){
  .home-actions-sticky{ padding: 8px 0; }
  .home-actions-sticky .card-body{ padding: 6px 14px; }
  .metric-grid{ grid-template-columns: 1fr; }
  .metric-right{ text-align: left; }
}

/* ------------------- Home sizing spec (user-provided) ------------------- */

/* 3) Top action row: not sticky, fixed-height bar */
.home-actions-sticky{
  position: relative !important;
  top: auto !important;
  z-index: auto !important;
  background: transparent !important;
  padding: 0 !important;
}

/* Make the top row compact */
.home-actions-sticky .row.g-3{ align-items: stretch; }

/* Hide the Beta badge (per request) */
.home-actions-sticky .badge{ display: none !important; }

/* Keep the action cards short */
.home-actions-sticky .card{ height: 88px !important; }
.home-actions-sticky .card-body{ padding: 6px 14px !important; }

/* Search card: make it a compact horizontal control row */
.home-actions-sticky .col-lg-5 .card-body{
  display: flex;
  align-items: center;
  gap: 12px;
}
.home-actions-sticky .col-lg-5 .card-title{ font-size: 16px !important; margin: 0 !important; white-space: nowrap; }
.home-actions-sticky .col-lg-5 p{ display: none !important; }
.home-actions-sticky .col-lg-5 form{ margin: 0 !important; flex: 1; }
.home-actions-sticky .col-lg-5 form .form-control{ font-size: 14px !important; height: 40px; }
.home-actions-sticky .col-lg-5 form .btn{ font-size: 14px !important; height: 40px; }

/* Upload cards: compact dropzone */
.home-actions-sticky .col-lg-7 .card-title{ font-size: 14px !important; margin: 0 0 6px 0 !important; }
.home-actions-sticky .upload-dropzone{ padding: 6px !important; }
.home-actions-sticky .upload-dropzone-inner{ gap: 8px; }
.home-actions-sticky .upload-icon{ width: 28px; height: 28px; font-size: 14px; }
.home-actions-sticky .upload-text .fw-semibold{ font-size: 14px !important; }
.home-actions-sticky .upload-text .small{ font-size: 10px !important; line-height: 1.1; }
.home-actions-sticky .upload-status{ display: none !important; }

/* 4) Distribution tiles: tall, fixed height */
#distribution-charts .card{ height: 380px !important; }
#distribution-charts .card-body{ padding: 20px !important; position: relative; }
#distribution-charts .card-title{ font-size: 18px !important; margin-bottom: 12px !important; }

/* Chart area fixed; canvas scales inside */
#distribution-charts .chart-wrap{
  height: 280px;
  width: 100%;
  max-width: 100%;
  margin: 0;
}
#distribution-charts .chart-wrap canvas{
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
}

/* Captions aligned bottom-left */
#distribution-charts .card-body > .small.text-muted{
  position: absolute;
  left: 20px;
  bottom: 18px;
  margin: 0 !important;
  text-align: left;
  font-size: 13px !important;
}

/* Summary tiles: fixed height (override Bootstrap h-100) */
#summary-tiles .card.h-100{
  height: 160px !important;   /* change this number as you like */
}
#summary-tiles .h-100{
  height: auto !important;     /* neutralize Bootstrap's height:100% inside summary area */
}
#summary-tiles .card-body{ padding: 20px !important; }
#summary-tiles .card-title{ font-size: 18px !important; margin-bottom: 10px !important; }
#summary-tiles .small.text-muted{ font-size: 13px !important; line-height: 1.5; }

/* Remove progress bar to keep all summary tiles consistent */
#summary-tiles .progress{ display: none !important; }

/* KPI numbers in Summary tiles: force same size as title */
#summary-tiles .display-1,
#summary-tiles .display-2,
#summary-tiles .display-3,
#summary-tiles .display-4,
#summary-tiles .display-5,
#summary-tiles .display-6,
#summary-tiles .fs-1,
#summary-tiles .fs-2,
#summary-tiles .fs-3,
#summary-tiles .fs-4 {
  font-size: 14px !important;
  line-height: 1.2 !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}

/* Prevent weird wrapping in the assigned/total fraction */
#summary-tiles .display-5{ letter-spacing: 0; }

/* HARD OVERRIDE: summary tile main values match title size */
#summary-tiles .card * {
  max-width: 100%;
}


/* Force Summary tile big metrics to match tile title size */
#summary-tiles .metric-big{
  font-size: 18px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
}

/* SUMMARY TILES: force compact height (no dependency on #summary-tiles) */
.card.shadow-sm.h-100:has(.metric-grid),
.card.shadow-sm.h-100:has(.metric-big){
  height: 160px !important;     /* adjust this number */
}

.card.shadow-sm.h-100:has(.metric-grid) .card-body,
.card.shadow-sm.h-100:has(.metric-big) .card-body{
  padding: 14px 16px !important; /* reduce padding so content fits */
}

/* Summary tiles: compact height via metric class (no wrapper id) */
.metric-grid{
  margin-top: 4px !important;
}

.metric-grid .metric-big{
  font-size: 18px !important;
}

.metric-grid{
  min-height: 0 !important;
}

.metric-grid, .metric-grid *{
  max-height: 100%;
}

.metric-grid{
  display: flex;
  gap: 10px;
}

.metric-grid > div{
  flex: 1 1 0;
}

/* Reduce the card's padding around metric grids */
.card-body .metric-grid{
  margin-bottom: 6px !important;
}
/* Summary tiles: fixed compact height (authoritative) */
.summary-tile{
  height: 160px !important;     /* change this number */
  overflow: hidden !important;
}
.summary-tile .card-body{
  padding: 14px 16px !important;
}


/* === AUTHORITATIVE SUMMARY TILE SIZING (final) === */
#summary-tiles .card.summary-tile{
  height: 160px !important;      /* adjust as needed */
  min-height: 0 !important;      /* override earlier min-height rules */
}
#summary-tiles .card.summary-tile .card-body{
  padding: 14px 16px !important; /* tighter vertical padding */
}
#summary-tiles .card.summary-tile .tile-small{
  margin-bottom: 6px !important;
}
#summary-tiles .card.summary-tile .metric-grid{
  margin-top: 6px !important;
}
