:root {
  color-scheme: light;
  color: #172831;
  background: #f2f5f4;
  font: 16px/1.5 system-ui, sans-serif;
  --ink: #172831;
  --muted: #506672;
  --line: #d4dfdf;
  --green: #006b5f;
  --pale: #dceee9;
  --blue: #173b48;
  --surface: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--green); font-weight: 650; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid #007e9e; outline-offset: 3px; }
button, input, select { font: inherit; }
button, .button, select, input:not([type="checkbox"]) {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: .45rem;
  color: var(--ink);
  min-height: 2.65rem;
  padding: .4rem .72rem;
}
button, .button { font-weight: 650; cursor: pointer; }
.button { display: inline-flex; align-items: center; text-decoration: none; }
button:hover:not(:disabled), .button:hover { background: #edf5f4; }
button:disabled { opacity: .42; cursor: default; }
button.primary, .primary { color: white; background: var(--green); border-color: var(--green); }
button.primary:hover:not(:disabled) { background: #00564d; }
button[aria-pressed="true"] { background: var(--pale); border-color: #72a69a; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); line-height: 1.1; letter-spacing: -.045em; }
h2 { font-size: 1.16rem; letter-spacing: -.025em; line-height: 1.25; }
h3 { font-size: 1rem; line-height: 1.35; }
p { margin-block: .6rem; }
small, .muted, .legend { color: var(--muted); }
small { display: block; margin-top: .18rem; }
.shell { width: min(100% - 2.5rem, 1320px); margin-inline: auto; }
.top { background: #122e39; color: #deeef0; }
.top-inner { display: flex; gap: 1.7rem; align-items: center; min-height: 65px; }
.brand { display: flex; gap: .5rem; align-items: center; color: #fff; font-size: 1.35rem; text-decoration: none; letter-spacing: -.04em; }
.brand-icon { display: grid; place-content: center; width: 2rem; height: 2rem; border-radius: .5rem; background: #7bc6b2; color: #102e32; }
nav { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
nav a { display: inline-flex; align-items: center; min-height: 2.65rem; padding: .38rem .72rem; text-decoration: none; border-radius: .4rem; }
nav a[aria-current="page"] { background: var(--pale); color: #07463e; }
.top nav a { color: #e5f3f3; }
.top nav a[aria-current="page"] { background: #36535b; color: white; }
.scenario-label { margin-inline-start: auto; font-size: .83rem; }
main.shell { padding-block: 1rem 3rem; }
.clock {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  padding: .85rem 1rem; gap: .55rem 1.25rem; border-radius: .7rem;
  background: #e7efef; border: 1px solid #ccd9db;
}
.eyebrow { display: block; color: #4b6670; font-weight: 750; font-size: .73rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .16rem; }
#sim-clock { font-variant-numeric: tabular-nums; }
.clock-actions, .actions, .clock form { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.next-event { font-size: .83rem; width: 100%; margin: 0; color: #48616a; }
.next-event strong { color: var(--ink); margin-right: .4rem; }
.subnav { display: flex; gap: .5rem; margin-top: .65rem; }
.view-switch { margin-left: auto; }
.page-heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; margin: 1.35rem 0; }
.identity, .count { color: var(--muted); font-weight: 650; font-size: .86rem; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.metrics div { padding: .72rem .95rem; border: 1px solid var(--line); border-radius: .65rem; background: #e8efef; display: grid; align-content: start; gap: .2rem; }
.metrics span { color: var(--muted); font-size: .84rem; }
.metrics strong { font-size: 1.55rem; letter-spacing: -.055em; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: .7rem; padding: 1rem; margin-top: .8rem; min-width: 0; }
.section-title, .card-top { display: flex; justify-content: space-between; align-items: center; gap: .7rem; margin-bottom: .65rem; }
.section-title > h2 { min-width: 0; }
.operations-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: .8rem; }
.columns, .jobs-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; align-items: start; }
.jobs-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
.driver-layout { max-width: 700px; margin-inline: auto; }
.week, .chain { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .4rem; overflow: auto; }
.chain { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: .9rem; }
.week button, .chain button { display: grid; align-content: start; text-align: left; }
.week button span, .chain button span { font-size: .76rem; color: var(--muted); font-weight: 500; }
.table-wrap { max-height: 25rem; overflow: auto; border: 1px solid var(--line); border-radius: .48rem; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .84rem; }
thead th { position: sticky; background: #eaf0f0; z-index: 1; top: 0; }
th, td { text-align: left; padding: .38rem .55rem; border-bottom: 1px solid var(--line); min-width: 5.2rem; vertical-align: top; }
th:first-child { min-width: 3rem; font-variant-numeric: tabular-nums; }
td .slot { display: block; font-size: .76rem; min-height: 2.35rem; margin: .18rem 0; padding: .25rem .4rem; }
.slot.booked, .pill.paired, .slot.planned { background: #dcebf4; border-color: #b2c9db; color: #164967; }
.slot.checkedIn, .pill.good { background: var(--pale); border-color: #a3c7bd; color: #075549; }
.slot.missed, .pill.warning { background: #f9e8d6; border-color: #eac49c; color: #7d3909; }
.slot.released { background: #eaeef0; border-style: dashed; }
.legend { font-size: .78rem; margin-bottom: 0; }
.rows, .route, .stops, .progress { list-style: none; padding: 0; margin: 0; }
.rows > li { padding: .62rem 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.rows > li:last-child { border: 0; }
.rows > li > :first-child { min-width: 0; overflow-wrap: anywhere; }
.rows .actions { justify-content: flex-end; }
.scroll-list { max-height: 20rem; overflow: auto; }
.text-button { color: var(--green); border: 0; padding: 0; text-align: left; text-decoration: underline; text-underline-offset: .18em; }
.pill { display: inline-flex; align-items: center; padding: .13rem .5rem; border-radius: 1rem; background: #edf2f3; color: #354d56; font-size: .75rem; font-weight: 680; white-space: nowrap; }
.empty { color: var(--muted); }
.notice { margin-top: .8rem; padding: .7rem 1rem; border-radius: .5rem; background: var(--pale); color: #07463e; }
.notice.error { background: #fce4dd; color: #7c2522; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 325px), 1fr)); gap: .75rem; }
.offer-card { padding: .9rem; border: 1px solid var(--line); border-radius: .65rem; }
.route { margin-block: .65rem; font-size: .86rem; }
.route li, .progress li, .stops li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .15rem .65rem; border-bottom: 1px solid var(--line); padding: .42rem 0; }
.route time, .progress time, .stops li div span { color: var(--muted); font-size: .8rem; }
.stops li div span { display: block; }
.stops { margin: .5rem 0 .9rem; }
.stops li { align-items: center; }
.next-stop { background: #e7f2ee; border: 1px solid #bdd8ce; border-radius: .6rem; padding: .8rem; margin-block: .8rem; display: grid; gap: .65rem; grid-template-columns: 1fr auto; align-items: center; }
#job-detail h3 { margin-top: .7rem; }
.progress li.current { font-weight: 700; color: var(--green); }
.detail-backdrop { position: fixed; inset: 0; z-index: 2; background: #0f2533a3; display: grid; place-items: center; padding: 1rem; }
.detail { width: min(100%, 640px); max-height: 92dvh; overflow: auto; margin: 0; padding: 1.1rem; box-shadow: 0 20px 70px #102e3966; overflow-wrap: anywhere; }
.detail h2 { padding-right: 2.5rem; }
.detail h3 { margin-top: 1rem; }
.close { float: right; font-size: 1.3rem; margin-left: .4rem; }
.bid-form { display: grid; gap: .75rem; margin-top: 1rem; }
.bid-form label { display: grid; gap: .25rem; }
.bid-form label.checkbox { display: flex; align-items: center; gap: .5rem; }
#space-filters label { display: flex; align-items: center; gap: .35rem; }
.alert-text { color: #8a4215; }
@media (max-width: 860px) {
  .operations-grid, .jobs-layout { grid-template-columns: 1fr; }
  .week, .chain { grid-auto-flow: column; grid-auto-columns: minmax(105px, 1fr); grid-template-columns: none; }
  .scenario-label { display: none; }
}
@media (max-width: 570px) {
  .shell { width: calc(100% - 1rem); }
  .top-inner { gap: .5rem; min-height: 56px; }
  .top nav a { font-size: .85rem; padding-inline: .45rem; }
  .brand { font-size: 1.1rem; }
  .brand-icon { width: 1.5rem; height: 1.5rem; }
  .clock, .panel { padding: .7rem; }
  .clock-actions button, .clock-actions select { font-size: .84rem; padding-inline: .5rem; }
  .columns { grid-template-columns: 1fr; gap: 0; }
  .metrics { gap: .3rem; }
  .metrics div { padding: .45rem .52rem; }
  .metrics span { font-size: .75rem; }
  .next-stop { grid-template-columns: 1fr; }
  .detail-backdrop { place-items: end center; padding: .45rem; }
  .detail { max-height: 90dvh; }
}
#step-form input { width: 6.1rem; }

/* Space and the offline Prince Rupert map */
.connection-notice { display: none; }
[data-offline] .connection-notice { display: block; }
[data-offline] [inert] { opacity: .6; }
[data-cargo-highlighted] { background-color: #e3f1fa !important; box-shadow: inset 0 0 0 2px #367f9e; }
.space-map { margin-top: .8rem; }
.map-viewport {
  height: clamp(22rem, 47vw, 33rem);
  overflow: hidden;
  position: relative;
  border: 1px solid #9bb6bc;
  border-radius: .6rem;
  background: #d4e8ed;
  touch-action: pan-y;
  cursor: grab;
  isolation: isolate;
}
.map-viewport:active { cursor: grabbing; }
.map-viewport canvas, .map-markers { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-markers { pointer-events: none; }
.map-marker {
  position: absolute; display: inline-flex; align-items: center; gap: .3rem;
  transform: translate(-50%, -50%); pointer-events: auto; white-space: nowrap; min-height: 2rem;
  border: 1px solid #2c6370; background: #f9fcfa; font-size: .78rem; z-index: 1;
}
.map-marker[hidden] { display: none; }
.map-marker:hover, .map-marker:focus-visible, .map-marker[data-cargo-highlighted] { z-index: 3; }
.facility-marker { transform: translate(-.6rem, -50%); box-shadow: 0 2px 5px #39595936; padding: .2rem .36rem; }
.facility-marker.warehouse { transform: translate(calc(-100% + .65rem), -50%); }
.facility-marker.selected { border-width: 2px; background: #e7f5ec; }
.map-pin { width: .64rem; height: .64rem; background: #006b5f; border-radius: 50%; }
.map-marker[data-map-unit] { min-width: 2.3rem; min-height: 2.3rem; border: 2px solid #fbfdfa; border-radius: 50%; justify-content: center; padding: 0; color: #fff; box-shadow: 0 1px 6px #10262c6b; }
.truck-marker.import, .truck-marker.import:hover { background: #0c677b; }
.truck-marker.export, .truck-marker.export:hover { background: #99601f; }
.vessel-marker, .vessel-marker:hover { background: #54569c; }
.map-marker[data-cargo-highlighted] { color: #153f52; border-color: #367f9e; }
.map-unit-icon { width: 1rem; height: .74rem; display: block; background: currentColor; }
.truck-marker .map-unit-icon { clip-path: polygon(0 0, 61% 0, 61% 18%, 83% 18%, 100% 50%, 100% 84%, 86% 84%, 81% 100%, 65% 100%, 60% 84%, 36% 84%, 31% 100%, 15% 100%, 10% 84%, 0 84%); }
.vessel-marker .map-unit-icon { clip-path: polygon(0 50%, 24% 50%, 24% 24%, 44% 24%, 44% 0, 62% 0, 62% 50%, 100% 50%, 72% 100%, 18% 100%); }
.map-controls { position: absolute; z-index: 4; display: grid; gap: .3rem; right: .6rem; top: .6rem; }
.map-controls button { height: 2.5rem; min-width: 2.5rem; padding: .24rem .42rem; background: #fefef8; border-color: #789da5; box-shadow: 0 1px 4px #39595936; }
.map-orientation, .map-scale { position: absolute; pointer-events: none; color: #28424a; }
.map-orientation { left: .75rem; top: .6rem; font-weight: 800; }
.map-scale { bottom: .6rem; left: .65rem; background: #f8fbf4dd; font-size: .7rem; text-align: center; padding: .1rem .25rem; }
.map-scale span { display: block; border-bottom: 2px solid #28424a; }
.map-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .65rem; }
.map-meta small { font-size: .74rem; }
.map-legend { display: flex; flex-wrap: wrap; gap: .6rem; margin: .25rem 0; padding: 0; list-style: none; font-size: .78rem; }
.map-legend li { display: flex; align-items: center; gap: .3rem; }
.map-legend i { width: 1rem; border-bottom: .16rem solid #0c677b; }
.map-legend i.export { border-bottom-color: #99601f; }
.map-legend i.vessel { border-bottom-style: dashed; border-bottom-color: #54569c; }
.map-objects { margin-top: .55rem; }
summary { cursor: pointer; font-weight: 650; }
@media (max-width: 570px) {
  .map-viewport { height: 23rem; }
  .map-controls button, .map-marker[data-map-unit] { min-height: 2.65rem; min-width: 2.65rem; }
  .map-marker.facility-marker { font-size: .68rem; }
}

.space-layout { align-items: start; }
.space-date-note { font-size: .84rem; }
.chain .role-stage { border-color: #6a9a93; }
.cargo-details { margin-bottom: .8rem; padding: .7rem; border: 1px solid #bbd3ce; border-radius: .45rem; background: #edf5f3; }
.cargo-facts { margin-block: .25rem .75rem; display: grid; gap: .35rem; }
.cargo-facts div { display: grid; grid-template-columns: minmax(4rem, 1fr) minmax(0, 2fr); gap: .5rem; }
.cargo-facts dt { color: var(--muted); font-weight: 650; }
.cargo-facts dd { margin-inline-start: 0; overflow-wrap: anywhere; }
.selected-cargo-row { background: #edf5f3; }
#space-role-tools > h3 { margin-top: .65rem; }

.slot.held, .slot.reserved { background: #f6ebdb; border-color: #d5bf9d; color: #5c4124; }
.slot small { margin-top: 0; font-size: .67rem; color: inherit; }
.vessel-group { margin-top: .45rem; }
#dock-utilization progress { min-width: 3rem; flex: 1; accent-color: var(--green); }
#dock-utilization h3 { margin-top: .5rem; }
.connection-notice p { margin-top: 0; }

.compact-job-back { display: none; }
#past-jobs { margin-top: .2rem; }
.jobs-layout > .panel > h3 { margin-top: .85rem; }
@media (max-width: 860px) {
  .hidden-on-compact { display: none; }
  .compact-job-back { display: inline-block; margin-bottom: .45rem; }
}

.account-shell { max-width: 33rem; padding-top: 4rem; }
.account-panel { padding: 1.5rem; }
.account-switch { margin-inline-start: auto; display: flex; align-items: center; gap: .6rem; min-width: 0; }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-switch button { flex-shrink: 0; }
@media (max-width: 650px) {
  .top-inner:has(.account-switch) { flex-wrap: wrap; gap: .2rem .55rem; padding-block: .35rem; }
  .account-switch { font-size: .8rem; }
}
