/* RCI Build — Rondeau Construction theme (teal #0E6B72 / #0A555B, Inter + DM Sans) */
@font-face { font-family: 'Inter'; src: url('/static/fonts/InterVariable.ttf'); font-weight: 100 900; }
@font-face { font-family: 'DM Sans'; src: url('/static/fonts/DMSansVariable.ttf'); font-weight: 100 900; }

:root {
  --teal: #0E6B72;
  --teal-dark: #0A555B;
  --teal-soft: #E3F0F1;
  --ink: #1C2B2D;
  --muted: #64777A;
  --line: #DDE6E7;
  --bg: #F4F7F7;
  --card: #FFFFFF;
  --good: #2E7D32;
  --warn: #B26A00;
  --bad: #C62828;
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', 'Segoe UI', sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
h1, h2, h3, .brand-name, #page-title { font-family: 'DM Sans', 'Inter', sans-serif; }

#app { display: flex; min-height: calc(100vh - 48px); }

/* ---------- top navigation bar ---------- */
#topnav {
  display: flex; align-items: center; gap: 4px; height: 48px; padding: 0 12px;
  background: var(--teal); color: #fff; position: sticky; top: 0; z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  /* iPhone home-screen app: keep the bar below the iOS status bar / notch */
  padding-top: env(safe-area-inset-top);
  height: calc(48px + env(safe-area-inset-top));
}
.tn-brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none;
            font-family: 'DM Sans'; font-weight: 700; font-size: 15px; margin-right: 10px; white-space: nowrap; }
.tn-brand img { width: 28px; height: 28px; border-radius: 6px; background: #fff; padding: 2px; }
#tn-menus { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.tn-item { position: relative; }
.tn-btn {
  border: none; background: none; color: rgba(255,255,255,.94); font-family: inherit;
  font-size: 13.5px; font-weight: 600; padding: 7px 11px; border-radius: 8px; cursor: pointer;
  text-decoration: none; display: inline-block; white-space: nowrap;
}
.tn-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
a.tn-btn.active, .tn-item.current > .tn-btn { background: rgba(255,255,255,.2); color: #fff; }
.tn-drop {
  display: none; position: absolute; top: 100%; left: 0; min-width: 190px; background: #fff;
  border-radius: 10px; box-shadow: 0 10px 34px rgba(0,0,0,.22); padding: 6px; z-index: 1002;
}
.tn-item.open .tn-drop { display: block; }
.tn-drop a { display: block; padding: 8px 12px; color: var(--ink); text-decoration: none;
             font-size: 13px; border-radius: 7px; }
.tn-drop a:hover { background: var(--teal-soft); color: var(--teal-dark); }
.tn-drop a.active { background: var(--teal-soft); color: var(--teal-dark); font-weight: 600; }
/* keep the map (Leaflet) below the top-nav dropdowns */
.leaflet-pane, .leaflet-top, .leaflet-bottom, .leaflet-control { z-index: 400 !important; }
.leaflet-container { z-index: 1; }
.tn-right { display: flex; align-items: center; gap: 8px; }
.tn-ico { color: rgba(255,255,255,.9); text-decoration: none; font-size: 17px; padding: 5px 8px;
          border-radius: 8px; }
.tn-ico:hover, .tn-ico.active { background: rgba(255,255,255,.16); }
#gs-wrap { position: relative; }
#global-search { width: 200px; border: none; border-radius: 8px; padding: 7px 12px; font-size: 13px;
                 background: rgba(255,255,255,.92); }
#global-search:focus { outline: 2px solid rgba(255,255,255,.5); background: #fff; }
#gs-results {
  position: absolute; top: calc(100% + 6px); right: 0; width: 320px; max-height: 380px; overflow-y: auto;
  background: #fff; border-radius: 10px; box-shadow: 0 10px 34px rgba(0,0,0,.24); padding: 6px; z-index: 97;
}
#gs-results a { display: block; padding: 8px 10px; border-radius: 7px; color: var(--ink);
                text-decoration: none; font-size: 13px; }
#gs-results a:hover { background: var(--teal-soft); }
#gs-results .gs-empty { padding: 12px; color: var(--muted); font-size: 12.5px; }

/* the old sidebar is now the MOBILE drawer only */
@media (min-width: 1151px) { body #sidebar, body #nav-toggle { display: none; } }

/* ---------- sidebar ---------- */
#sidebar {
  width: 232px; flex: 0 0 232px; background: var(--teal-dark); color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 14px; background: var(--teal); }
