/* iFREIGHT247 — Driver Loads. Mobile-first, big tap targets. */
:root {
  --ink: #16202b;
  --muted: #66727f;
  --line: #dde3e9;
  --bg: #f4f6f8;
  --card: #ffffff;
  --accent: #e8720c;
  --accent-dark: #c25e06;
  --ok: #177245;
  --err: #b3261e;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
}

.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 800; letter-spacing: 0.4px; font-size: 20px; }
.brand-accent { color: var(--accent); }
.brand-sub { font-size: 12px; color: #b9c4cf; text-transform: uppercase; letter-spacing: 1.2px; }

.topnav { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.topnav button {
  background: transparent;
  border: 1px solid #3c4a59;
  color: #e8edf1;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  min-height: 36px;
}
.topnav button:active { background: #26313d; }
.topnav .who { border: none; color: #b9c4cf; cursor: default; }
/* Compact account area: Password / Sign out tucked at the right end
   of the header, visually secondary to the main sections. */
.topnav .account {
  display: inline-flex; gap: 2px; align-items: center;
  margin-left: auto; padding-left: 10px;
  border-left: 1px solid #3c4a59;
}
.topnav .account button {
  border-color: transparent; color: #b9c4cf;
  font-size: 12px; padding: 6px 8px; min-height: 32px;
}
.topnav .account button:active { background: #26313d; }

.app { max-width: 860px; margin: 0 auto; padding: 16px 14px 40px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 10px 30px; }

.center { text-align: center; }
.muted { color: var(--muted); }
.error {
  background: #fdecea; color: var(--err); border: 1px solid #f3c1bd;
  padding: 10px 12px; border-radius: 10px; font-size: 14px;
}
.notice {
  background: #e9f6ef; color: var(--ok); border: 1px solid #bfe3cf;
  padding: 10px 12px; border-radius: 10px; font-size: 14px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  max-width: 440px;
  margin: 22px auto;
}
.panel h1 { font-size: 22px; margin: 0 0 6px; }
.panel h2 { font-size: 17px; margin: 0 0 10px; }

label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
input, select {
  width: 100%;
  font-size: 17px; /* >=16px stops iOS focus zoom */
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  min-height: 48px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 10px; cursor: pointer;
  font-size: 16px; font-weight: 700;
  padding: 13px 18px; min-height: 50px;
  background: var(--accent); color: #fff; width: 100%;
}
.btn:active { background: var(--accent-dark); }
.btn.secondary { background: var(--ink); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.small { width: auto; min-height: 40px; padding: 8px 14px; font-size: 14px; }
.backrow { margin: 0 0 10px; }
.btn.back-btn { width: auto; min-height: 48px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.linkish {
  background: none; border: none; color: var(--accent-dark);
  font-size: 14px; cursor: pointer; padding: 8px 0; text-decoration: underline;
}

/* Board */
/* Sub-view switch inside Top Loads: Loads | Destinations */
.subnav {
  display: flex; gap: 4px; background: #e6ebef;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px; margin: 0 0 12px;
}
.subnav button {
  flex: 1; border: none; background: transparent; color: var(--muted);
  border-radius: 999px; padding: 9px 10px; font-size: 15px; font-weight: 700;
  cursor: pointer; min-height: 42px;
}
.subnav button.active { background: var(--ink); color: #fff; }
.board-head { margin: 6px 0 12px; }
.board-head h1 { font-size: 22px; margin: 0; }
.board-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }

.tabs {
  display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 0 10px;
  position: sticky; top: 57px; background: var(--bg); z-index: 10;
}
/* City chips fill each row evenly (3 across) so a lone chip never strands on its own row. */
.tab {
  flex: 1 1 30%;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 10px 8px; font-size: 15px; font-weight: 600;
  cursor: pointer; min-height: 44px; text-align: center; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab .count { opacity: 0.65; font-weight: 400; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.card .lane { font-size: 17px; font-weight: 800; line-height: 1.3; }
.card .broker { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card .contact { font-size: 15px; margin-top: 6px; }
.card .contact a { color: var(--accent, #2563eb); font-weight: 600; text-decoration: none; padding: 2px 0; display: inline-block; }
.card .contacthint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card .grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 12px 0 4px; font-size: 14px;
}
.card .grid b { display: block; font-size: 16px; }
.card .grid span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }
.card .notes { font-size: 13px; color: var(--muted); margin-top: 8px; white-space: pre-wrap; }
.card .rate { color: var(--ok); }

.bookrow { display: flex; gap: 8px; margin-top: 12px; }
.bookrow .btn { flex: 1; font-size: 15px; padding: 12px 8px; }
.bookmine { display: flex; gap: 8px; margin-top: 8px; }
.bookmine input { flex: 1; }
.bookmine .btn { flex: 1; width: auto; font-size: 15px; }

.pressed {
  margin-top: 12px; background: #e9f6ef; border: 1px solid #bfe3cf;
  color: var(--ok); border-radius: 10px; padding: 9px 12px; font-size: 14px; font-weight: 600;
}

.empty {
  text-align: center; color: var(--muted); padding: 34px 16px;
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
}

/* Office */
.switcher { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
table.drivers { width: 100%; border-collapse: collapse; font-size: 14px; }
table.drivers th, table.drivers td {
  text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.drivers th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.rowactions { display: flex; gap: 6px; flex-wrap: wrap; }
.invitebox {
  background: #fff8ef; border: 1px solid #f2d3ac; border-radius: 10px;
  padding: 10px 12px; font-size: 13px; word-break: break-all; margin-top: 10px;
}
/* Destinations editor */
.dest-row {
  display: grid; grid-template-columns: minmax(90px, 1fr) 62px 92px auto;
  gap: 8px; align-items: end; margin-bottom: 10px;
}
.dest-row label { margin: 0 0 4px; font-size: 12px; }

.presslog { font-size: 13px; }
.presslog li { margin-bottom: 6px; }

/* Messages (Message Board) */
.badge {
  display: inline-block; min-width: 20px; text-align: center;
  background: var(--accent); color: #fff; border-radius: 999px;
  padding: 1px 6px; font-size: 12px; font-weight: 700; line-height: 1.5;
}
.topnav .badge { background: var(--accent); margin-left: 2px; }
.msg-contacts {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 12px; font-size: 14px;
}
.msg-list { display: flex; flex-direction: column; gap: 8px; }
.msg-row {
  display: flex; justify-content: space-between; gap: 10px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; text-decoration: none; color: var(--ink);
}
.msg-row:active { background: #eef1f4; }
.msg-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.msg-row-title { font-weight: 700; font-size: 16px; }
.msg-row-preview {
  color: var(--muted); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw;
}
.msg-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.msg-row-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.msg-thread { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.msg {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; max-width: 92%;
}
.msg.mine { align-self: flex-end; background: #fff4e8; border-color: #f2d3ac; }
.msg-meta { color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.msg-body { font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.msg-compose { display: flex; gap: 8px; align-items: flex-end; }
.msg-compose textarea {
  flex: 1; font-size: 17px; padding: 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; font-family: inherit; resize: vertical;
}
.msg-compose .btn { width: auto; flex: 0 0 auto; }

/* Loads mirror (private, office-only) */
.stopgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
.stopblock {
  background: #fbfcfd; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; font-size: 14px;
}
.stopblock > span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stopblock > b { display: block; font-size: 16px; margin: 2px 0; }
.stopblock > div { margin-top: 2px; }
.doc-row {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
tr.load-row:hover { background: #f6f8fa; }
td.life-cell { font-size: 12px; line-height: 1.5; white-space: nowrap; }

/* Driver lifecycle (ETA Pickup / Picked Up / ETA Delivery) */
.life-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 10px 0 4px; font-size: 14px;
}
.life-grid b { display: block; font-size: 15px; margin-top: 2px; }
.life-grid span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }
.life-actions { margin-top: 14px; display: flex; flex-direction: column; gap: 16px; }
.life-action label { margin-top: 0; }
.btn.life-btn { min-height: 58px; font-size: 18px; margin-top: 8px; }
.btn.life-btn.emphasis {
  box-shadow: 0 0 0 3px #ffd9ae; outline: 2px solid var(--accent);
}
.test-banner {
  background: #fff4e0; color: #8a5a00; border: 1px solid #f2d3ac;
  border-radius: 10px; padding: 10px 12px; font-size: 14px; font-weight: 600;
  margin-bottom: 12px;
}
.outbox-entry { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.outbox-head { font-size: 14px; }
.outbox-meta { font-size: 13px; color: var(--muted); margin-top: 3px; word-break: break-word; }
.outbox-body {
  white-space: pre-wrap; word-break: break-word; font-size: 13px;
  background: #fbfcfd; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; margin: 8px 0 2px;
}
.test-chip {
  background: #ffe1b3; color: #8a5a00; border-radius: 999px;
  padding: 1px 8px; font-size: 12px; font-weight: 700;
}
.flag-chip {
  background: #fdecea; color: var(--err); border-radius: 999px;
  padding: 1px 8px; font-size: 12px; font-weight: 700;
}
.sent-chip {
  background: #e2f4e5; color: #1d6b2a; border-radius: 999px;
  padding: 1px 8px; font-size: 12px; font-weight: 700;
}
.fail-chip {
  background: #fdecea; color: var(--err); border-radius: 999px;
  padding: 1px 8px; font-size: 12px; font-weight: 700;
}

@media (max-width: 520px) {
  .card .grid { grid-template-columns: repeat(2, 1fr); }
  .life-grid { grid-template-columns: 1fr; }
  .stopgrid { grid-template-columns: 1fr; }
  table.drivers th:nth-child(4), table.drivers td:nth-child(4) { display: none; }
}
