/* Eurorails - interface styling.
   The map is the board; the panel is the traffic office: gunmetal, ruled,
   with company colours as the only bright things on it. */

:root {
  --ink: #14202a;
  --office: #1d2a33;
  --office-2: #24333d;
  --rule: #3a4c58;
  --parch: #e9e2cd;
  --parch-2: #d8cdb0;
  --sea: #96bacd;
  --paper: #f2ecdb;
  --text: #dfe6ea;
  --dim: #9fb0bb;
  --brass: #d8b062;
  --good: #6fbf73;
  --bad: #e2705f;
  --panel-w: 348px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: var(--ink); color: var(--text);
  font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; -webkit-text-size-adjust: 100%;
}

#app { display: flex; height: 100%; width: 100%; }

/* ---------------------------------------------------------------- map */
#board { position: relative; flex: 1 1 auto; min-width: 0; background: #7ea6bb; }
#map { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

#hint {
  position: absolute; left: 12px; bottom: 12px; max-width: 44ch;
  background: rgba(20, 32, 42, .88); border: 1px solid var(--rule);
  border-radius: 3px; padding: 7px 11px; color: var(--text);
  font-size: 12.5px; line-height: 1.45; pointer-events: none;
}
#hint b { color: var(--brass); font-weight: 600; }

#zoom {
  position: absolute; right: 12px; bottom: 12px; display: flex; gap: 6px;
}
#zoom button {
  width: 34px; height: 34px; font-size: 17px; line-height: 1;
  background: rgba(20, 32, 42, .9); color: var(--text);
  border: 1px solid var(--rule); border-radius: 3px; cursor: pointer;
}
#zoom button:hover { background: var(--office-2); }

#banner {
  position: absolute; top: 0; left: 0; right: 0; text-align: center;
  padding: 7px 12px; font-family: Georgia, "Iowan Old Style", serif;
  letter-spacing: .12em; text-transform: uppercase; font-size: 12.5px;
  background: linear-gradient(180deg, rgba(20, 32, 42, .93), rgba(20, 32, 42, 0));
  color: var(--parch); pointer-events: none;
}
#banner .turnno { color: var(--brass); }

/* ---------------------------------------------------------------- panel */
#panel {
  width: var(--panel-w); flex: 0 0 var(--panel-w); height: 100%;
  background: var(--office); border-left: 1px solid #0d151b;
  display: flex; flex-direction: column; overflow: hidden;
}

.brandbar {
  padding: 10px 14px 8px; border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, #26343e, #1d2a33);
}
.brandbar h1 {
  margin: 0; font-family: Georgia, "Iowan Old Style", serif; font-weight: 600;
  font-size: 21px; letter-spacing: .22em; text-transform: uppercase; color: var(--parch);
}
.brandbar .sub {
  margin-top: 3px; font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--dim);
}
/* the milepost lattice, echoed as a rule */
.dots {
  height: 7px; margin-top: 7px;
  background-image: radial-gradient(currentColor 1px, transparent 1.2px);
  background-size: 9px 7px; color: #465d6b; opacity: .9;
}

#panelScroll { flex: 1 1 auto; overflow-y: auto; padding: 0 0 10px; }

section.blk { border-bottom: 1px solid var(--rule); padding: 11px 14px; }
section.blk > h2 {
  margin: 0 0 8px; font-size: 10.5px; letter-spacing: .19em; text-transform: uppercase;
  color: var(--dim); font-weight: 700;
}

