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; }

/* Clean load reports (Load Report, Feed Reports) and the /Feed Today / Year-to-date cards */
.fl-card { display: block; border: 1px solid #d4d9e0; border-radius: .5rem; padding: .5rem 1rem; min-width: 150px; background: #fff; color: inherit; text-decoration: none; }
a.fl-card:hover { border-color: var(--cd-blue); color: inherit; }
.fl-card.on { border-color: var(--cd-blue); box-shadow: inset 0 0 0 1px var(--cd-blue); background: #eef4fb; }
.fl-card .n { font-size: 1.8rem; font-weight: 700; color: var(--cd-blue); line-height: 1.1; }
.fl-card .n.big { font-size: 2.6rem; }
.fl-card .n a { color: inherit; text-decoration: none; }
.fl-card .l { font-size: .75rem; color: #5b6779; text-transform: uppercase; letter-spacing: .03em; }
.fl-card .d { font-size: .7rem; color: #8a94a3; }
.fl-sub { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .15rem .75rem; font-size: .8rem; }
.fl-sub a { text-decoration: none; }
table.fl-table { font-size: .84rem; }
table.fl-table th { background: #eef1f5; font-size: .72rem; color: #5b6779; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
table.fl-table td { vertical-align: middle; }
table.fl-table tr.cx td { color: #9aa3ae; text-decoration: line-through; }

/* (10/22) Drop-down menus open on top of the page (data-bs-popper-config strategy "fixed" on every toggle), so a table's
   scroll box never cuts one off. When its button is scrolled out of sight, the menu hides with it. */
.dropdown-menu[data-popper-reference-hidden] { visibility: hidden; pointer-events: none; }

/* ---- CSC Gold customer sheets (the customer's own spreadsheet colours: AB Van Nuys black/yellow, Firestone blue/green/yellow) ---- */
.cg-sheet { border-collapse: collapse; font-size: .9rem; white-space: nowrap; }
.cg-sheet th, .cg-sheet td { border: 1px solid #c8c8c8; padding: .15rem .6rem; text-align: center; }
.cg-ab-head th { background: #000; color: #ff0; font-weight: 700; }
.cg-month th { background: #fff; color: #000; font-weight: 700; }
.cg-fs-head th { background: #4a86e8; color: #000; font-weight: 700; }
.cg-fs-head th.cg-count { background: #0f0; color: #000; }
.cg-row td { background: #ff0; color: #000; }
.cg-row td.cg-blank { background: #fff; }
/* Customer Notes: the customer's own column — clickable for the logins that may edit it ("add note" in an empty cell). */
.cg-sheet td.cg-cnote { white-space: normal; overflow-wrap: anywhere; min-width: 8rem; max-width: 22rem; }
.cg-sheet td.cg-cnote-edit { cursor: pointer; }
.cg-sheet td.cg-cnote-edit:hover { outline: 2px solid #4a86e8; outline-offset: -2px; }
.cg-sheet td.cg-cnote-edit:empty::after { content: "add note"; color: #999; font-style: italic; font-size: .8em; }
.cg-cnote-box { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; min-width: 14rem; }
.cg-cnote-box input { flex: 1 0 100%; }
.cg-cnote-msg { flex-basis: 100%; font-size: .8em; color: #a00; text-align: left; }
.cg-range { min-width: 16rem; }
@media print {
  .cg-sheet th, .cg-sheet td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cg-sheet td.cg-cnote-edit:empty::after { content: none; }
}
/* ---- JD Heiskell customer sheets: the same grid in JDH green (never CSC Gold's colours; its rows never carry cg-row) ---- */
.jdh-head th { background: #1e5631; color: #fff; font-weight: 700; }
.jdh-head th.jdh-count { background: #a9d08e; color: #000; }
.jdh-row td { background: #e2efda; color: #000; }
.jdh-row td.cg-blank { background: #fff; }
.cg-sheet.jdh td.cg-cnote-edit:hover { outline-color: #1e5631; }
@media print { .cg-sheet.jdh { font-size: .75rem; } }
/* (10/20) the customer's Affidavit (click to type, like a note) and Needs correction cells: red while checked, green with
   ABA's fixed line once ABA marks it fixed (dark text on light fills, ≥ 7:1; legible printed in grey). */
.cg-sheet td.cg-aff { min-width: 6rem; max-width: 12rem; white-space: normal; overflow-wrap: anywhere; }
.cg-sheet td.cg-aff-edit { cursor: pointer; }
.cg-sheet td.cg-aff-edit:hover { outline: 2px solid #4a86e8; outline-offset: -2px; }
.cg-sheet.jdh td.cg-aff-edit:hover { outline-color: #1e5631; }
.cg-sheet td.cg-aff-edit:empty::after { content: "add"; color: #999; font-style: italic; font-size: .8em; }
.cg-sheet td.cg-fix { min-width: 7rem; max-width: 16rem; white-space: normal; overflow-wrap: anywhere; }
.cg-sheet td.cg-fix-on { background: #f8d7da; color: #58151c; font-weight: 600; }
.cg-sheet td.cg-fix-done { background: #d1e7dd; color: #0a3622; }
.cg-fix-box { width: 1.1rem; height: 1.1rem; vertical-align: middle; cursor: pointer; }
.cg-fix-line { display: block; font-size: .78em; }
.cg-fix-line:empty { display: none; }
@media print { .cg-sheet td.cg-aff-edit:empty::after { content: none; } }
