html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

/* ---- Caldriver Reports branding ---- */
:root {
  --cd-blue: #1F5C99;
  --cd-blue-2: #2E75B6;
  --cd-panel: #EBF3FB;
}

.app-navbar {
  background-color: var(--cd-blue);
}

.brand-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cd-blue);
}

/* Top bar: back button (left) + welcome greeting (right) */
.topbar {
  padding: .4rem 0 .5rem;
  border-bottom: 1px solid #eef2f6;
  margin-bottom: 1rem;
  min-height: 2.25rem;
}
.topbar .welcome-text {
  color: #6c7a89;
  font-size: .95rem;
}
.topbar .welcome-text strong {
  color: var(--cd-blue);
}

/* Login screen */
.auth-body {
  background: linear-gradient(135deg, #f3f7fb 0%, #e6eef7 100%);
}
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Dashboard panels & pivot tables */
.panel-card {
  border: 1px solid #d9e2ec;
  border-radius: .5rem;
  overflow: hidden;
}
.panel-card .panel-head {
  background: var(--cd-blue-2);
  color: #fff;
  padding: .6rem 1rem;
  font-weight: 600;
}
.pivot-table {
  margin-bottom: 0;
  font-size: .9rem;
}
.pivot-table thead th {
  background: var(--cd-panel);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.pivot-table th.row-head {
  text-align: left;
  font-weight: 500;
}
.pivot-table td.num, .pivot-table th.num {
  text-align: center;
}
/* Zebra striping for readability */
.pivot-table tbody tr:nth-of-type(even) {
  background-color: rgba(31, 92, 153, 0.045);
}
.pivot-table tbody tr:hover {
  background-color: rgba(31, 92, 153, 0.10);
}
/* Translucent gray, visually separated Total column */
.pivot-table .total-col {
  font-weight: 700;
  background-color: rgba(108, 122, 137, 0.14);
  border-left: 2px solid #b9c4d0;
}
.pivot-table tfoot td {
  font-weight: 700;
  background: #eef4fb;
  border-top: 2px solid #b9c4d0;
}
.pivot-table td.zero {
  color: #ccd4dd;
}

/* Detail grid: color-band rows by pickup location.
   Set Bootstrap's --bs-table-bg so the band colors the (otherwise white) cells. */
.pivot-table.banded tbody tr.pb0 { --bs-table-bg: #cfe2f7; }
.pivot-table.banded tbody tr.pb1 { --bs-table-bg: #fbd9c9; }
.pivot-table.banded tbody tr.pb2 { --bs-table-bg: #cdeed9; }
.pivot-table.banded tbody tr.pb3 { --bs-table-bg: #e6cff2; }
.pivot-table.banded tbody tr.pb4 { --bs-table-bg: #f5ebbf; }
.pivot-table.banded tbody tr.pb5 { --bs-table-bg: #c7eeea; }
.pivot-table.banded tbody tr.pb6 { --bs-table-bg: #f6cfdc; }
.pivot-table.banded tbody tr.pb7 { --bs-table-bg: #d8dde3; }
.pivot-table.banded tbody tr:hover { --bs-table-bg: #fff3cd; }

/* Distinct delivery-location text colors */
.dl-visalia { color: #1F5C99; font-weight: 600; }
.dl-tipton  { color: #C0561E; font-weight: 600; }
.kpi {
  font-size: 2rem;
  font-weight: 700;
  color: var(--cd-blue);
}

/* Grouped (Power BI-style) load-count table */
.grouped-table {
  font-size: .9rem;
}
.grouped-table thead th {
  background: var(--cd-panel);
  white-space: nowrap;
}
.grouped-table .commodity-cell {
  vertical-align: middle;
  font-weight: 600;
  background: #f7fafd;
}
.grouped-table td.num, .grouped-table th.num {
  text-align: right;
  white-space: nowrap;
}
.grouped-table .total-col {
  vertical-align: middle;
  font-weight: 700;
  background: #f7fafd;
}
.grouped-table tfoot td {
  background: #eef4fb;
}

/* ---- Customer landing summary cards ---- */
.summary-card {
  border: 1px solid #d9e2ec;
  border-radius: .75rem;
  overflow: hidden;
  height: 100%;
}
.summary-card .summary-head {
  background: var(--cd-blue);
  color: #fff;
  padding: .75rem 1.25rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.summary-card .summary-head .summary-date {
  font-size: .8rem;
  font-weight: 400;
  opacity: .85;
}
.summary-card .summary-body {
  padding: 1.25rem;
}
.summary-total {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  color: var(--cd-blue);
}
.split-box {
  border: 1px solid #e3e9f0;
  border-radius: .5rem;
  padding: .6rem 1rem;
  text-align: center;
  background: #f7fafd;
}
.split-box .split-label {
  font-size: .8rem;
  color: #6c7a89;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.split-box .split-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #2E75B6;
}
.view-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .25rem;
  height: 100%;
  text-align: left;
  padding: 1rem 1.25rem;
}
.view-btn .view-btn-title { font-size: 1.1rem; font-weight: 600; }
.view-btn .view-btn-sub { font-size: .8rem; opacity: .8; }

/* ---- Mobile-friendly grouped view ---- */
.mobile-panel {
  border: 1px solid #d9e2ec;
  border-radius: .75rem;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.mobile-panel-head {
  background: var(--cd-blue-2);
  color: #fff;
  padding: .65rem 1rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}
.commodity-block {
  border-top: 1px solid #e3e9f0;
}
.commodity-block:first-child { border-top: 0; }
.commodity-block .commodity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #eef4fb;
  padding: .5rem 1rem;
  font-weight: 700;
}
.commodity-block .commodity-row .badge {
  font-size: .9rem;
}
.commodity-block .pickup-row {
  display: flex;
  justify-content: space-between;
  padding: .4rem 1rem .4rem 1.75rem;
  border-top: 1px solid #f0f4f8;
  font-size: .95rem;
}
.commodity-block .pickup-row .pickup-count {
  font-weight: 600;
  color: var(--cd-blue);
}

/* ---- App shell: top bar + left menu ---- */
body { margin-bottom: 0; }
.app-top {
  position: sticky; top: 0; z-index: 1030;
  display: flex; align-items: center; gap: .75rem;
  height: 52px; padding: 0 1rem;
  background: var(--cd-blue); color: #fff;
}
.app-top .app-brand { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; font-weight: 600; font-size: 1.05rem; white-space: nowrap; }
.app-top .app-brand:hover { color: #fff; }
.app-logo { background: #fff; border-radius: 8px; padding: 1px; flex: 0 0 auto; }
.app-user { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .9rem; color: #dce8f5; white-space: nowrap; }
.app-user strong { color: #fff; }
.side-toggle {
  background: transparent; border: 1px solid rgba(255,255,255,.45); color: #fff;
  border-radius: .4rem; width: 36px; height: 32px; font-size: 1.05rem; line-height: 1; padding: 0;
}
.side-toggle:hover { background: rgba(255,255,255,.12); }
.app-shell { display: flex; min-height: calc(100vh - 52px); }
.app-side {
  width: 250px; flex: 0 0 250px;
  background: #f4f7fb; border-right: 1px solid #dde5ef;
  padding: .75rem .5rem 2rem;
  position: sticky; top: 52px; height: calc(100vh - 52px); overflow-y: auto;
  font-size: .9rem;
}
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.app-content { flex: 1 0 auto; padding: 1.25rem 1.5rem 1.5rem; width: 100%; max-width: 1600px; }
.app-foot { padding: .9rem 1.5rem; border-top: 1px solid #e5e9ef; }
.app-side .side-link { display: block; padding: .36rem .7rem; border-radius: .4rem; color: #24405f; text-decoration: none; line-height: 1.25; }
.app-side a.side-link:hover { background: #e3ecf7; color: var(--cd-blue); }
.app-side .side-link.on, .app-side a.side-link.on:hover { background: var(--cd-blue); color: #fff; }
.side-link.sub { padding-left: 1.4rem; }
.side-link.sub2 { padding-left: 2rem; font-size: .86rem; }
.side-link.sub3 { padding-left: 2.6rem; font-size: .84rem; }
.app-side .side-link.soon { color: #9aa7b6; cursor: default; }
.side-link.soon small { font-size: .62rem; text-transform: uppercase; letter-spacing: .03em; border: 1px solid #c9d2dd; border-radius: .3rem; padding: 0 .25rem; margin-left: .3rem; }
.side-group > summary { list-style: none; display: flex; align-items: center; cursor: pointer; border-radius: .4rem; }
.side-group > summary::-webkit-details-marker { display: none; }
.side-group > summary::after { content: '\25B8'; padding: 0 .55rem; color: #7b8ba0; font-size: .75rem; transition: transform .15s; }
.side-group[open] > summary::after { transform: rotate(90deg); }
.side-group > summary .side-link { flex: 1 1 auto; }
.app-side > .side-group > summary .side-link, .app-side > .side-link { font-weight: 600; }
.side-scrim { display: none; }
body.side-collapsed .app-side { display: none; }
@media (max-width: 991.98px) {
  .app-side {
    position: fixed; left: 0; top: 52px; bottom: 0; height: auto; z-index: 1040;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 2px 0 14px rgba(0,0,0,.18);
  }
  body.side-collapsed .app-side { display: block; }
  body.side-open .app-side { transform: none; }
  body.side-open .side-scrim { display: block; position: fixed; inset: 52px 0 0 0; background: rgba(0,0,0,.25); z-index: 1035; }
  .app-content { padding: 1rem; }
}
@media print {
  .app-top, .app-side, .app-foot, .side-scrim { display: none !important; }
}

/* Landing pages: link cards (same card look as the Dashboard) */
.link-card .card-title { color: var(--cd-blue); }
.link-card ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.link-card li { margin: .1rem 0; }
.card.soon { opacity: .55; }
.card.soon .badge { font-weight: 500; }