.brand img { width: 38px; height: 38px; object-fit: contain; border-radius: 8px; background: #fff; padding: 3px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: .3px; }
.brand-sub { font-size: 10.5px; opacity: .85; }

#nav { padding: 8px 0 24px; }
#nav .nav-group {
  padding: 14px 16px 4px; font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase;
  color: rgba(255,255,255,.55); font-weight: 600;
}
#nav a {
  display: flex; align-items: center; gap: 9px; padding: 7px 16px; color: rgba(255,255,255,.88);
  text-decoration: none; font-size: 13px; border-left: 3px solid transparent;
}
#nav a:hover { background: rgba(255,255,255,.08); }
#nav a.active { background: rgba(255,255,255,.13); border-left-color: #fff; font-weight: 600; }
#nav .ic { width: 18px; text-align: center; opacity: .9; }

/* ---------- main ---------- */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border-bottom: 1px solid var(--line); padding: 12px 22px;
  position: sticky; top: calc(48px + env(safe-area-inset-top)); z-index: 20;
}
#page-title { font-size: 19px; font-weight: 700; color: var(--teal-dark); }
.topbar-right { display: flex; gap: 10px; align-items: center; }
#view { padding: 20px 22px 60px; }

/* ---------- generic UI ---------- */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px;
  padding: 7px 14px; font-size: 13px; cursor: pointer; font-family: inherit; font-weight: 500;
}
.btn:hover { border-color: var(--teal); color: var(--teal-dark); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.btn.ghost { border: none; background: none; color: var(--teal); padding: 3px 6px; }

select, input, textarea {
  font-family: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink); width: 100%;
}
select:focus, input:focus, textarea:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
#job-filter { width: 220px; }
textarea { resize: vertical; min-height: 70px; }
label { font-size: 11.5px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { font-size: 14px; color: var(--teal-dark); margin-bottom: 10px; }
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .cols-3, .cols-4 { grid-template-columns: 1fr 1fr; } }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 21px; font-weight: 700; font-family: 'DM Sans'; color: var(--teal-dark); }
.stat .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin-top: 2px; }
.stat.good .v { color: var(--good); } .stat.bad .v { color: var(--bad); } .stat.warn .v { color: var(--warn); }

table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; background: var(--card); }
th { background: var(--teal); color: #fff; text-align: left; font-size: 11.5px; text-transform: uppercase;
     letter-spacing: .6px; padding: 9px 12px; font-weight: 600; white-space: nowrap; }
