/* ================================================================
   TruckDesk — "Open Road" design system
   Highway signage type · manila-file surfaces · safety-orange accents
   ================================================================ */
:root {
  --asphalt: #1b1e23;          /* sidebar, headings */
  --asphalt-2: #2a2e35;
  --ink: #23262b;
  --ink-2: #6b6659;            /* warm gray, like faded typewriter ink */
  --paper: #f2efe6;            /* manila / road-map paper */
  --card: #fbf9f2;
  --line: #d9d2c0;
  --line-hard: #b8b09a;
  --orange: #e8731a;           /* safety orange */
  --orange-dark: #c85f10;
  --yellow: #f2b705;           /* hazard yellow */
  --green: #2e7d4f;
  --red: #c0392b;
  --blue: #275f8f;
  --mono: "IBM Plex Mono", Consolas, monospace;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --radius: 3px;
  --shadow: 3px 3px 0 rgba(27, 30, 35, .10);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Barlow", "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  background-image: repeating-linear-gradient(0deg, transparent, transparent 27px, rgba(27,30,35,.022) 27px, rgba(27,30,35,.022) 28px);
  color: var(--ink); font-size: 14.5px;
  display: flex; min-height: 100vh;
}

/* ---------- sidebar ---------- */
#sidebar {
  width: 228px; background: var(--asphalt); color: #c9c4b6; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  border-right: 3px solid var(--yellow);
}
#brand { padding: 22px 20px 14px; }
#brand .logo {
  font-family: var(--cond); font-size: 26px; font-weight: 700; color: #fff;
  letter-spacing: 1.5px; line-height: 1;
}
#brand .logo span { color: var(--orange); }
#brand .tag {
  font-size: 10.5px; color: #8d8878; margin-top: 5px;
  text-transform: uppercase; letter-spacing: 1.2px;
}
.hazard {
  height: 8px; margin: 0 0 10px;
  background: repeating-linear-gradient(-45deg,
    var(--yellow) 0 10px, var(--asphalt) 10px 20px);
  border-top: 1px solid #000; border-bottom: 1px solid #000;
}
#nav { padding: 8px 0; display: flex; flex-direction: column; }
#nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 20px;
  color: #c9c4b6; text-decoration: none;
  font-family: var(--cond); font-weight: 600; font-size: 16px;
  text-transform: uppercase; letter-spacing: .8px;
  border-left: 4px solid transparent;
}
#nav a svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .75; }
#nav a:hover { background: var(--asphalt-2); color: #fff; }
#nav a.active {
  background: var(--asphalt-2); color: var(--yellow);
  border-left-color: var(--orange);
}
#nav a.active svg { opacity: 1; }
#sidebar .foot {
  margin-top: auto; padding: 14px 20px; font-size: 11px; color: #8d8878;
  border-top: 1px dashed #3a3e46;
}

/* ---------- main ---------- */
#main { flex: 1; padding: 28px 34px 60px; max-width: 1280px; }
h1 {
  font-family: var(--cond); font-size: 30px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: var(--asphalt);
  margin-bottom: 2px;
}
.sub { color: var(--ink-2); margin-bottom: 22px; font-size: 13.5px; }
h2 {
  font-family: var(--cond); font-size: 16px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: var(--asphalt);
  margin-bottom: 12px;
  display: inline-block;
  border-bottom: 3px solid var(--orange);
  padding-bottom: 2px;
}

