/* Senditt freight page. Our own styles; measured layout values are in the
   blueprint (section 10). Status colours are set from the page data, which
   carries Senditt's own milestone colours. */
@font-face {
  font-family: "Manrope";
  src: url("/static/fonts/manrope-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
:root {
  --ink: rgba(0, 0, 0, 0.87);
  --muted: rgba(0, 0, 0, 0.56);
  --orange: #e64324;
  --page: #f1f2f4;
  --panel: #ffffff;
  --head: #f9f9f9;
  --line: #cbcbcb;
  --soft: #e6e6e6;
  --bar: #2f6fd0;
  --delay-bg: #facc15;
  --delay-text: #713f12;
  --delay-border: #ca8a04;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Manrope", Arial, Helvetica, sans-serif; font-size: 13px; font-weight: 400; color: var(--ink); background: var(--page); }
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 18px; font-weight: 600; margin: 0 0 10px; }
h2 { font-size: 14px; font-weight: 600; margin: 0; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* top bar */
.topbar { background: #000; color: #fff; height: 38px; display: flex; align-items: center; padding: 0 12px; gap: 18px; position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 24px; height: 24px; border-radius: 50%; }
.menu { display: flex; align-items: stretch; height: 38px; }
.menu > a, .menu > .dd > button { color: #fff; background: none; border: 0; font: inherit; padding: 0 12px; height: 38px; display: flex; align-items: center; cursor: pointer; white-space: nowrap; flex: none; }
.menu > a.on, .menu > .dd.on > button { box-shadow: inset 0 -3px 0 var(--orange); }
.menu > a:hover, .menu > .dd > button:hover { background: #222; text-decoration: none; }
.dd { position: relative; }
.dd .caret { margin-left: 6px; border: 4px solid transparent; border-top-color: currentColor; transform: translateY(2px); }
.ddmenu { position: absolute; top: 100%; left: 0; min-width: 190px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.18); padding: 4px 0; z-index: 40; }
.ddmenu a, .ddmenu button { display: block; width: 100%; text-align: left; padding: 7px 14px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ddmenu a:hover, .ddmenu button:hover { background: #f1f1f1; text-decoration: none; }
.ddmenu.right { left: auto; right: 0; }
.topright { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topsearch { height: 26px; border: 1px solid #444; background: #111; color: #fff; border-radius: 4px; padding: 0 8px; font: inherit; width: 190px; }
.iconbtn { background: none; border: 0; color: #fff; cursor: pointer; position: relative; padding: 4px; }
.bell { display: inline-block; width: 12px; height: 12px; border: 2px solid #fff; border-radius: 7px 7px 2px 2px; }
#bellcount { position: absolute; top: -3px; right: -6px; background: var(--orange); border-radius: 8px; font-size: 9px; padding: 0 4px; font-weight: 600; }
#bellcount:empty { display: none; }
.account, .signout { color: #cfcfcf; font-size: 12px; white-space: nowrap; }
.account { display: inline-flex; align-items: center; gap: 8px; }
.signout { color: #fff; }

/* breadcrumb and tabs */
.crumbrow { display: flex; align-items: flex-end; justify-content: space-between; padding: 10px 16px 0; gap: 12px; flex-wrap: wrap; }
.crumbs { font-size: 12px; color: var(--muted); padding-bottom: 8px; }
.crumbs a { color: var(--orange); }
.crumbs .sep { margin: 0 6px; }
.tabs { display: flex; gap: 2px; }
.tabs button { font: inherit; border: 1px solid var(--line); border-bottom: 0; background: #e9e9e9; padding: 6px 14px; border-radius: 4px 4px 0 0; cursor: pointer; color: var(--ink); }
.tabs button.on { background: #fff; font-weight: 600; }

.page { padding: 0 16px 40px; }
.panel { background: var(--panel); border: 1px solid var(--soft); border-radius: 4px; padding: 14px; margin-bottom: 14px; }
.panelhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.panelhead > * { min-width: 0; }
.panelhead .links { display: flex; gap: 8px 14px; align-items: center; flex-wrap: wrap; }
.headfield { width: 210px; max-width: 100%; }
.headfield select { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--orange); cursor: pointer; white-space: nowrap; }
.linkbtn:hover { text-decoration: underline; }
.sub { color: var(--muted); font-size: 12px; margin: 2px 0 0; }

/* buttons, fields */
.btn { background: #000; color: #fff; border: 1px solid #000; border-radius: 4px; height: 34px; padding: 0 14px; font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; }
.btn.secondary { background: #fff; color: var(--ink); border-color: #b9b9b9; }
.btn.small { height: 24px; padding: 0 9px; font-size: 11px; }
.btn.go { background: #1c9a4c; border-color: #1c9a4c; }
.btn[disabled] { opacity: .5; cursor: default; }
select, input[type=text], input[type=search], input[type=date], input[type=email], input[type=password], textarea { font: inherit; color: var(--ink); border: 1px solid #b9b9b9; border-radius: 4px; background: #fff; height: 34px; padding: 0 8px; }
textarea { height: auto; padding: 8px; width: 100%; resize: vertical; }
input[type=file] { max-width: 100%; font: inherit; }
.sendrow { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 8px; }
.sendrow > .muted { flex: 1 1 200px; min-width: 0; }
label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 3px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px; align-items: end; }
.filters .wide { grid-column: span 2; }
.filters select, .filters input { width: 100%; }
.toolbar { display: flex; gap: 10px; align-items: center; margin: 12px 0 8px; flex-wrap: wrap; }
.toolbar .search { flex: 1 1 220px; min-width: 0; }
.toolbar > .muted { white-space: nowrap; font-variant-numeric: tabular-nums; }
.toolbar .search input { width: 100%; }
.daterow { display: flex; gap: 6px; align-items: center; }
.daterow input { flex: 1; min-width: 0; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(8, minmax(96px, 1fr)); gap: 8px; }
.tile { border: 1px solid transparent; border-radius: 4px; padding: 9px 10px; text-align: left; cursor: pointer; font: inherit; color: #fff; display: flex; flex-direction: column; gap: 2px; outline-offset: 2px; }
.tile b { font-size: 22px; font-weight: 700; line-height: 1.1; }
.tile span { font-size: 11px; }
.tile.on { outline: 3px solid #000; }
.tile.dim { opacity: .45; }
.statline { display: flex; gap: 6px 22px; flex-wrap: wrap; align-items: baseline; margin-top: 12px; font-size: 12px; }
.statline b { font-size: 16px; font-weight: 700; margin-right: 5px; }

/* charts and notifications */
.three { display: grid; grid-template-columns: 1fr 1fr 320px; gap: 14px; }
.three .panel { margin-bottom: 0; }
.chart { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.barrow { display: grid; grid-template-columns: minmax(0, 170px) 1fr 34px; gap: 8px; align-items: center; font-size: 11px; }
.barrow.pct { grid-template-columns: minmax(0, 170px) 1fr 44px; }
.barrow > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barrow .track { background: #eef1f6; height: 16px; border-radius: 2px; }
.barrow .fill { background: var(--bar); height: 16px; border-radius: 2px; min-width: 2px; }
.legend { margin-top: 10px; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--bar); display: inline-block; }
.notes { list-style: none; margin: 0; padding: 0; max-height: 236px; overflow: auto; }
.notes li { padding: 7px 0; border-bottom: 1px solid var(--soft); font-size: 12px; display: flex; gap: 8px; }
.notes li:last-child { border-bottom: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex: none; background: var(--bar); }
.dot.help { background: #b91c1c; }
.dot.delivered { background: #166534; }
.dot.approval { background: var(--orange); }

/* carrier chip */
.carrier { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; max-width: 100%; min-width: 0; vertical-align: middle; }
.carrier .cname { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.carrier .stack { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.chip { width: 46px; height: 20px; background: #fff; border: 1px solid var(--soft); border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; flex: none; overflow: hidden; }
.chip img { width: 42px; height: 16px; object-fit: contain; }
.chip.initials { background: #eceff3; color: #3d4652; font-size: 10px; font-weight: 700; letter-spacing: .04em; }

/* grid */
.gridwrap { overflow-x: auto; border: 1px solid var(--soft); border-radius: 4px; }
table.grid { border-collapse: collapse; width: 100%; font-size: 11px; }
.grid th { background: var(--head); font-size: 12px; font-weight: 400; text-align: left; height: 29px; padding: 0 8px; border-bottom: 1px solid var(--line); white-space: nowrap; position: relative; }
.grid td { height: 29px; padding: 0 8px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
.grid td.wrap { white-space: normal; min-width: 150px; max-width: 230px; line-height: 1.35; padding: 5px 8px; }
.grid th.num, .grid td.num { text-align: right; }
/* The two references (lane dev-freight-portal-references): short codes, cut with an ellipsis, full text on hover. */
.grid td.refcell { max-width: 84px; }
.grid.withrefs th.grow { min-width: 110px; }
.grid th.refcell { max-width: 84px; }
.grid th.refcell .th { max-width: 100%; }
.grid th.refcell .thlabel { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Grow columns (long free text) share whatever width the fixed columns leave:
   their text never widens the table, it shortens with an ellipsis instead. */
.grid th.grow { width: 50%; min-width: 150px; }
.grid td.grow { max-width: none; }
.grid td.grow .clip { width: 0; min-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover { background: #fafafa; }
.th { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; background: none; border: 0; font: inherit; color: inherit; padding: 0; }
.th .caret { border: 4px solid transparent; border-top-color: #777; transform: translateY(2px); }
.th .dir { font-size: 9px; color: var(--orange); }
.id2 { color: var(--muted); display: block; font-size: 10px; line-height: 1.1; }
td.idcell { line-height: 1.2; }
.status { display: block; width: 100%; min-width: 118px; height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 22px; border-radius: 4px; font-size: 11px; text-align: center; border: 0; cursor: pointer; font-family: inherit; padding: 0 8px; }
/* One status block size in every grid, whatever the column is given. */
.grid .status { width: 140px; min-width: 140px; }
/* Bell notifications wrap rather than clip, so no text is lost at phone width. */
.ddmenu.notes { width: 360px; }
.ddmenu.notes button { white-space: normal; overflow: visible; line-height: 1.35; }
/* A date beside a chip or a note: the date sits in a fixed-width slot with
   tabular figures, so the thing beside it starts at the same x on every row.
   6.5em holds the widest date of any year (tests/test_freightwatch_portal_layout.py). */
.dated { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dslot { display: inline-block; min-width: 6.5em; font-variant-numeric: tabular-nums; }
/* Every date column uses the same figures as the slot; a date cell is never cut short. */
.grid td.date { font-variant-numeric: tabular-nums; max-width: none; }
.latechip { display: inline-block; box-sizing: border-box; min-width: 6em; text-align: center; background: var(--delay-bg); color: var(--delay-text); border: 1px solid var(--delay-border); border-radius: 10px; font-size: 10px; font-weight: 600; padding: 0 6px; line-height: 15px; flex: none; font-variant-numeric: normal; }
.att { display: inline-flex; min-width: 18px; height: 18px; border-radius: 9px; background: #000; color: #fff; align-items: center; justify-content: center; font-size: 10px; padding: 0 5px; }
.cog { background: none; border: 0; cursor: pointer; font-size: 14px; color: #555; padding: 0 4px; }
.gridfoot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); }
.empty { padding: 18px; text-align: center; color: var(--muted); }
.total td { font-weight: 600; background: var(--head); }

/* consignment screen */
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.cols .panel { margin-bottom: 0; }
dl.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 10px; margin: 0; font-size: 12px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.files { list-style: none; padding: 0; margin: 0; }
.files li { padding: 5px 0; border-bottom: 1px solid var(--soft); font-size: 12px; }
.feed { list-style: none; padding: 0; margin: 0 0 10px; }
.feed li { padding: 7px 0; border-bottom: 1px solid var(--soft); font-size: 12px; }
.feed .when { color: var(--muted); font-size: 11px; display: block; }
.notice { background: #f4f7fb; border: 1px solid #d5e0ee; border-radius: 4px; padding: 8px 10px; font-size: 12px; margin-bottom: 10px; }
.notice.warn { background: #fff7e0; border-color: #ecd58a; }
.notice.bad { background: #fdecec; border-color: #f0b4b4; }

/* dialogs */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px 16px; overflow: auto; }
.overlay[hidden] { display: none; }
.dialog { background: #fff; border-radius: 4px; width: min(880px, 100%); min-width: 0; box-shadow: 0 14px 40px rgba(0,0,0,.3); }
.dialog.narrow { width: min(560px, 100%); }
.dialog header { padding: 12px 16px; border-bottom: 1px solid var(--soft); font-size: 15px; font-weight: 600; }
.dialog .body { padding: 14px 16px; min-width: 0; }
.dialog footer { padding: 10px 16px; border-top: 1px solid var(--soft); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.twolists { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.twolists ul { list-style: none; margin: 6px 0 0; padding: 0; border: 1px solid var(--soft); border-radius: 4px; min-height: 180px; }
.twolists > div { min-width: 0; }
.twolists li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 10px; border-bottom: 1px solid var(--soft); font-size: 12px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #111; color: #fff; padding: 9px 16px; border-radius: 4px; z-index: 60; font-size: 12px; }
.toast[hidden] { display: none; }

/* staff */
.approval { border: 1px solid var(--soft); border-radius: 4px; padding: 12px; margin-bottom: 10px; }
.approval .meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; align-items: center; margin-bottom: 6px; }
.tag { display: inline-block; box-sizing: border-box; min-width: 62px; text-align: center; font-size: 10px; border-radius: 10px; padding: 1px 8px; background: #eceff3; flex: none; }
.tag.pending { background: #fff1c2; }
.tag.approved { background: #d6f2df; }
.tag.held { background: #e7e7e7; }
.approval pre, .preview pre { white-space: pre-wrap; font: inherit; font-size: 12px; background: #fafafa; border: 1px solid var(--soft); border-radius: 4px; padding: 10px; margin: 6px 0; }
.approval .acts { display: flex; gap: 8px; margin-top: 8px; }
.problems { margin: 6px 0 0; padding-left: 18px; color: #b91c1c; font-size: 12px; }
.okline { color: #166534; font-size: 12px; margin-top: 6px; }
.mailpreview { border: 1px solid var(--soft); border-radius: 4px; padding: 16px; background: #fff; max-width: 620px; }

/* sign-in */
body.signin { background: var(--page); }
.signin-card { max-width: 420px; margin: 70px auto; padding: 24px; }
.signin-card input { width: 100%; margin-bottom: 12px; }
.signin-card .btn { width: 100%; justify-content: center; }
.signin-msg { background: #f4f7fb; border: 1px solid #d5e0ee; border-radius: 4px; padding: 8px 10px; }
.signin-msg.bad { background: #fdecec; border-color: #f0b4b4; }
.signin-card .linkbtn { display: block; margin: 12px auto 0; }
.signin-card .problems { margin-bottom: 12px; }
.oncelink { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.oncelink input { flex: 1 1 auto; min-width: 0; width: 100%; }
.userform { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px; align-items: end; }
.userform input, .userform select { width: 100%; }
td.acts { white-space: nowrap; }
table.grid.users .tag { width: 104px; }
.account .acctlink { color: inherit; text-decoration: none; }
.account .acctlink:hover { text-decoration: underline; }
td.acts .btn + .btn { margin-left: 6px; }

@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .three { grid-template-columns: 1fr; }
  .topsearch { display: none; }
}
/* Narrow windows: the bar becomes two rows, the mark and sign-out above, the
   menu below, so nothing overlaps and the page never scrolls sideways. */
@media (max-width: 900px) {
  .topbar { height: auto; flex-wrap: wrap; gap: 0 10px; padding: 0 8px; }
  .brand { height: 38px; }
  .topright { height: 38px; min-width: 0; }
  .account { min-width: 0; overflow: hidden; }
  .menu { order: 3; flex: 0 0 100%; height: 34px; border-top: 1px solid #262626; overflow-x: auto; scrollbar-width: none; }
  .menu::-webkit-scrollbar { display: none; }
  .menu > a, .menu > .dd > button { height: 34px; padding: 0 8px; font-size: 12px; }
}
@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .account { display: none; }
  .filters .wide { grid-column: span 1; }
  .page { padding: 0 10px 32px; }
  .crumbrow { padding: 10px 10px 0; }
  .menu > a, .menu > .dd > button { padding: 0 6px; }
  .overlay { padding: 24px 10px 10px; }
  .dialog footer .btn { flex: 1 1 auto; justify-content: center; }
  .panelhead .links { width: 100%; }
  .headfield { flex: 1 1 100%; width: auto; }
}

.signout-form { display: inline; margin: 0; }
.signout-form button.signout { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: 0; }

/* Quick links on the home page (lane dev-freight-portal-manage-core): four
   large shortcuts, the platform's Quick Link dashboard in Senditt's frame. */
.quick h2 { margin-bottom: 10px; }
.qlinks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.qlink { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px; border: 1px solid var(--soft); border-radius: 4px; background: #fff; color: var(--ink); }
.qlink:hover { border-color: var(--orange); background: #fff4ef; text-decoration: none; }
.qtext { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qtext b { font-size: 14px; font-weight: 600; }
.qtext .sub { margin: 0; }
.qicon { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--orange); position: relative; }
.qicon::after { content: ""; position: absolute; inset: 0; margin: auto; background: #fff; }
.qicon.quote::after { width: 12px; height: 16px; border-radius: 2px; }
.qicon.book::after { width: 16px; height: 12px; border-radius: 2px; }
.qicon.track::after { width: 14px; height: 14px; border-radius: 50%; }
.qicon.done::after { width: 8px; height: 14px; background: none; border: solid #fff; border-width: 0 3px 3px 0; transform: translateY(-2px) rotate(45deg); }
@media (max-width: 1100px) { .qlinks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .qlinks { grid-template-columns: minmax(0, 1fr); } }