td { padding: 9px 12px; border-top: 1px solid var(--line); font-size: 13px; vertical-align: top; }
tr:hover td { background: #FAFCFC; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.pill.gray  { background: #ECEFF0; color: var(--muted); }
.pill.teal  { background: var(--teal-soft); color: var(--teal-dark); }
.pill.green { background: #E4F2E5; color: var(--good); }
.pill.amber { background: #FCF0DD; color: var(--warn); }
.pill.red   { background: #FBE4E4; color: var(--bad); }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar input[type=search] { width: 240px; }
.empty { padding: 34px; text-align: center; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.right { text-align: right; } .money { font-variant-numeric: tabular-nums; }
a.link { color: var(--teal); cursor: pointer; text-decoration: none; }
a.link:hover { text-decoration: underline; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10,40,44,.45); z-index: 1600;
              display: flex; align-items: flex-start; justify-content: center;
              padding: max(6vh, env(safe-area-inset-top)) 16px 16px; }
.modal { background: #fff; border-radius: 14px; width: 620px; max-width: 100%; max-height: 86vh;
         overflow-y: auto; box-shadow: 0 18px 60px rgba(0,0,0,.25); }
.modal-head { background: var(--teal); color: #fff; padding: 14px 18px; border-radius: 14px 14px 0 0;
              font-family: 'DM Sans'; font-weight: 700; font-size: 15px; display: flex;
              justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 2; }
.modal-head .x { cursor: pointer; opacity: .95; font-size: 20px; line-height: 1; background: rgba(255,255,255,.18);
                 border: none; color: #fff; width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
                 display: flex; align-items: center; justify-content: center; margin: -4px -6px -4px 8px; }
.modal-head .x:hover, .modal-head .x:active { background: rgba(255,255,255,.32); }
.modal-body { padding: 18px; }
@media (max-width: 640px) {
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .modal-head { padding-top: max(14px, env(safe-area-inset-top)); border-radius: 16px 16px 0 0; }
  .modal-foot { padding-bottom: max(18px, calc(env(safe-area-inset-bottom) + 8px)); position: sticky; bottom: 0;
                background: #fff; border-top: 1px solid var(--line); padding-top: 12px; }
}
.modal .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .form-grid .full { grid-column: 1 / -1; }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; padding: 0 18px 18px; }
.modal-foot .grow { flex: 1; }

/* ---------- toast ---------- */
#toast { position: fixed; bottom: 22px; right: 22px; z-index: 1800; display: flex; flex-direction: column; gap: 8px; }
.toast-item { background: var(--teal-dark); color: #fff; padding: 10px 16px; border-radius: 10px;
              font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.25); animation: fadein .2s; }
.toast-item.err { background: var(--bad); }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

/* ---------- kanban (leads) ---------- */
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: start; }
.kan-col { background: #EDF2F2; border-radius: var(--radius); padding: 10px; }
.kan-col h4 { font-size: 12px; color: var(--teal-dark); text-transform: uppercase; letter-spacing: .8px;
              display: flex; justify-content: space-between; margin-bottom: 8px; }
.kan-card { background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--teal);
            border-radius: 8px; padding: 9px 10px; margin-bottom: 8px; cursor: grab; font-size: 12.5px; }
.kan-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.08); }
.kan-card.dragging { opacity: .45; cursor: grabbing; }
.kan-col.drop-target { outline: 2px dashed var(--teal); outline-offset: -2px; background: #E3F0F1; }
.kan-card .t { font-weight: 600; margin-bottom: 3px; }

/* ---------- cost inbox ---------- */
.ci-drop { border: 2px dashed var(--line); border-radius: 12px; padding: 20px; text-align: center;
  background: #F7FAFA; display: flex; flex-direction: column; gap: 6px; align-items: center; transition: all .15s; }
.ci-drop.over { border-color: var(--teal); background: #E9F3F3; }
.ci-card { display: flex; gap: 14px; align-items: flex-start; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; margin-top: 10px; flex-wrap: wrap; }
.ci-thumb { width: 84px; height: 84px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.ci-thumb.ci-doc { font-size: 34px; text-decoration: none; background: #F0F4F4; }
.ci-fields { flex: 1; min-width: 260px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 10px; }
.ci-fields label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); margin-bottom: 2px; }
.ci-fields input, .ci-fields select { width: 100%; padding: 6px 8px; font-size: 13px; }
.ci-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; min-width: 120px; }
@media (max-width: 640px) { .ci-fields { grid-template-columns: repeat(2, 1fr); } .ci-actions { width: 100%; align-items: stretch; } }
.ci-table tr[data-open]:hover { background: #F3F8F8; }
.ci-mini { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; background: #F0F4F4; font-size: 18px; }
.ci-bill { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 6px; background: #E9F3F3; border: 1px solid #cfe2e2; font-size: 17px; }
.ci-pager { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 4px 2px; }

/* Selections — allowance cart */
.allow-box { background: #F4F8F8; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.allow-box.over { background: #FCF2F2; border-color: #f2c9c9; }
.allow-nums { display: flex; gap: 18px; flex-wrap: wrap; }
.allow-nums > div { display: flex; flex-direction: column; }
.allow-nums .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.allow-nums b { font-size: 17px; font-family: 'DM Sans', Inter, sans-serif; }
.allow-nums b.good { color: var(--good); } .allow-nums b.bad { color: var(--bad); }
.allow-bar { height: 8px; border-radius: 5px; background: #e2eaea; overflow: hidden; margin-top: 8px; }
.allow-bar i { display: block; height: 100%; transition: width .3s; }
.pick-head { font-family: 'DM Sans', Inter, sans-serif; font-weight: 700; font-size: 12.5px; color: var(--teal-dark); margin-bottom: 4px; }
.pick-list { margin-top: 8px; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.pick-row:last-child { border-bottom: none; }
.pick-row img, .pick-noimg { width: 46px; height: 46px; border-radius: 6px; object-fit: contain; background: #fff;
  border: 1px solid var(--line); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.pick-x { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.pick-x:hover { background: #f0dede; color: var(--bad); }
.qty-wrap { display: flex; flex-direction: column; align-items: center; font-size: 9.5px; text-transform: uppercase;
  color: var(--muted); letter-spacing: .3px; gap: 2px; }
.qty-in { width: 52px; padding: 5px 4px; text-align: center; font-size: 14px; border: 1px solid var(--line); border-radius: 6px; }
.sel-summary { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.sel-prog { flex: 1; max-width: 220px; height: 7px; border-radius: 5px; background: #e2eaea; overflow: hidden; }
.sel-prog i { display: block; height: 100%; background: var(--good); transition: width .3s; }
/* product detail page */
.pd { max-width: 560px; margin: 0 auto; }
.pd-img { text-align: center; background: #fff; border-radius: 10px; padding: 12px; border: 1px solid var(--line); }
.pd-img img { max-width: 100%; max-height: 340px; object-fit: contain; }
.pd-img.pd-noimg { font-size: 64px; padding: 40px; }
.pd-title { font-family: 'DM Sans', Inter, sans-serif; font-size: 19px; margin: 14px 0 4px; line-height: 1.3; }
.pd-price { font-size: 26px; font-weight: 700; color: var(--teal-dark); font-family: 'DM Sans', Inter, sans-serif; }
.pd-allow { margin: 10px 0; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; background: #EAF6F0; color: #1c6b45; }
.pd-allow.over { background: #FCF2F2; color: var(--bad); }
.pd-meta { color: var(--muted); font-size: 13px; margin: 8px 0; }
.pd-desc { font-size: 14px; line-height: 1.6; color: #3c5158; }
.pd-link { display: inline-block; margin-top: 8px; font-size: 13.5px; color: var(--teal); font-weight: 600; }
.pd-gallery { display: flex; gap: 6px; overflow-x: auto; margin: 8px 0 2px; padding-bottom: 2px; }
.pd-gallery img { width: 54px; height: 54px; object-fit: contain; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; cursor: pointer; flex-shrink: 0; }
.pd-gallery img.on { border-color: var(--teal); border-width: 2px; }
.pd-rating { color: #b8860b; font-weight: 600; font-size: 14px; margin: 6px 0; }
.pd-hl { margin: 8px 0 8px 18px; padding: 0; font-size: 13.5px; line-height: 1.6; color: #3c5158; }
.pd-specs-h { font-family: 'DM Sans', Inter, sans-serif; font-weight: 700; font-size: 13px; color: var(--teal-dark);
  margin: 12px 0 4px; }
.pd-specs { width: 100%; font-size: 13px; border-collapse: collapse; }
.pd-specs td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pd-specs td:first-child { color: var(--muted); width: 42%; }
/* office product quick-view (stacks over the search modal) */
.qv-back { position: fixed; inset: 0; background: rgba(10,40,44,.5); z-index: 1700; display: flex;
  align-items: flex-start; justify-content: center; padding: max(6vh, env(safe-area-inset-top)) 12px 12px; }
.qv-card { background: #fff; border-radius: 14px; width: 560px; max-width: 100%; max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: 0 18px 60px rgba(0,0,0,.35); overflow: hidden; }
.qv-head { background: var(--teal); color: #fff; padding: 13px 18px; font-family: 'DM Sans'; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center; }
.qv-head .x, .qv-x { background: rgba(255,255,255,.18); border: none; color: #fff; width: 34px; height: 34px;
  border-radius: 50%; font-size: 18px; cursor: pointer; flex-shrink: 0; }
.qv-body { padding: 16px; overflow-y: auto; }
.qv-foot { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line);
  padding-bottom: max(12px, calc(env(safe-area-inset-bottom) + 6px)); }
.qv-foot .grow { flex: 1; }
@media (max-width: 640px) {
  .qv-back { padding: 0; align-items: flex-end; }
  .qv-card { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .qv-head { padding-top: max(13px, env(safe-area-inset-top)); }
}
/* required warning + builder note */
.req-warn { background: #FFF6E6; border: 1px solid #f0d9a8; color: #8a6100; border-radius: 8px;
  padding: 9px 12px; font-size: 13px; margin-bottom: 12px; }
.cnote-label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
.cnote { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
  font-family: inherit; resize: vertical; }
/* compare */
.cmp-toggle { position: absolute; top: 6px; right: 6px; background: rgba(255,255,255,.9); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 6px; font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 3px; }
.choice-card { position: relative; }
#cmp-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 350; background: #fff; border: 1px solid var(--line); border-radius: 30px; box-shadow: 0 8px 28px rgba(0,0,0,.28);
  padding: 8px 10px; display: flex; gap: 8px; }
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.cmp-col { border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; }
.cmp-col img, .cmp-col .cmp-noimg { width: 100%; height: 130px; object-fit: contain; background: #fff; margin-bottom: 8px; }
.cmp-col .cmp-noimg { display: flex; align-items: center; justify-content: center; font-size: 40px; }
.cmp-col b { display: block; font-size: 13.5px; line-height: 1.3; margin-bottom: 4px; }
.cmp-price { font-size: 20px; font-weight: 700; color: var(--teal-dark); font-family: 'DM Sans', Inter, sans-serif; }
.cc-view { font-size: 12px; color: var(--teal); font-weight: 600; margin-top: 4px; }
.cc-rating { font-size: 11.5px; color: #b8860b; font-weight: 700; margin-bottom: 2px; }
/* Receipt detail modal (Buildertrend-style) */
.rc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.rc-left label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin: 8px 0 3px; }
.rc-left input, .rc-left select, .rc-left textarea { width: 100%; }
.rc-row { display: flex; gap: 12px; } .rc-row > div { flex: 1; min-width: 0; }
.rc-section { font-family: 'DM Sans'; font-weight: 700; color: var(--teal-dark); font-size: 14px;
  padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.rc-right { background: #F4F7F7; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.rc-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700;
  font-size: 13px; color: var(--teal-dark); margin-bottom: 8px; }
.rc-view { overflow: auto; max-height: 64vh; text-align: center; }
.rc-items { width: 100%; font-size: 12.5px; } .rc-items th { font-size: 10.5px; }
.rc-items input, .rc-items select { padding: 4px 6px; font-size: 12px; margin: 1px 0; }
.rc-items .li-desc, .rc-items .li-cc { width: 100%; } .rc-items .num { text-align: right; }
.rc-items .li-unit { width: 54px; } .rc-total td { border-top: 2px solid var(--line); }
.rc-amtrow { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.rc-amtrow label { margin: 0; white-space: nowrap; } .rc-amtrow input { max-width: 160px; }
@media (max-width: 820px) { .rc-grid { grid-template-columns: 1fr; } }

/* ---------- gantt ---------- */
.gantt { overflow-x: auto; }
.gantt-inner { min-width: 700px; }
.gantt-row { display: grid; grid-template-columns: 210px 1fr; align-items: center; gap: 8px; padding: 3px 0; }
.gantt-label { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.gantt-label:hover { color: var(--teal); }
.gantt-track { position: relative; height: 24px; background: #F0F4F4; border-radius: 5px; }
.gantt-bar { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; background: var(--teal);
             color: #fff; font-size: 10.5px; line-height: 18px; padding: 0 7px; overflow: hidden;
             white-space: nowrap; cursor: pointer; min-width: 8px; }
.gantt-bar .done { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.28); }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); z-index: 5; }
.gantt-baseline { position: absolute; top: 16px; height: 5px; background: #B9C6C8; border-radius: 3px; }
.cal-cell.nonwork { background: #EEF1F1; }
.gantt-months { position: relative; height: 20px; margin-left: 218px; font-size: 10.5px; color: var(--muted); }
.gantt-months span { position: absolute; border-left: 1px solid var(--line); padding-left: 4px; }

/* ---------- files ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.photo-card img { width: 100%; height: 110px; object-fit: cover; display: block; }
.photo-card .cap { padding: 6px 8px; font-size: 11px; }

/* ---------- progress bar ---------- */
.bar { height: 8px; background: #E8EEEE; border-radius: 6px; overflow: hidden; }
.bar > div { height: 100%; background: var(--teal); border-radius: 6px; }

.section-title { font-family: 'DM Sans'; font-weight: 700; font-size: 15px; color: var(--teal-dark);
                 margin: 22px 0 10px; }
.detail-band { background: var(--teal); color: #fff; border-radius: var(--radius); padding: 14px 18px;
               display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.detail-band h2 { font-size: 18px; }
.detail-band .sub { font-size: 12px; opacity: .85; }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 16px 0 14px; flex-wrap: wrap; }
.tabs button { border: none; background: none; padding: 8px 13px; font-size: 13px; cursor: pointer;
               color: var(--muted); font-family: inherit; font-weight: 600; border-bottom: 2px solid transparent;
               margin-bottom: -2px; }
.tabs button.active { color: var(--teal-dark); border-bottom-color: var(--teal); }

/* ---------- mobile app layout ---------- */
#nav-toggle { display: none; border: none; background: none; font-size: 22px; color: var(--teal-dark);
              cursor: pointer; padding: 2px 8px 2px 0; }
#nav-backdrop { display: none; }

/* below 1150px (landscape phones, tablets) the desktop top-nav can't fit — the
   drawer + hamburger take over, and search moves behind the topbar 🔍 button */
@media (max-width: 1150px) {
  #nav-toggle { display: block; color: #fff; font-size: 20px; padding: 4px 10px 4px 2px; }
  #tn-menus, #gs-wrap { display: none; }
  .tn-brand span { font-size: 14px; }
  #sidebar { display: flex; position: fixed; left: 0; top: 0; bottom: 0; z-index: 99; width: 250px;
             padding-top: env(safe-area-inset-top);
             transform: translateX(-105%); transition: transform .22s ease; box-shadow: 4px 0 24px rgba(0,0,0,.25); }
  body.nav-open #sidebar { transform: translateX(0); }
  body.nav-open #nav-backdrop { display: block; position: fixed; inset: 0;
             background: rgba(10,40,44,.45); z-index: 80; }
  #msearch-btn { display: inline-flex; }
}
@media (max-width: 900px) {
  #topbar { padding: 10px 14px; }
  #page-title { font-size: 16px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #job-filter { width: 130px; }
  #view { padding: 14px 12px 80px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .stat .v { font-size: 17px; }
  .modal { width: 100%; max-height: 92vh; border-radius: 12px; }
  .modal .form-grid { grid-template-columns: 1fr; }
  .modal-back { padding: 3vh 8px; }
  .toolbar input[type=search] { width: 100%; }
  .kanban { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  th, td { padding: 7px 8px; font-size: 12px; }
  /* iOS: 16px inputs prevent auto-zoom on focus */
  select, input, textarea { font-size: 16px; }
}
@media (max-width: 560px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .detail-band { flex-direction: column; align-items: flex-start; }
}

/* ---------- landing dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: 1fr 310px; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }

.dash3 { display: grid; grid-template-columns: 235px minmax(0,1fr) 300px; gap: 14px; align-items: start; }
@media (max-width: 1250px) { .dash3 { grid-template-columns: minmax(0,1fr) 300px; } .jobs-rail { display: none; } }
@media (max-width: 1100px) { .dash3 { grid-template-columns: 1fr; } }

.jobs-rail { position: sticky; top: 118px; max-height: calc(100vh - 132px); overflow-y: auto; padding: 12px; }
.jr-card { border-left: 4px solid var(--teal); background: #FAFCFC; border-radius: 8px;
           padding: 10px 12px; margin-bottom: 6px; font-size: 12.5px; }
.jr-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px;
           font-size: 12.5px; cursor: pointer; }
.jr-item:hover { background: var(--teal-soft); }
.jr-item.sel { background: var(--teal-soft); color: var(--teal-dark); font-weight: 600; }
.jr-dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; }

.av { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
      border-radius: 50%; background: var(--teal); color: #fff; font-size: 11px; font-weight: 700;
      vertical-align: middle; flex: 0 0 30px; }
.act-day { font-family: 'DM Sans'; font-weight: 700; font-size: 14px; color: var(--teal-dark);
           margin: 14px 0 6px; }
.act-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.dash-ok { text-align: center; padding: 18px 6px; font-size: 26px; }
.dash-ok .muted { margin-top: 4px; }
.ag-day { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ag-day.today .ag-date b { background: var(--teal); color: #fff; }
.ag-date { flex: 0 0 52px; text-align: center; }
.ag-date b { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
             border-radius: 50%; font-family: 'DM Sans'; font-size: 15px; background: var(--teal-soft);
             color: var(--teal-dark); }
.ag-date span { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.ag-items { flex: 1; min-width: 0; }
.ag-item { font-size: 12.5px; padding: 2px 0; }
.ag-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--teal);
          margin-right: 6px; }
.ag-dot.todo { background: var(--warn); }

/* ---------- on-plan takeoff ---------- */
.tk-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.tk-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .tk-wrap { grid-template-columns: 1fr; } }
.tk-canvas-box { border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
                 overflow: auto; max-height: calc(100vh - 250px); }
#tk-canvas { display: block; cursor: crosshair; }
.tk-side { position: sticky; top: 118px; max-height: calc(100vh - 132px); overflow-y: auto; }
/* The live readout is the number you watch while you trace — it must never clip.
   As a plain .pill it inherited white-space:nowrap and the 280px side panel cut it
   mid-word ("768.73 sf · perimeter 112.07 lf (enter depth at sa…"). */
#tk-live { display: block; white-space: normal; line-height: 1.5; padding: 5px 10px; font-size: 12px; }
.sheet-card:hover { border-color: var(--teal); }
.scale-grid { display: flex; flex-wrap: wrap; gap: 6px; }

.comments { margin-top: 10px; }
.comment { border-left: 3px solid var(--teal-soft); padding: 6px 10px; margin-bottom: 8px; background: #FAFCFC;
           border-radius: 0 8px 8px 0; font-size: 12.5px; }
.comment .who { font-weight: 600; color: var(--teal-dark); font-size: 11.5px; }

/* Cost Inbox: pulsing indicator while AI is reading a receipt */
.ai-reading { animation: aiPulse 1.2s ease-in-out infinite; }
@keyframes aiPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* Searchable dropdowns (App.searchify): type-ahead over long selects like cost codes */
.ss-wrap { position: relative; }
.ss-wrap::after { content: "▾"; position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
                  pointer-events: none; color: #7a8a90; font-size: 12px; }
.ss-input { width: 100%; padding-right: 28px; }
.ss-list { position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 600;
  background: var(--card, #fff); border: 1px solid var(--line, #dde3e6); border-radius: 8px;
  max-height: 260px; overflow: auto; box-shadow: 0 10px 28px rgba(10, 40, 44, .18); }
.ss-opt { padding: 7px 11px; cursor: pointer; font-size: 13px; }
.ss-opt:hover { background: rgba(14, 107, 114, .08); }
.ss-opt.on { background: rgba(14, 107, 114, .13); font-weight: 600; }
.ss-none { padding: 9px 11px; color: #7a8a90; font-size: 12.5px; }

/* Floating "+" quick-create button + its action sheet */
#fab { position: fixed; right: 18px; bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
       width: 56px; height: 56px; border-radius: 50%; border: none; background: var(--teal);
       color: #fff; font-size: 30px; line-height: 1; cursor: pointer; z-index: 90;
       box-shadow: 0 6px 20px rgba(10, 40, 44, .35); transition: transform .18s ease, background .18s; }
#fab:hover { background: var(--teal-dark, #0a555b); }
#fab.open { transform: rotate(45deg); }
#fab-menu { position: fixed; right: 18px; bottom: max(84px, calc(env(safe-area-inset-bottom) + 78px));
            display: flex; flex-direction: column; gap: 6px; z-index: 90; }
.fab-opt { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line);
           background: #fff; border-radius: 24px; padding: 9px 16px 9px 11px; font-size: 13.5px;
           font-weight: 600; cursor: pointer; box-shadow: 0 4px 14px rgba(10, 40, 44, .18);
           color: var(--ink, #1c2b2e); white-space: nowrap; }
.fab-opt span { font-size: 17px; }
.fab-opt:hover { background: #EDF5F5; border-color: var(--teal); }

/* Dashboard stat cards that open a breakdown popup */
.stat.clickable { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.stat.clickable:hover { box-shadow: 0 4px 14px rgba(10, 40, 44, .12); transform: translateY(-1px); }

/* Bills list: group separators (unpaid pinned on top) */
.bl-sep td { background: #EDF2F2; color: var(--muted); font-size: 10.5px; font-weight: 700;
             text-transform: uppercase; letter-spacing: .8px; padding: 5px 12px; }
.bl-sep.warn td { background: #FBF3E4; color: #8a5b00; }

/* Bills: one line per vendor (statement-style) — expands to the individual charges */
.bl-vend td { background: #F4F8F8; cursor: pointer; border-top: 2px solid var(--line); }
.bl-vend:hover td { background: #ECF3F3; }
.bl-vend .car { display: inline-block; width: 14px; color: var(--muted); }
.bl-sub td:first-child { padding-left: 26px; color: var(--muted); }
.rec-diff { font-weight: 700; }
.rec-diff.ok { color: #1a7f37; }
.rec-diff.bad { color: #b42318; }
/* Dashboard activity feed: compact box with its own scrollbar — roughly a dozen rows
   visible, the rest scroll inside, so the feed never stretches the page */
.act-scroll { max-height: clamp(320px, 48vh, 560px); overflow-y: auto;
  overscroll-behavior: contain; padding-right: 6px; }

/* Training Academy: big bubble video cards */
.vid-head { display: flex; align-items: flex-start; gap: 14px; justify-content: space-between;
  background: linear-gradient(120deg, #0E6B72, #0A555B); color: #fff; border-radius: 16px;
  padding: 16px 20px; margin-top: 8px; }
.vid-head h3 { color: #fff; margin: 0 0 4px; }
.vid-head .small { color: #d7ecea; line-height: 1.6; max-width: 780px; }
.vid-head .vh-count { white-space: nowrap; font-size: 12px; font-weight: 700; color: #fff;
  background: rgba(255,255,255,.16); padding: 6px 12px; border-radius: 999px; }
.vid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin: 14px 0 26px; }
.vid-card { background: #fff; border: 1.5px solid var(--line); border-radius: 18px;
  padding: 18px 16px 14px; cursor: pointer; position: relative;
  transition: box-shadow .18s, transform .18s, border-color .18s; }
.vid-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(10,40,44,.16);
  border-color: var(--teal); }
.vid-card .vc-ico { font-size: 34px; line-height: 1; margin-bottom: 10px; }
.vid-card .vc-name { font-weight: 700; font-size: 15px; margin-bottom: 3px; }
.vid-card .vc-meta { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.vid-card .vc-play { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px;
  font-weight: 700; color: #fff; background: var(--teal); border-radius: 999px; padding: 7px 14px; }
.vid-card.done { background: #F1FAF7; border-color: #BFE5D8; }
.vid-card.done .vc-play { background: #E2F3EC; color: #177A55; }
.vid-card .vc-check { position: absolute; top: 12px; right: 14px; font-size: 17px; }
.vid-card .vc-tag { position: absolute; top: 12px; right: 14px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase; color: #0A555B; background: #E3F1F0;
  padding: 3px 9px; border-radius: 999px; }
@media (max-width: 640px) { .vid-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .vid-head { flex-direction: column; gap: 8px; } }

/* "How was this paid?" chooser — card-style rows; beat the global form-label styling */
.pm-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 7px;
          border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.pm-row:hover { background: #F2F7F7; border-color: var(--teal); }
.pm-row:has(input[type=radio]:checked) { background: #EDF5F5; border-color: var(--teal); }
.pm-row input[type=radio] { margin: 0; width: 16px; height: 16px; accent-color: var(--teal); flex-shrink: 0; }
.pm-row label { margin: 0; font-size: 14px; font-weight: 600; color: inherit;
                text-transform: none; letter-spacing: 0; display: inline; cursor: pointer; }
.pm-row #pm-num { width: 150px; margin-left: auto; padding: 6px 9px; }

/* Docs & Photos: folder cards (photos grouped per job + folder) */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 12px; }
.fol-card { background: var(--card, #fff); border: 1px solid var(--line); border-radius: 10px;
            overflow: hidden; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.fol-card:hover { box-shadow: 0 5px 16px rgba(10, 40, 44, .16); transform: translateY(-1px); }
.fol-card img { width: 100%; height: 108px; object-fit: cover; display: block; background: #EDF2F2; }
.fol-cap { display: flex; justify-content: space-between; align-items: center; gap: 8px;
           padding: 8px 10px; font-size: 12.5px; }

/* Global loading spinner: teal ring centered on screen while the server is working */
#net-spin { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
            z-index: 9999; pointer-events: none; opacity: 0; transition: opacity .2s ease; }
#net-spin .chip { background: rgba(255, 255, 255, .94); border-radius: 50%; padding: 11px;
                  box-shadow: 0 8px 28px rgba(10, 40, 44, .28); border: 1px solid var(--line); }
#net-spin .ring { width: 46px; height: 46px; border-radius: 50%; box-sizing: border-box;
                  border: 5px solid #DCE9EA; border-top-color: var(--teal);
                  animation: netspin .75s linear infinite; }
@keyframes netspin { to { transform: rotate(360deg); } }

/* Receipt lines: select-several + bulk cost-code bar */
.rc-items .li-check { width: 30px; text-align: center; }
.rc-items .li-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--teal); }
.rc-bulk { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--teal-soft, #e3eff0);
           border: 1px solid var(--teal); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; }
.rc-bulk select, .rc-bulk .ss-wrap { flex: 1; min-width: 220px; }

/* Chip multi-pick (assign to several people at once) */
.mp-wrap { display: flex; flex-direction: column; gap: 6px; }
.mp-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 22px; }
.mp-chip { background: var(--teal-soft, #e3eff0); color: var(--teal-dark, #0e6b72); border-radius: 14px;
           padding: 3px 10px; font-size: 12.5px; display: inline-flex; gap: 7px; align-items: center; }
.mp-chip a { cursor: pointer; color: inherit; font-weight: 700; font-size: 11px; }
.mp-chip a:hover { color: #b3423a; }
.mp-row { display: flex; gap: 8px; }
.mp-row select, .mp-row input { flex: 1; min-width: 0; }

/* Top-bar back button: lights up whenever there's somewhere to go back to */
#nav-back { background: none; border: 1px solid var(--line, #dde3e6); border-radius: 8px;
  width: 34px; height: 34px; font-size: 17px; cursor: pointer; color: #9aabaf;
  margin-right: 10px; flex-shrink: 0; line-height: 1; transition: all .15s; }
#nav-back.can { color: var(--teal-dark, #0A555B); border-color: var(--teal, #0E6B72);
  background: rgba(14, 107, 114, .07); }
#nav-back.can:hover { background: rgba(14, 107, 114, .15); }

/* Accounting summary cards are drill-downs */
.stat.gl-click { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.stat.gl-click:hover { box-shadow: 0 4px 14px rgba(10, 40, 44, .14); transform: translateY(-1px); }

/* Notification bell */
#notif-bell { position: relative; background: none; border: 1px solid var(--line, #dde3e6);
  border-radius: 8px; width: 36px; height: 34px; font-size: 15px; cursor: pointer; flex-shrink: 0; }
#notif-bell:hover { background: rgba(14, 107, 114, .08); }
#notif-badge { position: absolute; top: -7px; right: -7px; background: #B26A00; color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 10px; padding: 1px 5px; min-width: 16px;
  line-height: 1.5; pointer-events: none; }

/* No blinking text caret on non-editable UI — clicking tabs/cards/rows focuses
   elements and some browser modes blink an insertion caret there. Real typing
   fields keep their caret. */
*:not(input):not(textarea):not([contenteditable="true"]) { caret-color: transparent; }
input, textarea, [contenteditable="true"] { caret-color: auto; }

/* topbar 🔍 (shown under 1150px): opens the real global search in a top overlay */
#msearch-btn { display: none; background: none; border: none; font-size: 17px; cursor: pointer;
  padding: 4px 8px; align-items: center; }
#msearch-ov { position: fixed; inset: 0; background: rgba(10,40,44,.45); z-index: 1500; display: none; }
#msearch-bar { background: var(--teal); padding: calc(12px + env(safe-area-inset-top)) 14px 12px; }
body.msearch-open #gs-wrap { display: block !important; }
#msearch-bar #global-search { width: 100%; font-size: 16px; padding: 11px 14px; }
#msearch-bar #gs-results { left: 0; right: 0; }
@media (max-width: 1150px) { #msearch-btn { display: inline-flex; } }
