/* VertaLink Sheet. Reads like the workbook it replaces: a header bar, one
   worksheet at a time, and a tab strip along the bottom. */
:root {
  --slate: #1D2630; --sage: #6B7A4E; --sage-soft: #EAF0E0; --cream: #F0F2EE; --line: #D5DACF;
  --ink: #2B3440; --muted: #6F7A69; --white: #fff; --danger: #B5524A; --warn: #C08A3E; --ok: #5C7A4A;
  --new: #FFF6D6; --grid: #C9CFC3;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif; font-size: 13px; color: var(--ink); background: var(--cream); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
#app { display: flex; flex-direction: column; min-height: 100vh; }

/* Header */
.bar { background: var(--slate); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; height: 48px; position: sticky; top: 0; z-index: 5; }
.bar .brand { font-weight: 700; letter-spacing: .2px; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.bar .brand .pill { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; border: 1px solid #8B95A1; color: #C8DBA3; border-radius: 999px; padding: 2px 8px; }
.bar .right { display: flex; align-items: center; gap: 10px; }
.bar .who { font-size: 12.5px; color: #C9D1D9; }
.bar button { background: transparent; border: 1px solid #ffffff44; color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 12.5px; }
.bar button:hover { background: #ffffff14; }
.bell { position: relative; }
.bell .count { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff; border-radius: 999px; min-width: 17px; height: 17px; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.notif-menu { position: absolute; right: 14px; top: 52px; width: 340px; max-height: 60vh; overflow: auto; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); z-index: 6; }
.notif-menu .item { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif-menu .item:hover { background: var(--sage-soft); }
.notif-menu .item.unread { background: var(--new); }
.notif-menu .item .ts { color: var(--muted); font-size: 11px; margin-top: 2px; }
.notif-menu .empty { padding: 16px; color: var(--muted); }

/* Sheet body */
.sheet { flex: 1; padding: 14px; overflow: auto; }
.sheet-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.sheet-title h1 { margin: 0; font-size: 18px; color: var(--slate); }
.sheet-title .hint { color: var(--muted); font-size: 12.5px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 10px; }
.btn { background: var(--sage); color: #fff; border: 1px solid var(--sage); border-radius: 8px; padding: 7px 12px; font-weight: 600; font-size: 12.5px; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.danger { background: #fff; color: var(--danger); border-color: #E2B8B4; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.note { color: var(--muted); font-size: 12px; }
.err { color: var(--danger); font-size: 12.5px; margin-top: 6px; }
.ok { color: var(--ok); font-size: 12.5px; margin-top: 6px; font-weight: 600; }

/* Grid tables */
.grid-wrap { overflow: auto; background: #fff; border: 1px solid var(--grid); }
table.grid { border-collapse: collapse; width: 100%; }
table.grid th, table.grid td { border: 1px solid var(--grid); padding: 0; vertical-align: top; }
table.grid th { background: #E9ECE5; font-weight: 700; font-size: 12px; text-align: left; padding: 8px 8px; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
table.grid th.rownum, table.grid td.rownum { width: 34px; text-align: center; color: var(--muted); background: #F4F6F1; font-size: 11.5px; padding: 8px 0; }
table.grid td .cell { display: block; width: 100%; min-height: 34px; padding: 7px 8px; border: none; background: transparent; outline: none; resize: none; font-size: 12.5px; line-height: 1.4; white-space: pre-wrap; }
table.grid td .cell:focus { box-shadow: inset 0 0 0 2px var(--sage); background: #fff; }
table.grid td .cell.ro { color: var(--ink); }
table.grid td .cell.bad { box-shadow: inset 0 0 0 2px var(--danger); }
table.grid td.static { padding: 7px 8px; font-size: 12.5px; line-height: 1.4; }
table.grid tr.new td { background: var(--new); }
table.grid tr.block-start td { border-top: 2px solid var(--slate); }
table.grid tr.taken td { color: var(--muted); }
table.grid td.actions { white-space: nowrap; padding: 4px 6px; }
table.grid td.actions .btn { padding: 4px 9px; font-size: 12px; }
.sub { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; border-radius: 999px; padding: 2px 7px; border: 1px solid var(--line); background: var(--cream); color: var(--muted); }
.tag.new { background: var(--new); border-color: #E8D79A; color: #7A5200; }
.tag.ok { background: var(--sage-soft); border-color: #C4D4A0; color: var(--ok); }
.tag.done { background: var(--slate); border-color: var(--slate); color: #C8DBA3; }
.stack { display: grid; gap: 2px; }
.stack input { width: 100%; border: none; border-bottom: 1px dashed #E1E5DC; padding: 5px 8px; background: transparent; font-size: 12.5px; outline: none; }
.stack input:focus { background: #fff; border-bottom-color: var(--sage); }
.stack input::placeholder { color: #A5AC9F; }

/* Paste box */
.paste { display: grid; gap: 8px; margin-bottom: 10px; }
.paste textarea { width: 100%; min-height: 84px; border: 1px dashed var(--grid); border-radius: 8px; padding: 9px 11px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; background: #fff; white-space: pre; }

/* Tab strip */
.tabs { display: flex; align-items: flex-end; gap: 2px; background: #DFE3DA; border-top: 1px solid var(--grid); padding: 6px 10px 0; overflow-x: auto; position: sticky; bottom: 0; }
.tabs button { background: #EDF0E9; border: 1px solid var(--grid); border-bottom: none; border-radius: 6px 6px 0 0; padding: 7px 14px; font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.tabs button.active { background: #fff; font-weight: 700; color: var(--slate); border-color: var(--sage); }
.tabs button .dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; background: var(--danger); margin-left: 6px; vertical-align: middle; }

/* Sign in */
.signin { max-width: 520px; margin: 60px auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.signin h1 { margin: 0 0 6px; font-size: 22px; color: var(--slate); }
.signin p { margin: 0 0 16px; color: var(--muted); }
.signin .users { display: grid; gap: 8px; margin-bottom: 18px; }
.signin .users button { text-align: left; background: var(--cream); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; }
.signin .users button:hover { background: var(--sage-soft); }
.signin .form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.signin .form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.signin .form input, .signin .form select { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: #fff; }
.signin .form .full { grid-column: 1 / -1; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 58px; transform: translateX(-50%); background: var(--slate); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 9; }

@media (max-width: 640px) {
  .signin .form { grid-template-columns: 1fr; }
  input, textarea, select { font-size: 16px !important; }
  .notif-menu { right: 6px; left: 6px; width: auto; }
}

/* Sign in switch, links, modals, reviews */
.switch { display: flex; gap: 6px; margin-bottom: 14px; }
.switch button { flex: 1; background: var(--cream); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-weight: 600; }
.switch button.active { background: var(--sage); color: #fff; border-color: var(--sage); }
.signin .err { min-height: 18px; }
button.link { background: none; border: none; padding: 0; color: var(--sage); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }
button.link:hover { color: var(--slate); }
.modal-bg { position: fixed; inset: 0; background: rgba(29,38,48,.45); display: grid; place-items: center; z-index: 20; padding: 14px; }
.modal { position: relative; background: #fff; border-radius: 14px; padding: 22px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal h2 { margin: 0 0 4px; font-size: 19px; color: var(--slate); }
.modal .close { position: absolute; top: 10px; right: 12px; background: none; border: none; font-size: 16px; color: var(--muted); }
.modal textarea { width: 100%; min-height: 70px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0; }
.stats div { background: var(--cream); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 2px; }
.stats b { font-size: 17px; color: var(--slate); }
.stats span { font-size: 11.5px; color: var(--muted); }
.review { border-top: 1px solid var(--line); padding: 9px 0; display: grid; gap: 4px; }
.starpick { display: flex; gap: 4px; margin-top: 12px; }
.starpick button { background: none; border: none; font-size: 28px; line-height: 1; color: var(--warn); padding: 0 2px; }
.btn.ok-btn { background: var(--ok); border-color: var(--ok); }

/* Terms page and service tag */
.terms { max-width: 640px; }
.terms-body { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px; background: var(--cream); font-size: 13px; line-height: 1.55; }
.terms-body p { margin: 10px 0; }
.tag.cold { background: #E3EEF7; border-color: #BFD6EA; color: #2F5A80; }
table.grid td select.cell { appearance: auto; }

/* Take panel */
tr.take-panel td { background: var(--sage-soft); border-top: none; }
.take { display: grid; grid-template-columns: 1fr 1fr auto; gap: 14px; padding: 10px 4px; align-items: start; }
.take-h { font-weight: 700; font-size: 12px; margin-bottom: 4px; color: var(--slate); }
.take select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; background: #fff; }
.take .stack { background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.take-go { min-width: 200px; padding-top: 20px; }
@media (max-width: 640px) { .take { grid-template-columns: 1fr; } }

/* Layover: the take panel grows a second driver and vehicle row for the morning
   leg, and a route shows both legs stacked in the Driver and Vehicle cells. */
.take-wrap { display: grid; gap: 6px; }
.take-layover { display: block; margin: 0 4px 4px; }
.take-layover input { margin-right: 6px; vertical-align: middle; }
.leg2 { font-size: 11px; font-weight: 700; color: var(--muted); margin: 8px 0 2px; text-transform: uppercase; letter-spacing: 0.04em; }

/* The gate: everything before the board (sign in, request, holding, terms,
   set password) sits on one dark screen under the wordmark, the way the
   original landing page read. */
.gate { flex: 1; background: var(--slate); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }
.gate .mark { font-weight: 700; font-size: 44px; letter-spacing: -0.5px; line-height: 1; }
.gate .mark .a { color: #C8DBA3; }
.gate .mark .b { color: #8B95A1; }
.gate .tagline { color: #8B95A1; font-size: 12.5px; letter-spacing: 1.6px; text-transform: uppercase; font-weight: 700; margin-top: 13px; text-align: center; }
.gate .signin { margin: 26px 0 0; max-width: 460px; width: 100%; box-shadow: 0 18px 44px rgba(0,0,0,.28); }
.gate .signin.terms { max-width: 620px; }
@media (max-width: 560px) { .gate .mark { font-size: 36px; } .gate .tagline { letter-spacing: 1.1px; } }
.bar .brand .wm { font-size: 17px; letter-spacing: -0.3px; }
.bar .brand .wm .a { color: #C8DBA3; }
.bar .brand .wm .b { color: #E6EAF0; }

/* Fix: the small link inside a From or To cell that raises a correction to a
   facility, put where the wrong detail is noticed. */
table.grid td { position: relative; }
.fixlink { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: var(--sage-soft); color: var(--ok); border: 1px solid #CBD9B2; border-radius: 6px; padding: 1px 6px; font-size: 10.5px; font-weight: 700; opacity: 0; transition: opacity .12s; }
table.grid td:hover .fixlink, .fixlink:focus-visible { opacity: 1; }
.fixlink:hover { background: #DDE8C8; }

/* Metrc manifest: everything the shipper types into Metrc, in Metrc's words,
   each value a click to copy. */
.modal.wide { max-width: 620px; }
.mf { max-height: 56vh; overflow: auto; margin: 12px 0; display: grid; gap: 12px; }
.mf-g { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; }
.mf-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 5px; }
.mf-r { display: grid; grid-template-columns: 190px 1fr; gap: 8px; align-items: baseline; padding: 2px 0; }
.mf-k { color: var(--muted); font-size: 12.5px; }
.mf-v { text-align: left; background: var(--sage-soft); border: 1px solid transparent; border-radius: 6px; padding: 3px 7px; font-weight: 600; font-size: 13px; color: var(--ink); font-family: "Segoe UI", system-ui, sans-serif; }
.mf-v:hover { border-color: var(--sage); }
@media (max-width: 560px) { .mf-r { grid-template-columns: 1fr; gap: 1px; } }
