/* Rate Desk — harbour palette, Fira Sans, one bold element: the route line. */
@font-face { font-family: "Fira Sans"; src: url(../fonts/FiraSans-Regular.woff) format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url(../fonts/FiraSans-Medium.woff) format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url(../fonts/FiraSans-SemiBold.woff) format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url(../fonts/FiraSans-Bold.woff) format("woff"); font-weight: 700; font-display: swap; }

:root {
  --ink: #10324A;        /* harbour navy */
  --ink-2: #1B4462;
  --steel: #5B7283;      /* secondary text */
  --steel-2: #8A9DAA;
  --hull: #F7F9FA;       /* page */
  --surface: #FFFFFF;
  --rule: #D9E1E6;
  --rule-2: #EBF0F3;
  --teal: #1F7A8C;       /* actions, destination */
  --teal-wash: #E4F1F3;
  --signal: #E3A21A;     /* yard-signal amber: deadlines, attention */
  --signal-wash: #FCF3DF;
  --up: #B73A2A;         /* rate went up / missed */
  --up-wash: #F8E6E3;
  --down: #2E7A57;       /* rate went down / booked */
  --down-wash: #E3F1EA;

  --f: "Fira Sans", "Segoe UI", system-ui, sans-serif;
  --s-xs: .8rem; --s-sm: .875rem; --s-md: 1rem; --s-lg: 1.25rem; --s-xl: 1.5625rem; --s-2xl: 2.25rem;
  --r: 4px;
  --nav-w: 232px;
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--f); color: var(--ink); background: var(--hull); line-height: 1.45;
  font-feature-settings: "tnum" 1, "lnum" 1; -webkit-font-smoothing: antialiased; }
a { color: var(--teal); }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; }
h1 { font-size: var(--s-xl); }
h2 { font-size: var(--s-lg); }
h3 { font-size: var(--s-md); }
p { margin: 0; }
small, .muted { color: var(--steel); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; background: linear-gradient(90deg, var(--ink) var(--nav-w), var(--hull) 0); }
.nav { background: var(--ink); color: #DCE6EE; display: flex; flex-direction: column; padding: 22px 14px 16px;
  position: sticky; top: 0; height: 100vh; }
.wordmark { font-weight: 700; font-size: 1.35rem; letter-spacing: -.01em; color: inherit; margin: 0 10px; display: flex; align-items: center; gap: 10px; }
.wordmark::before { content: ""; width: 22px; height: 12px; border: 2px solid currentColor; border-radius: 2px;
  background: repeating-linear-gradient(90deg, transparent 0 3px, currentColor 3px 4.5px); opacity: .9; }
