:root {
  --side: #0f1b33; --side-2: #1a2a4d; --side-text: #c9d3e8; --accent: #f59e0b; --brand: #2451c7;
  --bg: #f3f5f9; --card: #fff; --text: #172033; --muted: #6a7489; --line: #e3e8f0;
  --good: #15803d; --warn: #b45309; --bad: #c02626; --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; overflow-wrap: break-word; }
img, video, canvas, iframe { max-width: 100%; }
a { color: var(--brand); }
.boot { padding: 60px 20px; text-align: center; color: var(--muted); }
h1 { font-size: 24px; margin: 4px 0 16px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 22px 0 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; }
.right { text-align: right; }

/* ---------- Office layout: sidebar ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 240px; flex-shrink: 0; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 30; }
.side-brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; color: #fff; border-bottom: 1px solid #ffffff14; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #f97316); display: grid; place-items: center; font-weight: 800; color: var(--side); font-size: 18px; }
.side-org { font-size: 12px; opacity: .7; }
.side-nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--side-text); text-decoration: none; font-size: 14px; margin-bottom: 2px; }
.side-nav a:hover { background: #ffffff0f; color: #fff; }
.side-nav a.on { background: var(--side-2); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.side-nav .ico { width: 20px; text-align: center; }
.side-nav .count { margin-left: auto; }
.side-foot { padding: 14px 16px; border-top: 1px solid #ffffff14; }
.count { background: var(--accent); color: var(--side); border-radius: 10px; padding: 1px 7px; font-size: 12px; font-weight: 700; text-decoration: none; }
.linkbtn { background: none; border: none; color: var(--side-text); padding: 4px 0; cursor: pointer; text-decoration: underline; font-size: 13px; }
.linkbtn.light { color: #fff; }
.content { flex: 1; min-width: 0; }
.content main { padding: 24px 28px; max-width: 1280px; }
.mobile-top { display: none; }
.scrim { position: fixed; inset: 0; background: #0b122080; z-index: 25; }

@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 30px #0006; }
  .side.open { transform: none; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--side); color: #fff; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
  .burger { background: none; border: none; color: #fff; font-size: 22px; padding: 2px 6px; }
  .content main { padding: 14px; }
}

/* ---------- Phone layout: operatives and customers ---------- */
.phone { min-height: 100vh; display: flex; flex-direction: column; }
.phone-top { background: var(--side); color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 20; }
.phone-main { flex: 1; padding: 16px; padding-bottom: 96px; width: 100%; max-width: 720px; margin: 0 auto; }
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
.bottomnav button { flex: 1; max-width: 180px; background: none; border: none; border-radius: 0; padding: 8px 4px 10px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
.bottomnav .ico { font-size: 20px; }
.bottomnav button.on { color: var(--brand); font-weight: 700; }
.bottomnav .count { position: absolute; top: 4px; left: calc(50% + 8px); }
/* v30: phones show at most 5 buttons (the rest under "More"), each label on one line, never cut off. */
.bottomnav button { min-width: 0; }
.bottomnav .lbl { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.moresheet { position: fixed; left: 8px; right: 8px; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 22; background: #fff; border-radius: 16px;
  box-shadow: 0 10px 40px #0004; padding: 8px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; max-height: 60vh; overflow-y: auto; }
.moresheet button { background: none; border: none; border-radius: 12px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; color: var(--ink, #172033); position: relative; }
.moresheet button.on { background: #e8f0ff; color: var(--brand); font-weight: 700; }
.moresheet .ico { font-size: 24px; }
.moresheet .count { position: absolute; top: 6px; right: 14px; }
.moresheet .lbl { text-align: center; line-height: 1.2; }
/* Computers and tablets in landscape: the menu becomes a column down the left, every tab in full. */
@media (min-width: 900px) {
  .bottomnav { top: 0; bottom: 0; right: auto; width: 230px; flex-direction: column; justify-content: flex-start; border-top: none; border-right: 1px solid var(--line);
    padding: 76px 10px 16px; overflow-y: auto; overflow-x: hidden; z-index: 19; background: #fff; }
  .bottomnav button { flex: none; min-width: 0; max-width: none; width: 100%; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 14px; font-size: 15px; border-radius: 10px; text-align: left; }
  .bottomnav button:hover { background: #f2f5fa; }
  .bottomnav button.on { background: #e8f0ff; }
  .bottomnav .ico { font-size: 19px; width: 24px; text-align: center; }
  .bottomnav .count { position: static; margin-left: auto; }
  .bottomnav .lbl { font-size: 15px; overflow: visible; }
  .phone-main { margin-left: 230px; max-width: 900px; padding: 24px 32px 40px; }
}
.jobcard { margin-bottom: 10px; }
.jobtitle { font-size: 17px; font-weight: 600; margin: 4px 0; }
.bigbuttons { display: grid; gap: 10px; margin-top: 14px; }
button.big, .btn.big { padding: 14px 16px; font-size: 16px; font-weight: 600; width: 100%; text-align: center; }

/* ---------- Charts ---------- */
.chart { position: relative; }
.chart .tip { position: absolute; top: 0; transform: translate(-50%, -4px); background: #0f1b33; color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 12px; pointer-events: none; white-space: nowrap; box-shadow: 0 4px 12px #0003; }
.chart .tip div { color: #c9d3e8; }

/* ---------- Tenant needs, RAMS ---------- */
.needs { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { margin: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 20px; font-size: 13px; color: var(--text); cursor: pointer; background: #fff; }
.chip.on { background: #fff1d6; border-color: #f5c56b; }
.chip input { display: none; }
.tenant-card { border-left: 4px solid var(--warn); background: #fffaf0; }
.tenant-card .need { display: inline-block; background: #fde4e4; color: #8a1414; border-radius: 14px; padding: 3px 10px; font-size: 13px; font-weight: 600; margin: 3px 4px 0 0; }
.rams-card.todo { border-left: 4px solid var(--bad); }
.rams-card.ok { border-left: 4px solid var(--good); }
.hz { border-bottom: 1px solid var(--line); padding: 8px 0; }
.hz:last-child { border-bottom: none; }

/* ---------- Photos ---------- */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { width: 92px; height: 92px; border-radius: 10px; overflow: hidden; background: #eef2f8; display: grid; place-items: center; position: relative; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .tag { position: absolute; bottom: 4px; left: 4px; background: #0f1b33cc; color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 8px; }

/* ---------- Account banner ---------- */
.banner { padding: 10px 28px; font-size: 14px; font-weight: 500; }
.banner.warn { background: #fff4d6; color: #7a4b00; }
.banner.stop { background: #fde4e4; color: #8a1414; }
.banner a { font-weight: 700; margin-left: 6px; }

/* ---------- Clock in/out ---------- */
.clock { margin-bottom: 14px; }
.clock.on { border-left: 4px solid var(--good); }
.clock.off { border-left: 4px solid var(--accent); }
#livemap { height: 420px; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 14px; }
@media (max-width: 600px) { #livemap { height: 300px; } }
/* v34: modern map: soft frame, photo pins (the point sits on the person's location), job pins, tidy popups */
#livemap { box-shadow: 0 6px 24px rgba(15, 27, 51, .12); overflow: hidden; }
.tdpin-wrap { background: none; border: 0; }
.tdpin { position: relative; width: 56px; height: 80px; display: flex; flex-direction: column; align-items: center; filter: drop-shadow(0 3px 6px rgba(0,0,0,.35)); }
.tdpin-head { width: 46px; height: 46px; margin-top: 2px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); display: grid; place-items: center; padding: 3px; box-sizing: border-box; }
.tdpin-head img, .tdpin-head span { width: 38px; height: 38px; border-radius: 50%; transform: rotate(45deg); object-fit: cover; display: grid; place-items: center; background: #1f3864; color: #fff; font: 700 14px system-ui, sans-serif; border: 2px solid #fff; box-sizing: border-box; }
.tdpin-name { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); background: #fff; color: #0f1b33; font: 700 11px system-ui, sans-serif; padding: 2px 7px; border-radius: 10px; white-space: nowrap; border: 1px solid #e2e8f0; }
.tdpin.live .tdpin-head::after { content: ''; position: absolute; inset: -6px; border-radius: 50% 50% 50% 0; border: 3px solid var(--c); opacity: .5; animation: tdpulse 2s ease-out infinite; }
@keyframes tdpulse { 0% { transform: scale(.85); opacity: .6; } 100% { transform: scale(1.35); opacity: 0; } }
.tdjob { width: 30px; height: 38px; display: flex; justify-content: center; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.tdjob-head { width: 28px; height: 28px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); border: 2px solid #fff; display: grid; place-items: center; box-sizing: border-box; }
.tdjob-head span { transform: rotate(45deg); font-size: 13px; }
.leaflet-popup-content-wrapper, .leaflet-tooltip { border-radius: 12px !important; box-shadow: 0 8px 24px rgba(15,27,51,.18) !important; font: 13px system-ui, sans-serif; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.click { cursor: pointer; transition: border-color .15s, transform .15s; }
.card.click:hover { border-color: #b9c6e4; }
.card.click:active { transform: scale(.995); }
.stat { padding: 16px 18px; }
.stat .n { font-size: 28px; font-weight: 750; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat.alert .n { color: var(--bad); }

/* ---------- Forms & buttons ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; font-weight: 500; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid #d5dce8; border-radius: 9px; font: inherit; font-size: 16px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid #2451c733; border-color: var(--brand); }
textarea { min-height: 96px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; padding: 0; vertical-align: -3px; margin-right: 6px; flex-shrink: 0; accent-color: var(--brand); }
button, .btn { font: inherit; font-size: 14px; padding: 9px 14px; border-radius: 9px; border: 1px solid #d5dce8; background: #fff; cursor: pointer; text-decoration: none; color: var(--text); display: inline-block; font-weight: 500; }
button:hover, .btn:hover { border-color: #b9c6e4; }
button.primary, .btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
button.good { background: var(--good); color: #fff; border-color: var(--good); }
button.bad { background: #fff; color: var(--bad); border-color: #f1c4c4; }
button:disabled { opacity: .5; cursor: default; }
.fields { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.error { color: var(--bad); font-size: 14px; margin: 8px 0; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #eef2fa; color: #33456d; white-space: nowrap; }
.badge.Hot, .badge.Emergency, .badge.Overdue, .badge.Today, .badge.Declined { background: #fde4e4; color: var(--bad); }
.badge.Warm, .badge.Urgent, .badge.Waiting, .badge.New { background: #fff1d6; color: var(--warn); }
.badge.Cold { background: #e3edfb; color: #1d4ed8; }
.badge.Won, .badge.Paid, .badge.Complete, .badge.Done, .badge.Accepted, .badge.Booked { background: #dcf3e2; color: var(--good); }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.col { min-width: 260px; flex: 1; background: #e8ecf4; border-radius: var(--radius); padding: 10px; scroll-snap-align: start; }
.col h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 4px 4px 10px; display: flex; justify-content: space-between; }
.col .card { margin-bottom: 8px; padding: 12px; }

/* ---------- Tables ---------- */
.tablewrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; vertical-align: top; }
tr:last-child td { border-bottom: none; }
th { background: #f6f8fc; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
td input, td select { padding: 7px; font-size: 14px; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: #0b122080; display: flex; align-items: flex-start; justify-content: center; z-index: 2000; overflow-y: auto; padding: 24px 10px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 780px; max-height: calc(100vh - 48px); overflow-y: auto; box-sizing: border-box; padding: 20px; box-shadow: 0 20px 50px #0004; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .overlay { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; min-height: 100dvh; max-height: 100vh; max-height: 100dvh; padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); }
  .modal .actions { position: sticky; bottom: 0; background: #fff; padding: 10px 0; }
}

/* ---------- Decision cards ---------- */
.decision { border-left: 4px solid var(--accent); }
.decision.Emergency { border-left-color: var(--bad); }
.decision pre, pre { white-space: pre-wrap; background: #f6f8fc; padding: 10px; border-radius: 8px; font: inherit; font-size: 14px; }

/* ---------- Sign-in ---------- */
.authbox { max-width: 420px; margin: 8vh auto; }
.authbox h1 { text-align: center; }

@media print {
  .side, .mobile-top, .bottomnav, .phone-top, .noprint { display: none !important; }
  .content main { padding: 0; }
}

/* ---------- Public homepage ---------- */
.landing { background: #fff; min-height: 100vh; }
.l-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; padding-top: max(14px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fffffff2; z-index: 5; }
.l-link { margin-right: 10px; text-decoration: none; color: var(--text); font-weight: 500; }
.l-hero { text-align: center; padding: 64px 20px 40px; background: linear-gradient(180deg, #0f1b33, #1a2a4d); color: #fff; }
.l-hero h1 { font-size: clamp(30px, 5vw, 48px); max-width: 800px; margin: 0 auto 14px; line-height: 1.1; }
.l-hero p { color: #c9d3e8; max-width: 640px; margin: 0 auto 22px; font-size: 18px; line-height: 1.5; }
.l-hero .muted { color: #9fb0d0; font-size: 13px; margin-top: 12px; }
.l-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); max-width: 1100px; margin: 40px auto; padding: 0 20px; }
.l-pricing { max-width: 1100px; margin: 0 auto; padding: 30px 20px; }
.l-faq { max-width: 760px; margin: 0 auto; padding: 20px; }
.l-faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.l-faq summary { cursor: pointer; font-weight: 600; }
.l-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.l-foot a { margin-left: 12px; }
.ok { color: var(--good); font-weight: 600; margin: 8px 0; }
.issue-card { border-left: 4px solid var(--brand); }
/* Connected accounts */
.intgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.integ.connected { border-left: 4px solid var(--good); }
.integ.requested { border-left: 4px solid var(--warn, #d97706); }
.integ-body { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.copyline { display: flex; gap: 6px; align-items: center; margin: 4px 0 8px; }
.copyline code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; background: var(--bg, #f5f5f5); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 12px; }
.progress { height: 6px; background: #eef2fa; border-radius: 6px; margin: 8px 0; overflow: hidden; }
.progress div { height: 100%; background: var(--good); }

/* Office assistant chat (views/chat.js) */
.chat-fab { position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 26px; box-shadow: 0 6px 20px #0b122055; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.chat-fab:hover { filter: brightness(1.08); }
.chat-fab .count { position: absolute; top: -2px; right: -2px; }
.chat-panel { position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 380px; max-width: calc(100vw - 24px); height: min(600px, calc(100vh - 40px)); background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px #0b122040; display: flex; flex-direction: column; overflow: hidden; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; background: var(--side); color: #fff; }
.chat-sub { font-size: 12px; color: var(--side-text); }
.chat-icon { background: transparent; border: 0; color: #fff; font-size: 17px; padding: 4px 8px; min-width: 34px; cursor: pointer; border-radius: 8px; }
.chat-icon:hover { background: #ffffff1f; }
.chat-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.chat-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; line-height: 1.4; word-wrap: break-word; }
.chat-msg.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-msg.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg .btn { margin-top: 8px; display: inline-block; white-space: nowrap; }
.chat-tools { margin-top: 4px; display: flex; gap: 10px; font-size: 12px; }
.chat-tools .linkbtn { color: var(--muted); font-size: 12px; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-chips button { font-size: 13px; padding: 6px 10px; border-radius: 999px; }
.chat-input { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); align-items: flex-end; background: var(--card); }
.chat-input textarea { flex: 1; resize: none; min-height: 40px; max-height: 120px; margin: 0; }
.chat-input button { margin: 0; height: 40px; min-width: 42px; padding: 0 10px; }
.chat-mic { font-size: 18px; }
.chat-mic.on { background: var(--bad); color: #fff; animation: chat-pulse 1.2s infinite; }
@keyframes chat-pulse { 50% { box-shadow: 0 0 0 6px #c0262633; } }
@media (max-width: 640px) {
  .chat-fab { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); }
  .chat-panel { inset: 0; width: auto; max-width: none; height: auto; border-radius: 0; border: 0; padding-bottom: env(safe-area-inset-bottom); }
}
@media print { .chat-fab, .chat-panel { display: none; } }

/* v12: field operative portal and staff sign-up */
.statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.statgrid .stat { padding: 12px; text-align: center; }
.steps { display: flex; gap: 6px; margin: 4px 0 8px; }
.stepdot { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: #eef1f6; color: var(--muted); }
.stepdot.on { background: var(--brand); color: #fff; }
.stepdot.done { background: var(--good); color: #fff; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; cursor: pointer; font-weight: 400; }
.choice input { width: auto; margin-top: 3px; }
.row.click { cursor: pointer; }
.reviewgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.reviewgrid img { width: 100%; height: 180px; object-fit: cover; border-radius: 8px; background: #eef1f6; }

/* Side menu sections */
.side-group { margin-top: 6px; }
.side-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px; background: none; color: var(--side-text); font: 600 12px/1.2 inherit; text-transform: uppercase; letter-spacing: .5px; cursor: pointer; opacity: .85; }
.side-head:hover { background: #ffffff0f; color: #fff; opacity: 1; }
.side-head .caret { margin-left: auto; font-size: 11px; }
.side-head .count { margin-left: auto; }
.side-head .count + .caret { margin-left: 6px; }
.side-items { padding-left: 8px; border-left: 1px solid #ffffff1a; margin-left: 18px; }
.side-items a { padding: 8px 10px; }

/* v30 layout polish */
.modal > .row:first-child { flex-wrap: nowrap; position: sticky; top: -20px; background: #fff; z-index: 2; padding: 4px 0 8px; }
.modal > .row:first-child h2 { flex: 1; min-width: 0; }
.modal > .row:first-child button { flex-shrink: 0; }
.fields { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.row > input:not([type=checkbox]):not([type=radio]), .row > select { width: auto; flex: 1 1 160px; min-width: 0; }
.card { min-width: 0; }
table { width: 100%; }
@media (max-width: 600px) {
  h1 { font-size: 21px; }
  .content main, .phone-main { padding-left: 12px; padding-right: 12px; }
  .modal .actions button, .modal .actions .btn { flex: 1 1 auto; }
  .modal > .row:first-child { top: -16px; }
}
/* Phone header: long company names shorten with "…" instead of colliding with the buttons. */
.phone-top { gap: 10px; }
.phone-top > div:first-child { min-width: 0; flex: 1; }
.phone-top > div:first-child b, .phone-top .side-org { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phone-top > .row { flex-shrink: 0; flex-wrap: nowrap; }
@media (max-width: 420px) { .phone-top .fb-label { display: none; } }
@media (min-width: 900px) { .moresheet { display: none; } }
/* Tables that become cards on phones (customer payments), so buttons are never hidden off the side. */
@media (max-width: 600px) {
  .tablewrap:has(table.stack) { border: none; box-shadow: none; overflow: visible; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr:has(th) { display: none; }
  table.stack tr { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; box-shadow: var(--shadow); }
  table.stack td { border: none; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; }
  table.stack td:first-child { text-align: left; display: block; font-weight: 600; }
  table.stack td:last-child:not([data-label]) { display: block; }
  table.stack td:last-child button { width: 100%; margin-top: 4px; }
}

/* ================= v12 premium theme: navy & gold, rotating property scenes ================= */
:root {
  --side: #0b1530; --side-2: #16264f; --gold: #e6b54a; --gold-2: #fde7a6; --gold-3: #b9821f;
  --accent: #e6b54a; --brand: #1f47b8; --bg: #f4f6fb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(11, 21, 48, .05), 0 6px 18px -6px rgba(11, 21, 48, .12);
  --shadow-lg: 0 24px 60px -18px rgba(5, 10, 25, .55);
  font-family: "Plus Jakarta Sans", Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
h1, h2 { letter-spacing: -.02em; }
h1 { font-weight: 800; }

/* Logo + wordmark */
.logo-mark { display: block; flex-shrink: 0; border-radius: 26%; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .6); }
.wordmark { display: inline-flex; flex-direction: column; line-height: 1; }
.wm-name, .side-name { font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.wm-name span, .side-name span { background: linear-gradient(135deg, var(--gold-2), var(--gold) 45%, var(--gold-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wm-tag { font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase; opacity: .65; margin-top: 4px; font-weight: 600; }
.brand-lockup { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 4px 0 6px; }
.brand-lockup .wordmark { align-items: center; }
.brand-lockup .wm-name { font-size: 28px; color: var(--side); }

/* Sidebar polish */
.side { background: linear-gradient(180deg, #0b1530 0%, #0f1d42 60%, #0b1530 100%); box-shadow: 1px 0 0 #ffffff0d, 8px 0 30px -12px rgba(0, 0, 0, .35); }
.side-brand { padding: 20px 16px; background: linear-gradient(180deg, #ffffff08, transparent); border-bottom: 1px solid #e6b54a26; }
.side-name { font-size: 18px; color: #fff; display: block; }
.side-nav a { transition: background .15s, color .15s, transform .15s; }
.side-nav a:hover { transform: translateX(2px); }
.side-nav a.on { background: linear-gradient(90deg, #e6b54a22, #ffffff08); box-shadow: inset 3px 0 0 var(--gold); }
.count { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #0b1530; }

/* Cards & buttons */
.card { border-color: #e6eaf3; transition: box-shadow .2s, transform .2s, border-color .2s; }
.card.click:hover, a > .card:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -14px rgba(11, 21, 48, .3); border-color: #d6ddee; }
.card.stat .n { background: linear-gradient(135deg, #0b1530, #1f47b8); -webkit-background-clip: text; background-clip: text; color: transparent; }
button, .btn { border-radius: 10px; transition: transform .12s, box-shadow .15s, background .15s, border-color .15s; }
button:active:not(:disabled), .btn:active { transform: translateY(1px); }
button.primary, .btn.primary { background: linear-gradient(135deg, #2a56d1, #173a9c); border-color: #173a9c; box-shadow: 0 6px 16px -8px rgba(31, 71, 184, .8); }
button.primary:hover:not(:disabled) { box-shadow: 0 10px 22px -8px rgba(31, 71, 184, .9); }
button.good { background: linear-gradient(135deg, #1a9a4b, #13703a); border-color: #13703a; box-shadow: 0 6px 16px -8px rgba(21, 128, 61, .8); }
button.gold, .btn.gold { background: linear-gradient(135deg, var(--gold-2), var(--gold) 50%, var(--gold-3)); color: #0b1530; border-color: var(--gold-3); font-weight: 700; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #2a56d1 !important; box-shadow: 0 0 0 3px #2a56d126; }

/* Rotating scenes */
.scene-layer { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.8s ease; transform: scale(1.04); }
.scene-layer.on { opacity: 1; animation: scene-drift 16s ease-out both; }
@keyframes scene-drift { from { transform: scale(1.12) translate3d(-1%, 0, 0); } to { transform: scale(1.03) translate3d(1%, 0, 0); } }
@media (prefers-reduced-motion: reduce) { .scene-layer.on { animation: none; } .scene-layer { transition-duration: .4s; } }

/* Full-screen backdrop: only on sign-in / set-up / landing pages */
.scene-backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; display: none; background: #0b1530; }
.scene-backdrop .scene-shade { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(8, 14, 34, .1) 0%, rgba(8, 14, 34, .6) 100%), linear-gradient(180deg, rgba(8, 14, 34, .2), rgba(8, 14, 34, .45)); }
body:has(.authbox) .scene-backdrop, body:has(.landing) .scene-backdrop { display: block; }
body:has(.authbox) #app > :not(.scene-backdrop), body:has(.landing) #app > :not(.scene-backdrop) { position: relative; z-index: 1; }
body:has(.scene-backdrop):has(.authbox) { background: #0b1530; }

/* Glass sign-in cards */
.authbox { position: relative; z-index: 1; background: rgba(255, 255, 255, .9); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); border: 1px solid rgba(255, 255, 255, .55); box-shadow: var(--shadow-lg); border-radius: 22px; padding: 28px 26px; }
.authbox::before { content: ""; position: absolute; inset: 0 22px auto; height: 3px; border-radius: 0 0 4px 4px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
@media (max-width: 480px) { .authbox { margin: 5vh 12px; padding: 22px 18px; } }

/* Landing page over the scenes */
.landing { background: transparent; }
.l-top { background: rgba(11, 21, 48, .55); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid #ffffff1a; color: #fff; }
.l-top .l-link { color: #e3e9f7; }
.l-hero { background: transparent; padding: 110px 20px 90px; text-shadow: 0 2px 18px rgba(0, 0, 0, .45); }
.l-hero h1 { font-family: "Fraunces", Georgia, serif; font-weight: 700; letter-spacing: -.01em; }
.l-hero a { color: var(--gold-2); }
.landing > section:not(.l-hero) { background: var(--bg); }
.l-grid { padding-top: 40px !important; }

/* Hero banner (dashboard, customer portal) */
.scene-hero { position: relative; overflow: hidden; border-radius: 20px; min-height: 190px; margin: 0 0 18px; background: #0b1530; color: #fff; box-shadow: 0 18px 40px -20px rgba(11, 21, 48, .6); isolation: isolate; }
.scene-hero .scene-shade { position: absolute; inset: 0; background: linear-gradient(100deg, rgba(8, 14, 34, .88) 0%, rgba(8, 14, 34, .55) 45%, rgba(8, 14, 34, .1) 100%); }
.scene-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--gold-3), var(--gold-2), var(--gold-3)); }
.scene-hero-in { position: relative; z-index: 1; padding: 30px 28px; max-width: 640px; }
.scene-hero h1 { color: #fff; margin: 0 0 6px; font-family: "Fraunces", Georgia, serif; font-weight: 700; font-size: clamp(26px, 4vw, 36px); line-height: 1.1; text-shadow: 0 2px 14px rgba(0, 0, 0, .4); }
.scene-kicker { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-2); margin-bottom: 10px; padding: 4px 10px; border: 1px solid #e6b54a66; border-radius: 99px; background: rgba(11, 21, 48, .4); }
.scene-sub { margin: 0; color: #dfe6f5; font-size: 15px; }
@media (max-width: 600px) { .scene-hero { min-height: 160px; border-radius: 16px; } .scene-hero-in { padding: 22px 18px; } }

/* ✨ AI price estimate card */
.est-card { margin: 8px 0; padding: 10px 12px; border-radius: 12px; border: 1px solid #ecd9a8; background: linear-gradient(135deg, #fffaf0, #fff6e0); font-size: 14px; }
.est-card summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.est-card summary::-webkit-details-marker { display: none; }
.est-card summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.est-card[open] summary::after { content: "▴"; }
.est-kicker { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-3); margin-right: 6px; }
.est-range { font-size: 16px; color: #0b1530; }
.est-card table { background: #fff; border-radius: 8px; margin-top: 6px; }
.est-empty { display: block; background: #fbfcfe; border-color: var(--line); }
.est-empty button { margin-top: 4px; }
.est-spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--gold); border-right-color: transparent; border-radius: 50%; animation: est-spin .8s linear infinite; vertical-align: -1px; margin-right: 4px; }
@keyframes est-spin { to { transform: rotate(360deg); } }
.est-market { margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: #fff; border: 1px solid #e6eaf3; font-size: 13.5px; line-height: 1.5; }
.supply-pick { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 6px; }
.supply-pick .chip { display: block; border-radius: 10px; padding: 9px 12px; font-size: 14px; }

/* v57: back button in the phone headers */
.backbtn { font-size: 30px !important; line-height: 1; padding: 0 8px 4px !important; }
.phone-top .backbtn { background: none; border: none; color: #fff; flex-shrink: 0; }

/* ---------- v58: new layout ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.content { position: relative; z-index: 1; }
/* Top bar on computers: back, search, + New */
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 15; }
.tb-back { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }
.tb-gap { flex: 1; }
.findbox { position: relative; flex: 1; max-width: 560px; }
.findfield { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; height: 42px; color: var(--muted); margin: 0; font-weight: 400; cursor: text; }
.findfield input { border: 0 !important; box-shadow: none !important; background: transparent; padding: 0; height: 40px; flex: 1; min-width: 0; font-size: 14px; color: var(--text); }
.findkey { font: 600 12px Inter, system-ui, sans-serif; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; background: #fff; }
.findres { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 40px -12px rgba(15, 27, 51, .35); z-index: 60; max-height: 60vh; overflow: auto; padding: 6px; }
.findres a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; color: var(--text); text-decoration: none; min-height: 44px; }
.findres a:hover, .findres a:focus { background: #eef2fb; }
.findkind { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); width: 64px; flex-shrink: 0; }
.findtxt { display: flex; flex-direction: column; min-width: 0; }
.findtxt b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.findtxt small { color: var(--muted); }
.findnone { padding: 12px; color: var(--muted); }
.newbtn { position: relative; }
.newbtn > button { display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 16px; }
.newmenu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 40px -12px rgba(15, 27, 51, .35); z-index: 61; min-width: 190px; padding: 6px; display: flex; flex-direction: column; }
.newmenu a { padding: 10px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; }
.newmenu a:hover { background: #eef2fb; }
.scrim.clear { background: transparent; z-index: 59; }
/* Home: needs you now */
.needs { display: block; background: rgba(255, 255, 255, .96); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 18px; }
.needs h2 { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.needrow { display: flex; align-items: center; gap: 12px; padding: 10px 4px; color: var(--text); text-decoration: none; border-bottom: 1px solid #eef1f6; min-height: 48px; }
.needrow:last-of-type { border-bottom: 0; }
.needrow svg { color: #8a93a6; flex-shrink: 0; }
.needn { min-width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 800; padding: 0 6px; }
.needtxt { flex: 1; display: flex; flex-direction: column; }
.needtxt b { font-weight: 600; } .needtxt small { color: var(--muted); font-size: 13px; }
.tone-blue .needn { background: #e8eefc; color: #2451c7; } .tone-amber .needn { background: #fff3dc; color: #92400e; }
.tone-green .needn { background: #e7f6ec; color: #166534; } .tone-purple .needn { background: #f3e8ff; color: #6b21a8; } .tone-grey .needn { background: #e6eaf3; color: #374151; }
.needclear { margin: 6px 0; color: var(--good); font-weight: 600; }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--text); font-size: 12px; font-weight: 600; text-align: center; padding: 8px 2px; border-radius: 12px; background: var(--bg); min-height: 44px; }
.quick a span { width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; }
/* Phone bottom bar for office staff */
.staffnav { display: none; }
.mt-search { color: #fff; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--side-2); }
.mt-title { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 860px) {
  .topbar { display: none; }
  .staffnav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: rgba(255, 255, 255, .97); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 4px 4px max(6px, env(safe-area-inset-bottom)); }
  .staffnav a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 4px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; min-height: 48px; }
  .staffnav a.on { color: var(--brand); font-weight: 700; }
  .staffnav .count { position: absolute; top: 2px; left: calc(50% + 6px); font-size: 11px; padding: 0 6px; }
  .shell.staff .content main { padding-bottom: 92px; }
  .chat-fab { bottom: calc(76px + env(safe-area-inset-bottom)) !important; }
  .quick a { font-size: 11px; }
}
/* More screen */
.menupage { display: flex; flex-direction: column; gap: 18px; max-width: 760px; }
.menupage .findbox { max-width: none; }
.menupage .findfield { background: #fff; height: 48px; }
.menuhead { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; }
.menudot { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.menutiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 600px) { .menutiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.menutile { background: #fff; border-radius: 12px; padding: 10px 12px; min-height: 52px; display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-size: 14px; font-weight: 600; box-shadow: var(--shadow); }
.menuico { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.menulbl { flex: 1; min-width: 0; }

/* ---------- v58: background photos ---------- */
.photo-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 240px; z-index: 0; pointer-events: none; overflow: hidden; background: #e9edf5; contain: strict; }
@media (max-width: 860px) { .photo-backdrop { left: 0; } }
.phone .photo-backdrop { left: 0; }
.pb-layer { position: absolute; inset: -2%; background-size: cover; background-position: center; opacity: 0; transition: opacity 2.4s ease; will-change: opacity, transform; transform: scale(1.04); backface-visibility: hidden; }
.pb-layer.on { opacity: 1; animation: pb-drift 22s ease-out both; }
@keyframes pb-drift { from { transform: scale(1.09); } to { transform: scale(1.02); } }
/* A soft veil: photos show through, every word stays easy to read. */
.pb-veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(243, 245, 249, .55) 0%, rgba(243, 245, 249, .66) 45%, rgba(243, 245, 249, .76) 100%); }
/* Words straight on the photo get a soft glow so they stay sharp over busy pictures. */
.has-photos .content main > h1, .has-photos .content main > .row h1, .has-photos .content main > p, .has-photos .content main > .muted { text-shadow: 0 0 12px rgba(243, 245, 249, .95), 0 0 2px rgba(243, 245, 249, .9); }
@media (prefers-reduced-motion: reduce) { .pb-layer.on { animation: none; } .pb-layer { transition-duration: .6s; transform: none; } }
.has-photos { background: transparent; }
.has-photos .content main > *, .phone.has-photos .phone-main > * { position: relative; }
.phone.has-photos .phone-main { position: relative; z-index: 1; }
/* Pop-ups always sit on top of the photos, on a solid card. */
.overlay { z-index: 2000; }

/* v59.2: the opportunity dots are drawn on a map canvas. The rule above that stops pictures and canvases spilling
   off the page (max-width: 100%) squashed that canvas to nothing, so the dots never showed. Not inside maps. */
.leaflet-container canvas, .leaflet-container svg, .leaflet-container img { max-width: none !important; max-height: none !important; }

/* v59.3: long lists scroll in their own box (with the heading row kept in view), so you don't have to scroll the
   whole page to read them. Not inside pop-ups (they scroll already) and not when printing. */
.tablewrap { max-height: min(62vh, 600px); overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; border-radius: 12px; }
.tablewrap th { position: sticky; top: 0; z-index: 2; background: var(--card, #fff); box-shadow: 0 1px 0 var(--line); }
.modal .tablewrap, .needs .tablewrap { max-height: none; overflow-x: auto; overflow-y: visible; }
.modal .tablewrap th { position: static; box-shadow: none; }
.scrollcard { max-height: min(62vh, 600px); overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.scrollcard > h2:first-child { position: sticky; top: -16px; background: var(--card, #fff); z-index: 2; padding: 4px 0; margin-top: -4px !important; }
@media print { .tablewrap, .scrollcard { max-height: none !important; overflow: visible !important; } }

/* ---------- v71: new look for everyone (office, operatives, customers, subcontractors) ---------- */
:root { --bg: #f3f5f9; --radius: 20px; --brand: #1f4e9e; --blue-1: #17408c; --blue-2: #2a5fbf;
  --shadow: 0 1px 2px rgba(15, 27, 51, .05), 0 10px 28px -14px rgba(15, 27, 51, .16); }
html, body { background: var(--bg); }
.content main { padding: 28px 36px; max-width: 1320px; }
.card { border-radius: 20px; border-color: transparent; padding: 20px; }
.stat .n { font-size: 30px; }
.tablewrap { border-radius: 20px; border-color: transparent; }
th { background: transparent; font-size: 11px; letter-spacing: .06em; }
button, .btn { border-radius: 999px; padding: 10px 18px; }
button.primary, .btn.primary { background: linear-gradient(120deg, var(--blue-1), var(--blue-2)); border-color: transparent; }
input, select, textarea { border-radius: 14px; }
.badge { padding: 4px 11px; }
.scene-hero { border-radius: 28px; }

/* Office sidebar: a light, rounded card */
.side { background: #fff; color: #33415c; --side-text: #33415c; border-radius: 0 24px 24px 0; box-shadow: 0 10px 40px -16px rgba(15, 27, 51, .28); }
.side-brand { background: none; color: #0f1b33; border-bottom-color: #e8ecf4; }
.side-name { color: #0f1b33; }
.side-name span { background: none; -webkit-text-fill-color: currentColor; color: #d97706; }
.side-org { color: #5b6478; opacity: 1; }
.side-nav a, .side-head { color: #33415c; border-radius: 14px; }
.side-nav a:hover, .side-head:hover { background: #eef2fa; color: var(--blue-1); transform: none; }
.side-nav a.on { background: #e8eefb; color: var(--blue-1); box-shadow: none; }
.side-items { border-left-color: #e3e8f0; }
.side-foot { border-top-color: #e8ecf4; }
.side .linkbtn { color: #5b6478; }
.side .count { background: #f59e0b; color: #0f1b33; }

/* Phones and the customer / operative / subcontractor app: blue top bar and a floating bottom bar */
.phone-top, .mobile-top { background: linear-gradient(120deg, var(--blue-1), var(--blue-2)); border-radius: 0 0 22px 22px; }
@media (max-width: 899px) {
  .bottomnav { left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); border: 0; border-radius: 22px; box-shadow: 0 12px 32px -10px rgba(15, 27, 51, .4); overflow: hidden; }
}

/* Computers with a mouse: the menu slides away and returns when the pointer touches the left edge.
   Touch screens (phones, tablets) keep the burger drawer / bottom bar. */
.side-hot { display: none; }
@media (min-width: 900px) and (hover: hover) {
  .shell.staff { display: block; }
  .shell.staff > .content { margin-left: 0; width: 100%; }
  .shell.staff > .side { position: fixed; left: 8px; top: 8px; bottom: 8px; height: auto; width: 272px; border-radius: 24px; overflow-y: auto; z-index: 60;
    transform: translateX(calc(-100% - 2px)); transition: transform .22s ease, box-shadow .22s ease; }
  .side-hot { display: block; position: fixed; left: 0; top: 0; bottom: 0; width: 18px; z-index: 59; }
  .side-hot:hover + .side, .shell.staff > .side:hover, .shell.staff > .side:focus-within { transform: none; box-shadow: 10px 0 40px rgba(15, 23, 42, .25); }
  .shell.staff .mobile-top, .shell.staff > .scrim { display: none; }
  .shell.staff .photo-backdrop { left: 0; }
  .phone .bottomnav { transform: translateX(calc(-100% + 6px)); transition: transform .22s ease, box-shadow .22s ease; z-index: 60; border-radius: 0 24px 24px 0; }
  .phone .bottomnav::after { content: ""; position: absolute; top: 0; bottom: 0; right: -16px; width: 16px; }
  .phone .bottomnav:hover, .phone .bottomnav:focus-within { transform: none; box-shadow: 10px 0 40px rgba(15, 23, 42, .25); }
  .phone-main { margin-left: auto; margin-right: auto; max-width: 960px; }
}


/* ---------- v75: steadier pages, a denser Home, and widgets on the right ---------- */
/* The scrollbar's space is always kept, so pages don't shift sideways when a list grows past the screen. */
html { scrollbar-gutter: stable; overflow-y: scroll; }
/* Nothing jumps under the mouse: cards and buttons glow instead of lifting. */
.card.click:hover, a > .card:hover, .card.click:active, button:active:not(:disabled), .btn:active { transform: none; }
.side-nav a:hover { transform: none; }
/* Background pictures still fade, but no longer slowly zoom and drift. */
.scene-layer, .scene-layer.on, .pb-layer, .pb-layer.on { animation: none; transform: none; }
/* Scrolling a list that has reached its end carries on scrolling the page, instead of the page feeling stuck. */
.tablewrap, .scrollcard { overscroll-behavior: auto; }
tr.click { cursor: pointer; } tr.click:hover td { background: #f5f8ff; }

/* Home: more on one screen */
.content main .grid { gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); }
.content main .stat { padding: 12px 14px; }
.content main .stat .n { font-size: 24px; }
.content main .stat .l { font-size: 12px; line-height: 1.25; }
.scene-hero { min-height: 120px; margin-bottom: 12px; }
.scene-hero-in { padding: 20px 24px; }
.dash-seo { gap: 12px; margin: 10px 0; align-items: start; }
.dash-seo .card { margin: 0 !important; height: 100%; box-sizing: border-box; }
.dash-seo > .card, .rail-w.click .card { cursor: pointer; }
@media (min-width: 1100px) {
  .needs { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; }
  .needs h2, .needs .quick, .needs .needclear { grid-column: 1 / -1; }
  .needrow:last-of-type { border-bottom: 1px solid #eef1f6; }
}

/* Widgets down the right (wide computer screens only) */
.rail, .rail-open { display: none; }
@media (min-width: 1360px) and (hover: hover) {
  .rail { display: block; position: fixed; top: 8px; right: 8px; bottom: 8px; width: 320px; overflow-y: auto; z-index: 14; padding: 4px 4px 12px; scrollbar-width: thin; }
  .rail-open { display: inline-block; padding: 8px 14px; }
  .shell.staff.with-rail > .content { padding-right: 336px; box-sizing: border-box; }
  .with-rail .chat-fab, .with-rail .chat-panel { right: 348px; }
}
.rail-top { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.rail-top .linkbtn { color: var(--muted); text-decoration: none; font-size: 15px; margin-left: 8px; }
.rail-w { background: var(--card, #fff); border-radius: 18px; box-shadow: var(--shadow); padding: 12px 14px; margin: 0 0 10px; }
.rail-w.click { cursor: pointer; transition: box-shadow .15s; }
.rail-w.click:hover { box-shadow: 0 0 0 2px #d6e0f5, var(--shadow); }
.rail-w > .card { box-shadow: none; padding: 0; margin: 0 !important; background: none; }
div.rail-w:has(> .card) { padding: 12px 14px; }
.rail-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 14px; }
.rail-h span { color: #98a2b3; font-size: 18px; }
.rail-row { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; font-size: 13px; color: var(--text); text-decoration: none; border-bottom: 1px solid #f0f2f7; }
.rail-row:last-child { border-bottom: 0; }
.rail-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-row b { white-space: nowrap; }
.rail-row.hot b { color: var(--bad, #b42318); }
a.rail-row:hover span { color: var(--blue-1, #17408c); }
/* v77 fix: a pop-up placed straight inside the page (Prospects settings, HMO import) was pushed into the page flow by the
   background-photos rule above, so it appeared at the bottom of the list instead of over it. */
.has-photos .content main > .overlay, .phone.has-photos .phone-main > .overlay, .content main > .overlay { position: fixed; inset: 0; z-index: 2000; }
/* v77: pop-ups always open at the top of the screen, and scroll inside themselves */
.overlay { align-items: flex-start !important; padding-top: 16px; }
.overlay > .modal { margin-top: 0; }