/* company strip */
.co { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.co .swatch { width: 12px; height: 12px; border-radius: 2px; flex: 0 0 auto; box-shadow: 0 0 0 1px #0c1319; }
.co .nm { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co .money { font-variant-numeric: tabular-nums; color: var(--parch); }
.co .gc { font-variant-numeric: tabular-nums; color: var(--dim); width: 32px; text-align: right; }
.co.active { background: #2b3d48; margin: 0 -14px; padding-left: 14px; padding-right: 14px; }
.co.active .nm { color: #fff; font-weight: 600; }

/* status readout */
.readout { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 10px; }
.readout div { background: var(--office-2); border: 1px solid var(--rule); border-radius: 3px; padding: 6px 8px; }
.readout .k { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.readout .v { font-size: 16px; font-variant-numeric: tabular-nums; color: var(--parch); }
.readout .v small { font-size: 11px; color: var(--dim); }

/* waybills - the signature element */
.bill {
  position: relative; background: var(--paper); color: #23303a;
  border-radius: 2px; margin-bottom: 9px; padding: 7px 9px 7px 20px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .35);
  font-family: Georgia, "Iowan Old Style", serif;
}
.bill::before {
  content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 3px;
  background-image: radial-gradient(#a99f86 1.4px, transparent 1.6px);
  background-size: 3px 7px;
}
.bill .hdr {
  font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  color: #6b7a85; border-bottom: 1px solid #cfc5aa; padding-bottom: 3px; margin-bottom: 4px;
}
.bill .row {
  display: flex; align-items: baseline; gap: 6px; padding: 3px 0; font-size: 13px;
  border-radius: 2px;
}
.bill .row .to { flex: 1 1 auto; }
.bill .row .to em { font-style: normal; color: #6b7a85; }
.bill .row .pay { font-variant-numeric: tabular-nums; font-weight: 600; }
.bill .row.can { background: #dcecd8; cursor: pointer; margin: 0 -4px; padding-left: 4px; padding-right: 4px; }
.bill .row.can:hover { background: #c9e4c3; }
.bill .row.hot .to { color: #1d5c2a; font-weight: 600; }

/* actions */
.acts { display: flex; flex-wrap: wrap; gap: 7px; }
button.act {
  flex: 1 1 auto; min-width: 96px; padding: 9px 10px; cursor: pointer;
  background: var(--office-2); color: var(--text);
  border: 1px solid var(--rule); border-radius: 3px;
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600;
}
button.act:hover:not(:disabled) { background: #31444f; border-color: #587284; }
button.act:disabled { opacity: .4; cursor: default; }
button.act.primary { background: var(--brass); border-color: #b9924a; color: #26200f; }
button.act.primary:hover:not(:disabled) { background: #e6c078; }
button.act:focus-visible { outline: 2px solid #8fd0ff; outline-offset: 2px; }

.loadrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  padding: 4px 8px; border-radius: 11px; font-size: 11.5px; cursor: pointer;
  background: #33454f; border: 1px solid var(--rule); color: var(--text);
}
.chip:hover { background: #3d525e; }
.chip.full { opacity: .45; cursor: default; }
.chip.load { background: #45372a; border-color: #6b5537; color: #f0dcbb; }

/* log */
#log { max-height: 190px; overflow-y: auto; font-size: 12px; line-height: 1.5; }
#log div { padding: 3px 0; border-bottom: 1px dotted #33454f; color: var(--dim); }
#log div.me { color: var(--text); }
#log div.ev { color: #f0c987; }

/* ---------------------------------------------------------------- overlays */
.veil {
  position: fixed; inset: 0; background: rgba(10, 16, 21, .72);
  display: flex; align-items: center; justify-content: center; z-index: 40; padding: 16px;
}
/* an author display rule outranks the browser's [hidden] rule, so state it here */
.veil[hidden] { display: none; }
.sheet {
  width: min(560px, 100%); max-height: 92vh; overflow-y: auto;
  background: var(--office); border: 1px solid var(--rule); border-radius: 4px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6);
}
.sheet header {
  padding: 16px 20px 12px; border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, #26343e, #1d2a33);
}
.sheet header h2 {
  margin: 0; font-family: Georgia, "Iowan Old Style", serif; font-size: 26px;
  letter-spacing: .2em; text-transform: uppercase; color: var(--parch); font-weight: 600;
}
.sheet header p { margin: 6px 0 0; color: var(--dim); font-size: 12.5px; line-height: 1.5; }
.sheet .body { padding: 16px 20px 20px; }
.sheet .body h3 {
  margin: 16px 0 8px; font-size: 10.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--dim);
}
.seat { display: flex; align-items: center; gap: 9px; padding: 5px 0; }
.seat .swatch { width: 14px; height: 14px; border-radius: 2px; }
.seat input[type=text] {
  flex: 1 1 auto; min-width: 0; background: #16222b; border: 1px solid var(--rule);
  color: var(--text); border-radius: 3px; padding: 6px 8px; font-size: 13px;
}
.seat select, #seedbox input {
  background: #16222b; border: 1px solid var(--rule); color: var(--text);
  border-radius: 3px; padding: 6px 8px; font-size: 13px;
}
#seedbox { display: flex; gap: 9px; align-items: center; }
#seedbox input { width: 130px; font-variant-numeric: tabular-nums; }
.sheet .foot { display: flex; gap: 9px; margin-top: 18px; }
.rules { font-size: 12.5px; line-height: 1.6; color: var(--dim); }
.rules b { color: var(--parch); font-weight: 600; }
.rules ul { margin: 6px 0 0; padding-left: 18px; }
.rules li { margin: 3px 0; }

.win { text-align: center; }
.win .co-name { font-size: 20px; color: var(--brass); font-family: Georgia, serif; letter-spacing: .1em; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 860px) {
  #app { flex-direction: column; }
  #panel {
    width: 100%; flex: 0 0 auto; max-height: 46%;
    border-left: none; border-top: 1px solid #0d151b; order: 2;
  }
  #board { order: 1; flex: 1 1 auto; }
  .brandbar h1 { font-size: 17px; }
  #log { max-height: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Eurorails 1.1 - dispatch tools and cover launch screen. */
:root { --panel-w: 382px; }
.brandbar h1 { letter-spacing: .12em; }
.brandbar h1 small, .sheet h2 small { font: 11px system-ui, sans-serif; letter-spacing: 0; color: var(--dim); white-space: nowrap; }
.readout > div { padding: 8px; }
.readout .k, .readout .v { border: 0; padding: 0; }
#location { margin-top: 10px; color: var(--parch); font-size: 12px; }
#saveStatus { color: var(--dim); font-size: 10px; margin-top: 8px; }
#cityTools { position: absolute; top: 38px; left: 12px; width: min(385px, calc(100% - 24px)); background: rgba(20,32,42,.94); border: 1px solid var(--rule); border-radius: 4px; padding: 9px; }
#cityTools label { display: block; color: var(--dim); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 5px; }
.searchrow { display: flex; gap: 5px; }
.searchrow input { min-width: 0; width: 100%; border: 1px solid var(--rule); background: #101d26; color: var(--text); border-radius: 3px; padding: 7px; font: inherit; }
.searchrow button, .route-stops button { border: 1px solid var(--rule); border-radius: 3px; color: var(--text); background: #2b3f4d; padding: 6px 9px; cursor: pointer; }
#cityInfo { color: var(--parch); font-size: 11px; line-height: 1.5; margin-top: 4px; }
#cityInfo:empty { display: none; }
.muted { color: var(--dim); font-size: 12px; line-height: 1.55; margin: 5px 0 9px; }
.ready { color: #a6ddb3; font-size: 12px; }
.route-title { font: 18px Georgia, serif; color: var(--parch); display: flex; justify-content: space-between; margin-bottom: 10px; }
.route-title strong { color: var(--brass); }
.route-stops { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.route-stops button { font-size: 12px; }
.wide { width: 100%; }
.text-button { background: none; color: var(--dim); border: 0; text-decoration: underline; cursor: pointer; padding: 7px 0; font-size: 11px; }
#objectives { display: flex; flex-wrap: wrap; gap: 5px; }
.city-tag { border: 1px solid var(--rule); border-radius: 3px; padding: 5px 7px; background: #16232b; color: var(--dim); cursor: pointer; font-size: 11px; }
.city-tag.connected { border-color: #45754d; background: #233e2e; color: #b8e4ba; }
.event-note { border-left: 2px solid var(--brass); padding: 6px 8px; margin-top: 8px; background: #35403e; font-size: 11px; line-height: 1.5; }
.plan-btn, .deliver-btn { background: #ded4bb; border: 1px solid #bcb094; padding: 4px 5px; border-radius: 3px; color: #243541; cursor: pointer; font-size: 10px; }
.deliver-btn { background: #c6e3bf; }
.bill .row { align-items: center; }
.bill .row.can { cursor: default; }
.sheet .foot { flex-wrap: wrap; }
.sheet.is-setup { width: min(1020px, 100%); display: grid; grid-template-columns: 41% 59%; }
.cover-pane { background: #102e3c; display: flex; align-items: center; }
.cover-pane img { width: 100%; height: auto; display: block; }
.setup-pane { min-width: 0; }
.setup-pane header h2 { font-size: 22px; letter-spacing: .08em; }
.setup-pane .body h3:first-child { margin-top: 0; }
#saveFile { max-width: 100%; color: var(--text); }
#importStatus { color: var(--parch); font-size: 13px; margin-top: 14px; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #8fd0ff; outline-offset: 2px; }
@media (max-width: 660px) {
  .sheet.is-setup { display: block; }
  .cover-pane { justify-content: center; padding: 12px; }
  .cover-pane img { width: auto; height: 240px; }
  .veil { padding: 8px; }
  .sheet { max-height: 96dvh; }
  #hint { bottom: 53px; max-width: calc(100% - 24px); }
  .sheet .body { padding: 12px; }
}

/* v1.2 dispatch workflow */
#panelScroll { min-height: 0; }
#turnDock { flex: 0 0 auto; padding: 10px 12px; border-top: 1px solid var(--rule); background: #15242f; box-shadow: 0 -4px 12px #101b2440; }
#turnDock .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#turnDock .act { min-width: 0; padding: 8px 6px; font-size: 10px; }
#turnDock .act.primary { grid-column: 1 / -1; font-size: 11px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-heading h2 { font-size: 10.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--dim); margin: 0; }
.advisor-button { background: #264555; color: #d4ecf6; border: 1px solid #4b7080; border-radius: 3px; padding: 6px 8px; cursor: pointer; font-size: 11px; }
.pinned-label { color: #9aaeb9; font-size: 10px; margin: -5px 0 9px; }
.chip.useful { border-color: #679f74; color: #b8ecc2; }
.advice-card { padding: 13px; border: 1px solid #46606c; background: #253944; border-radius: 4px; margin-bottom: 12px; }
.advice-card .advice-rank { color: var(--brass); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.sheet .advice-card h3 { color: var(--parch); letter-spacing: 0; text-transform: none; font: 19px Georgia, serif; margin: 7px 0; }
.advice-card p { font-size: 12px; line-height: 1.45; }
.advice-numbers { display: flex; gap: 24px; margin: 10px 0; color: var(--dim); font-size: 12px; }
.advice-numbers b { color: var(--parch); font-size: 18px; margin-left: 4px; }
.setup-option { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--dim); margin-top: 15px; }
.private-turn { background: #10212c; }
.handoff-body { text-align: center; }
.sheet .handoff-body h3 { font: 27px Georgia, serif; text-transform: none; color: var(--brass); letter-spacing: 0; margin: 16px 0; }
@media (max-width: 860px) {
  #panel { height: 49%; max-height: 49%; }
  #turnDock { padding: 6px; }
  #turnDock .acts { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  #turnDock .act.primary { grid-column: auto; }
  #turnDock .act { padding: 7px 4px; font-size: 9px; }
  #turnDock .act.primary { font-size: 9px; }
}

/* v1.3 company office and network plans */
.accounts-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 8px 0 13px; }
.accounts-table td, .accounts-table th { padding: 7px 5px; border-bottom: 1px solid var(--rule); text-align: right; }
.accounts-table td:first-child, .accounts-table th:first-child { text-align: left; }
.accounts-table th { color: var(--parch); font-weight: 600; }
.accounts-table tr:nth-child(even) { background: #243842; }
.account-total { color: var(--brass); background: #30454f; }
.network-row { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--rule); padding: 9px 0; font-size: 13px; }
.network-row > span { flex: 1; }
.network-row b { color: var(--brass); font-size: 12px; }
.network-row .act { flex: 0 0 62px; min-width: 0; padding: 6px; }
.network-estimate { background: #263e49; padding: 12px; border: 1px solid #476778; border-radius: 4px; font-size: 13px; line-height: 1.8; margin: 14px 0; }
.co .money small { color: #e1b888; font-size: 10px; }
@media (max-width: 480px) { .accounts-table { font-size: 11px; } .accounts-table td, .accounts-table th { padding: 6px 3px; } }

/* v1.4 freight queue and cargo desk */
.queue-list { list-style: none; margin: 0; padding: 0; }
.queue-job { display: flex; gap: 10px; padding: 10px 8px; border: 1px solid var(--rule); border-radius: 4px; margin: 7px 0; background: #20343e; }
.queue-job.current { border-color: #b6954d; background: #2b403f; }
.queue-number { flex: 0 0 22px; height: 22px; display: grid; place-items: center; background: #142732; color: #edd6a2; border-radius: 50%; font-weight: 700; }
.queue-copy { min-width: 0; flex: 1; font-size: 12px; }
.queue-copy small { display: block; font-size: 10px; color: #b3c2c9; margin: 4px 0 7px; }
.queue-city { display: block; padding: 2px 0; border: 0; background: none; color: #cae4ec; text-decoration: underline; cursor: pointer; text-align: left; }
.queue-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.queue-actions > button:not(.act) { border: 1px solid #59707b; border-radius: 3px; background: #2a424e; color: #edf0e8; padding: 5px 10px; cursor: pointer; }
.queue-actions > button:disabled { opacity: .4; cursor: default; }
.queue-state { color: #dcc78f; font-size: 11px; line-height: 1.5; }
.pickup-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.pickup-row > div { min-width: 0; }
.pickup-row > .act { flex: 0 0 auto; }
.pickup-row .muted { margin: 4px 0 0; }
#planner > .act { margin: 4px 0; }