.nav .company { margin: 4px 10px 26px 42px; font-size: var(--s-xs); color: #93AABB; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 9px 10px; border-radius: var(--r);
  color: #C9D7E2; text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a[aria-current="page"] { background: #fff; color: var(--ink); }
.nav .count { font-size: var(--s-xs); font-weight: 600; background: var(--signal); color: var(--ink); border-radius: 999px; padding: 1px 8px; }
.nav .spacer { flex: 1; }
.nav .who { padding: 12px 10px 0; border-top: 1px solid #24506F; font-size: var(--s-sm); color: #93AABB; }
.nav .who b { color: #fff; font-weight: 500; display: block; }
.nav .who button { background: none; border: 0; padding: 0; color: #C9D7E2; text-decoration: underline; cursor: pointer; font: inherit; margin-top: 6px; }

main { padding: 28px 36px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--steel); margin-top: 4px; max-width: 70ch; }

/* ---------- controls */
.btn { font: inherit; font-weight: 500; border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: var(--r); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.btn:hover { border-color: var(--steel-2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-2); }
.btn.quiet { border-color: transparent; background: none; color: var(--teal); padding-inline: 6px; }
.btn.danger { color: var(--up); }
.btn:disabled { opacity: .5; cursor: default; }
input, select { font: inherit; color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r); padding: 7px 10px; background: #fff; min-width: 0; }
input:focus, select:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-wash); }
label { font-size: var(--s-sm); color: var(--steel); display: grid; gap: 4px; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--down); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 280px; max-width: 420px; }
.toolbar .check { display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: var(--s-sm); }
.stack { display: grid; gap: 14px; }

/* ---------- tables */
.table-wrap { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); overflow: auto; }
table { border-collapse: collapse; width: 100%; font-size: var(--s-sm); }
th { text-align: left; font-weight: 500; color: var(--steel); background: var(--hull); padding: 9px 11px; border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 1; white-space: nowrap; }
td { padding: 10px 11px; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: #F3F7F9; }
td.num, th.num { text-align: right; white-space: nowrap; }
th.num { white-space: normal; }
td.total { font-weight: 600; }
.stacked > div { line-height: 1.6; white-space: nowrap; }
td.commodity { max-width: 150px; font-size: var(--s-xs); }
td.lane .commodity { font-size: var(--s-xs); color: var(--ink); margin-top: 6px; max-width: 250px; }
th.num { white-space: normal; min-width: 64px; }
.qno { font-weight: 600; color: var(--ink); white-space: nowrap; }
.empty { padding: 48px 24px; text-align: center; color: var(--steel); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ---------- pills */
.pill { display: inline-block; font-size: var(--s-xs); font-weight: 500; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--rule-2); color: var(--steel); }
.pill.open { background: var(--teal-wash); color: var(--teal); }
.pill.urgent { background: var(--signal-wash); color: #8A5D00; }
.pill.missed, .pill.increase { background: var(--up-wash); color: var(--up); }
.pill.booked, .pill.decrease { background: var(--down-wash); color: var(--down); }
.pill.new { background: var(--teal-wash); color: var(--teal); }
.delta { font-size: var(--s-xs); font-weight: 600; white-space: nowrap; }
.delta.up { color: var(--up); } .delta.down { color: var(--down); }
.warn { color: #8A5D00; font-size: var(--s-xs); }
.warn::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); margin-right: 6px; vertical-align: 1px; }

/* ---------- the route line (the signature element) */
.route { display: flex; align-items: flex-start; gap: 0; padding: 6px 0 4px; }
.route .stop { position: relative; display: grid; justify-items: start; gap: 2px; padding-top: 22px; min-width: 0; flex: 0 1 auto; }
.route .stop::before { content: ""; position: absolute; top: 5px; left: 0; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--ink); }
.route .stop.origin::before { background: var(--ink); }
.route .stop.dest::before { background: var(--teal); border-color: var(--teal); }
.route .stop.via::before { width: 8px; height: 8px; top: 7px; border-color: var(--steel-2); }
.route .stop b { font-weight: 600; font-size: var(--s-md); white-space: nowrap; }
.route .stop.via b { font-weight: 400; color: var(--steel); font-size: var(--s-sm); }
.route .stop small { font-size: var(--s-xs); }
.route .leg { flex: 1 1 40px; min-width: 28px; height: 2px; background: var(--ink); margin: 10px 10px 0 -2px; position: relative; }
.route .leg.rail { background: repeating-linear-gradient(90deg, var(--ink) 0 8px, transparent 8px 11px); height: 4px; margin-top: 9px;
  border-block: 1px solid var(--ink); background-clip: padding-box; }
.route .leg.truck { background: repeating-linear-gradient(90deg, var(--ink) 0 3px, transparent 3px 7px); }
.route .leg.sea { background: var(--teal); }
.route-mini { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-weight: 500; }
.route-mini i { display: inline-block; width: 26px; height: 2px; background: var(--steel-2); position: relative; }
.route-mini i::after { content: ""; position: absolute; right: -1px; top: -3px; border: 4px solid transparent; border-left: 6px solid var(--steel-2); border-right: 0; }
.route-mini .mode { font-size: var(--s-xs); color: var(--steel); font-weight: 400; }
.via-line { font-size: var(--s-xs); color: var(--steel); margin-top: 2px; }

