:root {
  --page-bg: #ffffff;
  --grid-line: #000000;
  --grid-line-soft: #000000;
  --text: #050505;
  --empty-slot: #ffffff;
  --header-bg: #005f7f;
  --header-text: #ffffff;
  --date-bar-bg: #d8d8d8;
  --date-bar-text: #4a4a4a;
  --current-day-bg: #000000;
  --card-bg: #e8edf4;
  --req-card-main-bg: #d9d9d9;
  --slot-gap: 5px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--page-bg);
  color: var(--header-text);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

body.view-2,
body.view-day {
  overflow-y: auto;
}

body.view-3,
body.view-1 {
  overflow: hidden;
}

.app {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  background: var(--page-bg);
}

.app.view-2,
.app.view-day {
  height: auto;
  min-height: 100vh;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 0;
  padding: 0 10px;
  border: 1px solid var(--header-bg);
  background: var(--header-bg);
}

.topbar-left {
  justify-self: start;
  display: flex;
  align-items: baseline;
  gap: 18px;
  min-width: 0;
}

.brand-title {
  justify-self: center;
  font-size: 30px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.brand-range {
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.clock {
  text-align: left;
  font-size: 22px;
  font-weight: 900;
  white-space: nowrap;
}

.status-line {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 4px;
}

.calendar-filters {
  display: flex;
  align-items: center;
  gap: 4px;
}

.calendar-filter {
  width: 112px;
  height: 31px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.7);
  padding: 0 7px;
  background: #fff;
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.calendar-filter::placeholder {
  color: #555;
  opacity: 1;
}

.sales-filter {
  width: 70px;
}

.view-button {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.view-button.active {
  background: #fff;
  color: var(--header-bg);
}

.view-button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.fullscreen-button {
  position: relative;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
}

.fullscreen-corner {
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: currentColor;
  pointer-events: none;
}

.fullscreen-corner-tl {
  top: 3px;
  left: 3px;
  border-top: 3px solid;
  border-left: 3px solid;
}

.fullscreen-corner-tr {
  top: 3px;
  right: 3px;
  border-top: 3px solid;
  border-right: 3px solid;
}

.fullscreen-corner-bl {
  bottom: 3px;
  left: 3px;
  border-bottom: 3px solid;
  border-left: 3px solid;
}

.fullscreen-corner-br {
  right: 3px;
  bottom: 3px;
  border-right: 3px solid;
  border-bottom: 3px solid;
}

.fullscreen-button.active .fullscreen-corner-tl {
  top: 7px;
  left: 7px;
}

.fullscreen-button.active .fullscreen-corner-tr {
  top: 7px;
  right: 7px;
}

.fullscreen-button.active .fullscreen-corner-bl {
  bottom: 7px;
  left: 7px;
}

.fullscreen-button.active .fullscreen-corner-br {
  right: 7px;
  bottom: 7px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #33c671;
  box-shadow: 0 0 0 3px rgba(51, 198, 113, 0.18);
  flex: 0 0 auto;
}

.status-dot.error {
  background: #ff3434;
  box-shadow: 0 0 0 3px rgba(255, 52, 52, 0.18);
}

.app.view-day .brand-title,
.app.view-day .calendar-filters,
.app.view-day #cardCount,
.app.view-day #lastUpdated {
  display: none;
}

.app.view-day .topbar {
  grid-template-columns: minmax(0, 1fr) auto;
}

.app.view-day .topbar-left {
  align-items: center;
  gap: 12px;
}

.status-dot.inline-date-dot {
  margin-left: -2px;
}

.calendar-view {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 48px;
}

.app.view-2 .calendar-view {
  min-height: calc(100vh - 74px);
  grid-template-rows: repeat(3, minmax(520px, 1fr));
}

.app.view-1 .calendar-view {
  grid-template-rows: minmax(0, 1fr);
}

.hidden {
  display: none !important;
}

.week {
  min-height: 0;
  display: grid;
  grid-template-rows: 46px minmax(0, 1fr);
  border: 1px solid var(--grid-line);
  border-bottom: 0;
  background: var(--page-bg);
}

.week + .week {
  margin-top: 0;
}

.week-head {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 0;
  background: var(--date-bar-bg);
}

.day-head {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 8px;
  border-right: 0;
  color: var(--date-bar-text);
  font-weight: 900;
  text-transform: uppercase;
}

.day-head:last-child {
  border-right: 0;
}

.day-head:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 0;
  bottom: 5px;
  width: 1px;
  background: #000;
  pointer-events: none;
}

.day-head.today {
  color: #ffffff;
  background: #000000;
}

.day-info,
.day-summary {
  min-width: 0;
  display: grid;
  align-content: center;
}

.day-info > *,
.day-summary > * {
  max-width: 100%;
}

.day-info {
  justify-items: start;
}

.day-summary {
  justify-items: end;
}

.total-miles,
.total-time {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.05;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-name {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-date {
  overflow: hidden;
  text-align: center;
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  color: inherit;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.day-count {
  font-size: 13px;
  color: inherit;
  line-height: 1.05;
  opacity: 0.9;
  white-space: nowrap;
}

.week-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.day {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: var(--slot-gap);
  border-right: 0;
  background: var(--page-bg);
}

.day.today {
  background: var(--page-bg);
  box-shadow: inset 0 0 0 3px var(--current-day-bg);
}

.day:not(:last-child)::after {
  content: "";
  position: absolute;
  z-index: 1;
  top: var(--slot-gap);
  right: 0;
  bottom: var(--slot-gap);
  width: 1px;
  background: #000;
  pointer-events: none;
}

.day:last-child {
  border-right: 0;
}

.slots {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(10, minmax(0, 1fr));
  gap: var(--slot-gap);
}

.slot {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.slot.empty {
  border: 1px solid var(--page-bg);
  background: var(--empty-slot);
}

.card {
  --status-tag: #0082c5;
  --category-tag: #b7b900;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 24px;
  overflow: hidden;
  border: 1px solid var(--page-bg);
  background: var(--card-bg);
  color: var(--text);
  font-family: "Aptos Narrow", "Arial Narrow", Arial, Helvetica, sans-serif;
  font-stretch: condensed;
}

/* Emphasize today; blend other cards 30% into the white day background. */
.day.today .card,
.day.today .overflow-card,
.app.view-day .day-card-list .card {
  filter: brightness(0.8);
}

.day:not(.today) .card,
.day:not(.today) .overflow-card {
  opacity: 0.7;
}

.card.card-dark .address,
.card.card-dark .note {
  color: #fff;
}

.tag {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 3px 0;
  color: #000;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
}

.status-tag {
  background: var(--status-tag);
  transform: rotate(180deg);
}

.category-tag {
  background: var(--category-tag);
}

.tag.dark {
  color: #fff;
}

.card-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 16px minmax(0, 1fr) 16px;
  padding: 2px 6px 3px;
  overflow: hidden;
}

.card.req-placement .card-main {
  background: var(--req-card-main-bg);
  color: var(--text);
}

.card.req-placement.card-dark .card-main .address,
.card.req-placement.card-dark .card-main .note {
  color: var(--text);
}

.card-top,
.card-bottom {
  min-width: 0;
  display: grid;
  align-items: center;
  column-gap: 5px;
  white-space: nowrap;
}

.card-top {
  grid-template-columns: minmax(68px, 0.8fr) minmax(0, 1fr) minmax(64px, 0.75fr);
}

.card-bottom {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  justify-items: center;
  font-size: 12px;
  font-weight: 400;
}

.job-number {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 17px;
  font-weight: 700;
  text-align: left;
}

.load-label {
  overflow: hidden;
  color: #f00000;
  font-size: 17px;
  font-weight: 700;
  text-align: right;
  text-overflow: ellipsis;
}

.traffic-badge {
  justify-self: center;
  max-width: 100%;
  min-height: 16px;
  overflow: hidden;
  padding: 1px 8px 0;
  background: transparent;
  color: transparent;
  font-size: 11px;
  font-weight: 400;
  line-height: 15px;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.traffic-badge.red {
  background: #ef1717;
  color: #fff;
}

.traffic-badge.yellow {
  background: #ffe100;
  color: #000;
}

.traffic-badge.green {
  background: #00a651;
  color: #fff;
}

.card-center {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: center;
  overflow: hidden;
  text-align: center;
}

.customer,
.job-name,
.address,
.note {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer {
  font-size: 14.3px;
  font-weight: 700;
  line-height: 1.2;
}

.job-name {
  font-size: 17.1px;
  font-weight: 400;
  line-height: 1.1;
}

.address {
  color: #111;
  font-size: 11px;
  font-weight: 400;
  line-height: 14px;
}

.note {
  color: #111;
  font-size: 12px;
  font-style: italic;
  font-weight: 400;
  line-height: 14px;
  min-height: 14px;
}

.metric {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 1px 3px;
  text-overflow: ellipsis;
}

.metric.route-green {
  color: #006a31;
}

.metric.route-yellow {
  background: #ffe100;
  color: #000;
}

.metric.route-red {
  background: #e91414;
  color: #fff;
}

.overflow-card {
  height: 100%;
  display: grid;
  place-items: center;
  border: 1px solid #48515a;
  background: #242b31;
  color: #f7f7f7;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0;
  text-align: center;
}

.closed-layer {
  position: absolute;
  z-index: 4;
  left: var(--slot-gap);
  right: var(--slot-gap);
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  background: #000;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  color: #fff;
  text-align: center;
  text-transform: uppercase;
}

.closed-layer.full {
  top: var(--slot-gap);
  bottom: var(--slot-gap);
}

.closed-layer.am {
  top: var(--slot-gap);
  /* Two of the ten card slots, including the gap between them. */
  height: calc((100% - (var(--slot-gap) * 11)) / 5 + var(--slot-gap));
}

.closed-layer.pm {
  bottom: var(--slot-gap);
  height: calc((100% - (var(--slot-gap) * 11)) / 5 + var(--slot-gap));
}

.closed-layer.no-wide-loads {
  top: auto;
  bottom: var(--slot-gap);
  height: calc(20% - 6px);
}

.closed-content {
  display: grid;
  gap: 8px;
  padding: 14px;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.55);
}

.closed-label {
  font-size: 28px;
  font-weight: 900;
}

.closed-note {
  font-size: 15px;
  font-weight: 900;
}

.day-view {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, auto);
  gap: 10px;
  color: var(--text);
}

.day-view-head {
  min-height: 46px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: #000000;
  color: #ffffff;
  font-weight: 900;
  text-transform: uppercase;
}

.day-view-title {
  min-width: 0;
  display: grid;
  align-content: center;
}

.day-view-name {
  overflow: hidden;
  font-size: 22px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-view-count {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1;
}

.day-view-summary {
  display: grid;
  justify-items: end;
  gap: 2px;
  white-space: nowrap;
}

.day-card-list {
  display: grid;
  gap: 8px;
}

.app.view-day .day-card-list {
  padding: var(--slot-gap);
  background: var(--page-bg);
}

.app.view-day .day-view {
  border: 3px solid var(--current-day-bg);
}

.day-card-row {
  min-height: 124px;
}

.day-view .card {
  height: 124px;
  border-color: var(--page-bg);
}

.day-view .card-main {
  grid-template-rows: 22px minmax(0, 1fr) 22px;
  padding: 3px 8px 4px;
}

.day-view .tag {
  font-size: 18px;
}

.day-view .job-number {
  font-size: 22px;
  font-weight: 700;
}

.day-view .traffic-badge {
  min-height: 20px;
  font-size: 14px;
  line-height: 19px;
}

.day-view .load-label {
  font-size: 22px;
  font-weight: 700;
}

.day-view .customer {
  font-size: 20px;
  font-weight: 700;
}

.day-view .job-name {
  font-size: 26px;
  font-weight: 400;
}

.day-view .address,
.day-view .note {
  font-size: 15px;
  line-height: 18px;
}

.day-view .card-bottom {
  font-size: 15px;
}

.day-exception-panel {
  min-height: 180px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
  color: #fff;
  text-align: center;
  text-transform: uppercase;
}

.day-exception-panel.no-wide-loads {
  min-height: 140px;
}

.day-exception-panel img {
  display: block;
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.day-exception-label {
  font-size: 34px;
  font-weight: 900;
}

.day-exception-note {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 900;
}

.empty-day-message {
  min-height: 160px;
  display: grid;
  place-items: center;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  font-size: 28px;
  font-weight: 900;
}

.message {
  position: fixed;
  z-index: 20;
  inset: 76px 18px auto;
  display: none;
  padding: 14px 18px;
  border: 1px solid #6a3d3d;
  background: #2b1717;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
}

.message.visible {
  display: block;
}

@media (min-width: 1800px) and (min-height: 3000px) {
  .app {
    grid-template-rows: 78px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .calendar-view {
    gap: 50px;
  }

  .app.view-2 .calendar-view {
    min-height: calc(100vh - 98px);
    grid-template-rows: repeat(3, minmax(980px, 1fr));
  }

  .brand-title {
    font-size: 44px;
  }

  .brand-range,
  .clock {
    font-size: 24px;
  }

  .status-line {
    font-size: 18px;
  }

  .view-button {
    width: 42px;
    height: 42px;
    font-size: 22px;
  }

  .calendar-filter {
    width: 160px;
    height: 42px;
    font-size: 18px;
  }

  .sales-filter {
    width: 100px;
  }

  .week {
    grid-template-rows: 64px minmax(0, 1fr);
  }

  .day-head {
    padding: 0 13px;
  }

  .total-miles,
  .total-time {
    font-size: 17px;
  }

  .day-name {
    font-size: 21px;
  }

  .day-date {
    font-size: 46px;
  }

  .day-count {
    font-size: 17px;
  }

  .card {
    grid-template-columns: 31px minmax(0, 1fr) 31px;
  }

  .tag {
    font-size: 20px;
    font-weight: 700;
  }

  .card-main {
    grid-template-rows: 22px minmax(0, 1fr) 22px;
    padding: 3px 8px 4px;
  }

  .job-number {
    font-size: 24px;
  }

  .load-label {
    font-size: 24px;
  }

  .traffic-badge {
    min-height: 21px;
    font-size: 15px;
    line-height: 20px;
  }

  .card-center {
    grid-template-rows: auto auto auto auto;
  }

  .customer {
    font-size: 20px;
  }

  .job-name {
    font-size: 23px;
  }

  .address {
    font-size: 15px;
    line-height: 19px;
  }

  .note {
    font-size: 16px;
    line-height: 19px;
  }

  .card-bottom {
    font-size: 16px;
  }

  .overflow-card {
    font-size: 26px;
  }

  .day-view-head {
    min-height: 58px;
    padding: 8px 16px;
  }

  .day-view-name {
    font-size: 34px;
  }

  .day-view-count {
    font-size: 18px;
  }

  .day-card-list {
    gap: 12px;
  }

  .day-card-row,
  .day-view .card {
    height: 190px;
    min-height: 190px;
  }

  .day-view .card {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
  }

  .day-view .card-main {
    grid-template-rows: 34px minmax(0, 1fr) 34px;
    padding: 4px 12px 6px;
  }

  .day-view .tag {
    font-size: 26px;
  }

  .day-view .job-number {
    font-size: 35px;
  }

  .day-view .traffic-badge {
    min-height: 30px;
    font-size: 21px;
    line-height: 29px;
  }

  .day-view .load-label {
    font-size: 35px;
  }

  .day-view .customer {
    font-size: 29px;
  }

  .day-view .job-name {
    font-size: 40px;
  }

  .day-view .address,
  .day-view .note {
    font-size: 22px;
    line-height: 27px;
  }

  .day-view .card-bottom {
    font-size: 24px;
  }
}

@media (max-width: 900px) {
  body {
    overflow-y: auto;
  }

  .app,
  .app.view-1,
  .app.view-2,
  .app.view-3,
  .app.view-day {
    width: 100%;
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto minmax(0, auto);
    padding: 6px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 8px;
  }

  .topbar-left,
  .brand-title,
  .status-line {
    justify-self: stretch;
    justify-content: center;
    text-align: center;
  }

  .brand-title {
    font-size: 23px;
  }

  .status-line {
    flex-wrap: wrap;
    gap: 8px;
  }

  .calendar-filters {
    width: 100%;
    justify-content: center;
  }

  .calendar-filter {
    width: min(42vw, 180px);
  }

  .sales-filter {
    width: min(24vw, 110px);
  }

  .calendar-view {
    gap: 14px;
  }

  .week {
    grid-template-rows: auto minmax(0, auto);
  }

  .week-head,
  .week-grid {
    grid-template-columns: 1fr;
  }

  .day-head:not(:last-child)::after,
  .day:not(:last-child)::after {
    display: none;
  }

  .day {
    min-height: 720px;
  }

  .day-card-row,
  .day-view .card {
    height: 148px;
    min-height: 148px;
  }

  .day-view-name {
    font-size: 22px;
  }

  .day-view-head {
    grid-template-columns: 1fr;
    min-height: 44px;
    padding: 6px 10px;
  }

  .day-view-summary {
    justify-items: start;
  }
}