.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, 1fr); } .cols-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line-hard);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px;
}
.stat { position: relative; overflow: hidden; }
.stat::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--orange);
}
.stat .num {
  font-family: var(--cond); font-size: 40px; font-weight: 700;
  color: var(--asphalt); line-height: 1;
}
.stat .lbl {
  color: var(--ink-2); font-size: 11px; margin-top: 6px;
  text-transform: uppercase; letter-spacing: .8px; font-weight: 600;
}
.stat .hint { font-size: 11.5px; color: var(--orange-dark); margin-top: 6px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-family: var(--cond); font-size: 12.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: var(--asphalt);
  padding: 8px 10px; border-bottom: 2px solid var(--asphalt); white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover { background: rgba(232, 115, 26, .06); }
.tablewrap { overflow-x: auto; }

/* ---------- badges: stamped-label look ---------- */
.badge {
  display: inline-block; padding: 2px 7px; border-radius: 2px;
  font-family: var(--cond); font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px; white-space: nowrap;
  border: 1.5px solid currentColor;
}
.b-new { color: var(--blue); background: rgba(39, 95, 143, .07); }
.b-contacted { color: #9a6700; background: rgba(242, 183, 5, .10); }
.b-quoting { color: #5b3fc4; background: rgba(91, 63, 196, .07); }
.b-submitted { color: #0b6e99; background: rgba(11, 110, 153, .07); }
.b-bound { color: var(--green); background: rgba(46, 125, 79, .08); }
.b-lost { color: #a13224; background: rgba(161, 50, 36, .07); }
.b-demo { color: #6b7a8e; background: rgba(107, 122, 142, .08); }
.b-src { color: #5c564a; background: rgba(92, 86, 74, .07); font-weight: 600; }
.b-danger { color: var(--red); background: rgba(192, 57, 43, .08); }
.b-ok { color: var(--green); background: rgba(46, 125, 79, .08); }

/* ---------- forms ---------- */
input, select, textarea {
  font: inherit; padding: 8px 11px;
  border: 1.5px solid var(--line-hard); border-radius: var(--radius);
  background: #fff; color: var(--ink); outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--orange); box-shadow: 0 0 0 3px rgba(232, 115, 26, .15);
}
label {
  font-family: var(--cond); font-size: 12px; font-weight: 600; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .8px;
  display: block; margin-bottom: 4px;
}
.field { margin-bottom: 12px; }
.btn {
  font-family: var(--cond); font-size: 14.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  padding: 8px 16px; border-radius: var(--radius); cursor: pointer;
  border: 1.5px solid var(--asphalt); background: var(--asphalt); color: #fff;
  box-shadow: 2px 2px 0 rgba(27, 30, 35, .18);
}
.btn:hover { background: var(--asphalt-2); }
.btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(27, 30, 35, .18); }
.btn.amber { background: var(--orange); border-color: var(--orange-dark); color: #fff; }
.btn.amber:hover { background: var(--orange-dark); }
.btn.ghost { background: var(--card); border-color: var(--line-hard); color: var(--ink); box-shadow: none; }
.btn.ghost:hover { background: #efece1; }
.btn.danger { background: var(--card); border-color: #d3a49c; color: var(--red); box-shadow: none; }
.btn.danger:hover { background: #f8ece9; }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input[type=text], .toolbar input[type=search] { min-width: 220px; }

/* ---------- kanban: clipboard columns ---------- */
#kanban { display: grid; grid-template-columns: repeat(6, minmax(180px, 1fr)); gap: 12px; overflow-x: auto; align-items: start; }
.kcol {
  background: #e9e4d6; border: 1px solid var(--line-hard);
  border-radius: var(--radius); padding: 10px; min-height: 220px;
}
.kcol h3 {
  font-family: var(--cond); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: var(--asphalt);
  padding: 2px 4px 8px; display: flex; justify-content: space-between;
  border-bottom: 2px solid var(--asphalt); margin-bottom: 8px;
}
.kcard {
  background: var(--card); border: 1px solid var(--line-hard); border-radius: 2px;
  padding: 10px 12px; margin-bottom: 8px; cursor: grab;
  box-shadow: 2px 2px 0 rgba(27, 30, 35, .10);
}
.kcard .nm { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.kcard .mt { font-size: 11.5px; color: var(--ink-2); font-family: var(--mono); }
.kcard.dragging { opacity: .45; }
.kcol.dragover { outline: 2px dashed var(--orange); outline-offset: -4px; }

/* ---------- drawer ---------- */
#overlay { position: fixed; inset: 0; background: rgba(20, 22, 26, .5); display: none; z-index: 40; }
#drawer {
  position: fixed; top: 0; right: -720px; width: 700px; max-width: 95vw; height: 100vh;
  background: var(--card); z-index: 50; box-shadow: -8px 0 30px rgba(20, 22, 26, .3);
  border-left: 3px solid var(--yellow);
  transition: right .22s ease; overflow-y: auto; padding: 26px 30px 60px;
}
#drawer.open { right: 0; }
#drawer .close { position: absolute; top: 18px; right: 22px; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--ink-2); }
#drawer h1 { font-size: 24px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 13.5px; margin: 14px 0; }
.kv dt {
  color: var(--ink-2); font-family: var(--cond); font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px; font-size: 12px;
}
.kv dd { word-break: break-word; }
.section { border-top: 1px dashed var(--line-hard); margin-top: 20px; padding-top: 16px; }
.minitable th, .minitable td { padding: 6px 8px; font-size: 12.5px; }
.notelist { list-style: none; }
.notelist li {
  background: #fffdf5; border: 1px solid var(--line); border-left: 3px solid var(--yellow);
  border-radius: 2px; padding: 10px 13px; margin-bottom: 8px; font-size: 13px;
}
.notelist .when { font-size: 11px; color: var(--ink-2); margin-top: 4px; font-family: var(--mono); }
.tasklist { list-style: none; }
.tasklist li { display: flex; align-items: center; gap: 9px; padding: 6px 2px; font-size: 13.5px; }
.tasklist li.done span { text-decoration: line-through; color: var(--ink-2); }
.due { font-size: 11.5px; color: var(--ink-2); margin-left: auto; white-space: nowrap; font-family: var(--mono); }
.due.overdue { color: var(--red); font-weight: 600; }
.activity { font-size: 12.5px; color: var(--ink-2); }
.activity li { padding: 4px 0; list-style: none; }

/* ---------- misc ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--asphalt); color: #fff; padding: 11px 22px;
  border-radius: var(--radius); border-left: 4px solid var(--yellow);
  font-size: 13.5px; display: none; z-index: 99; box-shadow: var(--shadow);
}
#toast.err { background: var(--red); border-left-color: #7c1f14; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line-hard); border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--ink-2); font-size: 12.5px; }
.empty { text-align: center; color: var(--ink-2); padding: 34px 0; font-size: 13.5px; }
.linky { color: var(--blue); cursor: pointer; text-decoration: none; border-bottom: 1px dotted var(--blue); }
.linky:hover { color: var(--orange-dark); border-bottom-color: var(--orange-dark); }
.progressbar { height: 8px; background: #e2ddce; border: 1px solid var(--line-hard); border-radius: 2px; overflow: hidden; margin: 8px 0; }
.progressbar > div {
  height: 100%;
  background: repeating-linear-gradient(-45deg, var(--yellow) 0 8px, #d9a504 8px 16px);
  transition: width .4s;
}
.foundlist { max-height: 300px; overflow-y: auto; }
.xdate-soon { color: var(--red); font-weight: 700; }
.xdate-mid { color: var(--orange-dark); font-weight: 600; }

/* ---------- lead pull ---------- */
.chipgrid { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 11px; border-radius: 2px;
  font-family: var(--cond); font-size: 12.5px; font-weight: 600; letter-spacing: .5px;
  border: 1.5px solid var(--line-hard); background: var(--card); color: var(--ink-2);
  cursor: pointer; user-select: none; transition: all .1s;
}
.chip:hover { border-color: var(--asphalt); color: var(--ink); }
.chip.inc { background: rgba(46, 125, 79, .10); border-color: var(--green); color: #1d5c38; }
.chip.inc::before { content: "+ "; }
.chip.exc { background: rgba(192, 57, 43, .09); border-color: var(--red); color: #92291d; }
.chip.exc::before { content: "− "; }
.filtergrid { display: grid; grid-template-columns: repeat(5, minmax(115px, 1fr)); gap: 12px; align-items: end; }
@media (max-width: 1100px) { .filtergrid { grid-template-columns: repeat(2, 1fr); } }
.statebox { display: flex; flex-wrap: wrap; gap: 4px; max-height: 132px; overflow-y: auto; border: 1.5px solid var(--line-hard); border-radius: var(--radius); padding: 8px; background: #fff; }
.statebox.disabled { opacity: .4; pointer-events: none; }
.stchip {
  padding: 3px 8px; border-radius: 2px;
  font-family: var(--cond); font-size: 12px; font-weight: 600; letter-spacing: .5px;
  border: 1px solid var(--line-hard); cursor: pointer; user-select: none;
}
.stchip.on { background: var(--asphalt); color: var(--yellow); border-color: var(--asphalt); }
.pullresults td { font-size: 13px; }
.selrow { background: rgba(242, 183, 5, .09); }

/* ---------- auth ---------- */
#authWrap {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center;
  background: var(--asphalt);
  background-image:
    repeating-linear-gradient(90deg, transparent 0 120px, rgba(242,183,5,.05) 120px 160px),
    linear-gradient(160deg, #16181c 0%, #23262d 100%);
}
#authWrap.open { display: flex; }
#authBox {
  background: var(--card); border-radius: 4px; padding: 0 0 28px; width: 400px; max-width: 92vw;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, .35); border: 1px solid #000;
  overflow: hidden;
}
#authBox::before {
  content: ""; display: block; height: 10px;
  background: repeating-linear-gradient(-45deg, var(--yellow) 0 12px, var(--asphalt) 12px 24px);
  border-bottom: 2px solid #000; margin-bottom: 24px;
}
#authBox > * { margin-left: 32px; margin-right: 32px; }
#authBox .logo {
  font-family: var(--cond); font-size: 34px; font-weight: 700;
  color: var(--asphalt); letter-spacing: 2px;
}
#authBox .logo span { color: var(--orange); }
#authBox .tabrow { display: flex; gap: 0; margin: 16px 32px 14px; border-bottom: 2px solid var(--line-hard); }
#authBox .tabrow button {
  flex: 1; background: none; border: none; font-family: var(--cond); font-size: 15px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 1px; padding: 8px;
  cursor: pointer; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -2px;
}
#authBox .tabrow button.on { color: var(--asphalt); border-bottom-color: var(--orange); }
.trialbanner {
  background: rgba(242, 183, 5, .12); border: 1px solid #d9a504; color: #7c5d00;
  padding: 8px 14px; border-radius: 2px; font-size: 13px; margin-bottom: 16px;
}

/* ---------- modal ---------- */
#modalWrap {
  position: fixed; inset: 0; background: rgba(20, 22, 26, .55); z-index: 80;
  display: none; align-items: center; justify-content: center;
}
#modalWrap.open { display: flex; }
#modal {
  background: var(--card); border-radius: 4px; padding: 24px 26px; width: 480px;
  max-width: 92vw; max-height: 88vh; overflow-y: auto;
  border: 1px solid #000; border-top: 6px solid var(--orange);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, .3);
}
#modal h2 { margin-bottom: 4px; }
.covopt {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: 1.5px solid var(--line-hard); border-radius: 2px; margin-top: 8px; cursor: pointer;
  background: #fff;
}
.covopt:hover { border-color: var(--orange); }
.covopt input { width: 16px; height: 16px; }
.covopt .sub { font-size: 11.5px; color: var(--ink-2); }