/* ---------- overview */
.headline { font-size: var(--s-2xl); font-weight: 500; letter-spacing: -.015em; line-height: 1.15; max-width: 22ch; }
.headline b { font-weight: 700; }
.headline-wrap { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; padding-bottom: 26px; border-bottom: 1px solid var(--rule); }
.headline-wrap p { color: var(--steel); margin-top: 10px; max-width: 60ch; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--rule); margin-bottom: 30px; }
.facts > div { padding: 16px 18px 18px 0; }
.facts > div + div { padding-left: 18px; border-left: 1px solid var(--rule); }
.facts dt { font-size: var(--s-sm); color: var(--steel); }
.facts dd { margin: 2px 0 0; font-size: var(--s-xl); font-weight: 600; }
.facts dd small { font-size: var(--s-sm); font-weight: 400; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 36px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.calendar { list-style: none; margin: 0; padding: 0; }
.calendar > li { display: grid; grid-template-columns: 74px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--rule); }
.calendar .date { line-height: 1.1; }
.calendar .date b { display: block; font-size: var(--s-xl); font-weight: 600; }
.calendar .date span { font-size: var(--s-sm); color: var(--steel); }
.calendar .date.urgent b { color: #A06C00; }
.calendar .date.missed b { color: var(--up); }
.calendar ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: var(--s-sm); }
.calendar ul a { color: var(--ink); text-decoration: none; }
.calendar ul a:hover { text-decoration: underline; }
.notice { padding: 10px 14px; border-radius: var(--r); background: var(--signal-wash); color: #6B4A00; font-size: var(--s-sm); margin-bottom: 18px;
  display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.notice.ok { background: var(--down-wash); color: var(--down); }
.notice.bad { background: var(--up-wash); color: var(--up); }

/* ---------- import */
.drop { border: 2px dashed var(--steel-2); border-radius: 6px; background: var(--surface); padding: 40px 24px; text-align: center;
  display: grid; gap: 8px; justify-items: center; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--teal); background: var(--teal-wash); }
.drop h2 { font-weight: 500; }
.drop .doc { width: 42px; height: 52px; border: 2px solid var(--ink); border-radius: 3px; position: relative; margin-bottom: 6px;
  background: linear-gradient(var(--ink), var(--ink)) 8px 16px / 22px 2px no-repeat, linear-gradient(var(--ink), var(--ink)) 8px 23px / 22px 2px no-repeat,
              linear-gradient(var(--ink), var(--ink)) 8px 30px / 14px 2px no-repeat; }
.progress { height: 6px; background: var(--rule-2); border-radius: 999px; overflow: hidden; margin-top: 14px; }
.progress span { display: block; height: 100%; background: var(--teal); width: 0; transition: width .2s; }
.import-bar { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; justify-content: space-between; margin: 22px 0 14px; }
.import-bar .summary { font-size: var(--s-md); }
.import-bar .summary b { font-weight: 600; }

/* ---------- drawer */
.drawer-back { position: fixed; inset: 0; background: rgba(16, 50, 74, .28); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(860px, 96vw); background: var(--surface); z-index: 21;
  overflow: auto; box-shadow: -12px 0 40px rgba(16, 50, 74, .18); padding: 26px 30px 40px; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: .6; } }
.drawer header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.drawer .meta { display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--steel); font-size: var(--s-sm); margin: 6px 0 18px; }
.drawer .meta b { color: var(--ink); font-weight: 500; }
.drawer .route { margin: 6px 0 26px; padding: 18px 18px 14px; background: var(--hull); border-radius: var(--r); }
.drawer section { margin-top: 26px; }
.drawer section > h3 { margin-bottom: 8px; }
.drawer table td, .drawer table th { padding: 7px 10px; }
.drawer tr.bucket td { background: var(--hull); color: var(--steel); font-size: var(--s-xs); font-weight: 500; padding-block: 5px; }
.drawer tr.sum td { border-top: 2px solid var(--ink); font-weight: 600; }
.drawer tr.cond td { color: var(--steel); font-style: italic; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: var(--s-sm); }
.kv dt { color: var(--steel); }
.kv dd { margin: 0; }
.booking-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--r); }

/* ---------- incoterm & currency amounts */
.inco-pick { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; font-size: var(--s-sm); }
.inco-pick select { font-weight: 600; border-color: var(--ink); }
.amt { white-space: nowrap; line-height: 1.55; }
.amt .cur { font-size: var(--s-xs); color: var(--steel); font-weight: 400; margin-right: 2px; }
.amt.total { font-weight: 600; }
table.rates tbody.clickable { cursor: pointer; }
table.rates tbody.clickable:hover td { background: #F3F7F9; }
table.rates tbody.clickable td { border-bottom: 0; padding-top: 6px; padding-bottom: 6px; }
table.rates tbody.clickable tr:first-child td { padding-top: 11px; }
table.rates tbody.clickable tr:last-child td { padding-bottom: 11px; border-bottom: 1px solid var(--rule); }
table.rates td[rowspan] { border-bottom: 1px solid var(--rule); }
.ctr-cell { white-space: nowrap; }
th.out, td.out { color: var(--steel-2); }
td.out .amt .cur { color: var(--steel-2); }
th.rate-col, td.rate-col { background: var(--teal-wash); color: var(--ink); }
table.rates tbody.clickable:hover td.rate-col { background: #D6EAEE; }
th.rate-col { color: var(--teal); font-weight: 600; }
.stacked .ctr { min-height: 1.55em; }
.drawer tr.out td { color: var(--steel-2); }
.tag-in, .tag-out { font-weight: 400; margin-left: 6px; }
.tag-in { color: var(--teal); }
.inco-table tr.on td { background: var(--teal-wash); font-weight: 500; }
.scope-table { width: 100%; }
.scope-table .c { text-align: center; }
.scope-table .yes { color: var(--teal); }
.scope-table .no { color: var(--steel-2); }
.scope-table tr.on td { background: var(--teal-wash); }
.section-head .inco-pick { font-weight: 400; }

tr.skip td { color: var(--steel-2); background: #FAFBFC; }
tr.skip .qno, tr.skip .amt.total { color: var(--steel); }
td.kind { min-width: 190px; }
.add-anyway { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--ink); font-size: var(--s-xs); }

.check.radio { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: var(--s-sm); flex-wrap: wrap; }

/* ---------- settings */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); padding: 18px 20px; }
.panel h2 { margin-bottom: 4px; }
.panel > p { color: var(--steel); font-size: var(--s-sm); margin-bottom: 14px; }
.fx-table input { width: 120px; text-align: right; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

/* ---------- toast */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px;
  border-radius: var(--r); font-size: var(--s-sm); z-index: 40; box-shadow: 0 6px 24px rgba(16,50,74,.25); }
.toast.bad { background: var(--up); }

/* ---------- auth */
body.auth { display: grid; place-items: center; min-height: 100vh; background: var(--ink); }
.auth-panel { background: var(--surface); width: min(400px, 92vw); padding: 34px 32px; border-radius: 6px; }
.auth-panel .wordmark { color: var(--ink); margin: 0 0 6px; }
.auth-lede { color: var(--steel); margin-bottom: 20px; font-size: var(--s-sm); }
.auth-panel .btn { width: 100%; justify-content: center; padding: 10px; }
.auth-panel .notice { display: block; }

/* ---------- responsive */
@media (max-width: 1100px) {
  .two-col, .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; background: var(--hull); }
  .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; padding: 12px; }
  .nav .company, .nav .spacer { display: none; }
  .nav .who { border: 0; padding: 0 0 0 8px; margin-left: auto; }
  .nav .who b { display: none; }
  .wordmark { width: 100%; margin-bottom: 6px; }
  main { padding: 20px 16px 50px; }
  .headline { font-size: var(--s-xl); }
  .headline-wrap { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .facts > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .drawer { padding: 20px 16px; }
  .route { flex-wrap: wrap; row-gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
