  * { box-sizing: border-box; margin: 0; padding: 0; }
  /* Use dvh (dynamic viewport height) so we don't get cut off when iOS Safari's
     address bar appears/hides. Falls back to vh on older browsers. */
  body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #0f1117; color: #e2e8f0;
    height: 100vh;        /* fallback for older browsers */
    height: 100dvh;       /* dynamic viewport — accounts for iOS chrome */
    display: flex; flex-direction: column; overflow: hidden;
    /* Respect device safe areas (iPad notch / status bar / home indicator) */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    /* Prevent rubber-band scrolling on iOS but allow text selection for copy/paste */
    overscroll-behavior: none;
  }

  #topbar {
    background: #161b26; border-bottom: 1px solid #2d3748;
    padding: 6px 20px; display: flex; align-items: center; gap: 12px; flex-shrink: 0;
  }
  #topbar h1 { font-size: 15px; font-weight: 600; color: #f1f5f9; letter-spacing: 0.03em; }
  #topbar-brand { transition: opacity 0.15s; }
  #topbar-brand:hover { opacity: 0.85; }
  /* Sun mode: logo on light background looks great as-is */
  body.sun-mode #topbar-brand img { filter: none; }
  .spacer { flex: 1; }
  .eq-legend-wrap { display: flex; gap: 12px; flex-wrap: wrap; }
  .eq-pill { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #94a3b8; }
  .eq-pill-dot { width: 8px; height: 8px; border-radius: 2px; }

  #app { display: flex; flex: 1; overflow: hidden; }

  #sidebar {
    width: 310px; min-width: 310px; background: #161b26;
    border-right: 1px solid #2d3748; display: flex; flex-direction: column;
    /* Allow vertical scroll when content overflows on shorter tablet viewports.
       Inner .list-area still scrolls independently for the job list. */
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }
  /* Slim scrollbar (already styled for list-area; mirror for sidebar) */
  #sidebar::-webkit-scrollbar { width: 4px; }
  #sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

  .section { padding: 12px 16px; border-bottom: 1px solid #2d3748; }
  .section-label { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; color: #64748b; text-transform: uppercase; margin-bottom: 8px; }

  .radius-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
  .radius-row label { font-size: 12px; color: #94a3b8; flex: 1; }
  .radius-row input[type=range] { flex: 2; accent-color: #3b82f6; cursor: pointer; }
  .radius-val { font-size: 12px; font-weight: 600; color: #60a5fa; min-width: 36px; text-align: right; }

  .btn-row { display: flex; gap: 8px; }
  .btn { border: none; border-radius: 6px; padding: 8px 14px; font-size: 12px; font-weight: 600; cursor: pointer; letter-spacing: 0.02em; transition: opacity 0.15s, transform 0.1s; }
  .btn:active { transform: scale(0.97); }
  .btn-blue { background: #2563eb; color: #fff; flex: 1; }
  .btn-blue:hover { background: #1d4ed8; }
  .btn-ghost { background: #1e293b; color: #94a3b8; border: 1px solid #334155; }
  .btn-ghost:hover { background: #263247; }
  .btn-green { background: #16a34a; color: #fff; width: 100%; margin-top: 6px; }
  .btn-green:hover { background: #15803d; }
  .btn-outline { background: transparent; color: #64748b; border: 1px solid #334155; width: 100%; margin-top: 4px; font-size: 12px; padding: 7px; }
  .btn-outline:hover { background: #1e293b; }
  .btn:disabled { opacity: 0.38; cursor: not-allowed; transform: none; }

  .tabs { display: flex; gap: 4px; padding: 10px 16px 0; }
  .tab { flex: 1; padding: 7px; font-size: 12px; font-weight: 500; border: none; border-radius: 6px; cursor: pointer; background: transparent; color: #64748b; transition: all 0.15s; }
  .tab.active { background: #1e293b; color: #e2e8f0; }
  .tab:hover:not(.active) { color: #94a3b8; }

  .list-area { flex: 1; overflow-y: auto; padding: 10px; }
  .list-area::-webkit-scrollbar { width: 4px; }
  .list-area::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

  .eq-section-header {
    font-size: 10px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
    padding: 6px 4px 4px; margin-top: 6px; display: flex; align-items: center; gap: 7px;
  }
  .eq-section-header:first-child { margin-top: 0; }
  .eq-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

  .job-card {
    background: #1e293b; border: 1px solid #2d3748; border-radius: 8px;
    padding: 9px 12px; margin-bottom: 5px; cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
  }
  .job-card:hover { background: #243045; border-color: #3d4f66; }
  .job-card.assigned { border-left-width: 3px; }
  .job-name { font-size: 13px; font-weight: 500; color: #e2e8f0; }
  .job-addr { font-size: 11px; color: #475569; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .job-meta { font-size: 11px; color: #64748b; margin-top: 5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .route-badge { font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 20px; }
  .eq-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px; letter-spacing: 0.03em; }

  .route-group { margin-bottom: 7px; border-radius: 8px; overflow: hidden; border: 1px solid #2d3748; }
  .route-header { padding: 9px 12px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
  .route-dot-lg { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
  .route-title { font-size: 13px; font-weight: 600; flex: 1; color: #e2e8f0; }
  .route-stats { font-size: 10px; color: #94a3b8; text-align: right; line-height: 1.5; }
  .route-jobs { background: #131823; }
  .route-job-item { padding: 6px 12px 6px 32px; font-size: 12px; color: #94a3b8; border-top: 1px solid #1e293b; }
  .route-job-item strong { color: #cbd5e1; }

  .add-form { padding: 12px 16px; border-top: 1px solid #2d3748; display: none; flex-direction: column; gap: 7px; }
  .add-form.visible { display: flex; }
  .add-form label { font-size: 11px; color: #64748b; }
  .add-form input, .add-form select {
    background: #1e293b; border: 1px solid #334155; border-radius: 6px;
    padding: 7px 10px; font-size: 13px; color: #e2e8f0; outline: none; width: 100%;
  }
  .add-form input:focus, .add-form select:focus { border-color: #3b82f6; }
  .add-form select option, .add-form select optgroup { background: #1e293b; }

  .addr-wrap { position: relative; }
  .addr-wrap input { padding-right: 74px; }
  .search-btn {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    background: #334155; border: none; border-radius: 4px;
    padding: 4px 9px; font-size: 11px; font-weight: 600; color: #94a3b8; cursor: pointer;
  }
  .search-btn:hover { background: #3d4f66; color: #e2e8f0; }

  .addr-results { background: #1e293b; border: 1px solid #334155; border-radius: 6px; overflow: hidden; display: none; max-height: 200px; overflow-y: auto; }
  .addr-result { padding: 8px 10px; font-size: 12px; color: #94a3b8; cursor: pointer; border-bottom: 1px solid #2d3748; line-height: 1.4; }
  .addr-result:last-child { border-bottom: none; }
  .addr-result:hover { background: #263247; color: #e2e8f0; }
  .addr-result strong { color: #e2e8f0; display: block; font-size: 13px; }

  .place-hint { font-size: 11px; color: #f59e0b; line-height: 1.4; }
  .place-hint.ok { color: #22c55e; }
  .place-hint.err { color: #ef4444; }

  #map-wrap { flex: 1; position: relative; }
  #map { width: 100%; height: 100%; }

  #legend {
    position: absolute; bottom: 24px; right: 16px;
    background: rgba(22,27,38,0.93); border: 1px solid #334155;
    border-radius: 8px; padding: 10px 14px; z-index: 1000; display: none;
  }
  .legend-section { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin: 7px 0 4px; }
  .legend-section:first-child { margin-top: 0; }
  .legend-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #94a3b8; margin: 3px 0; }
  .legend-color { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

  #adding-banner {
    display: none; position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
    background: #1e40af; color: #bfdbfe; padding: 8px 20px; border-radius: 8px;
    font-size: 13px; font-weight: 600; z-index: 1000; pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  }
  .empty-msg { font-size: 12px; color: #475569; text-align: center; padding: 24px 16px; line-height: 1.7; }

  .page-tab { background:transparent; border:1px solid #334155; border-radius:6px; padding:5px 12px; font-size:12px; font-weight:600; color:#64748b; cursor:pointer; transition:all 0.15s; }
  .page-tab.active { background:#3b82f6; color:#fff; border-color:#3b82f6; }
  .page-tab:hover:not(.active) { background:#1e293b; color:#e2e8f0; }

  /* ── Schedule page ── */
  #schedule-page { display:none; flex:1; overflow:auto; padding:24px; gap:24px; flex-direction:column; background:#0f1117; }
  #schedule-page.visible { display:flex; }
  #history-page { display:none; }

  .cal-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
  .cal-header h2 { font-size:16px; font-weight:600; color:#f1f5f9; }
  .cal-nav { display:flex; gap:8px; align-items:center; }
  .cal-nav button { background:#1e293b; border:1px solid #334155; border-radius:6px; padding:5px 12px; font-size:12px; color:#94a3b8; cursor:pointer; }
  .cal-nav button:hover { background:#263247; }
  .cal-week-label { font-size:13px; font-weight:500; color:#e2e8f0; min-width:200px; text-align:center; }

  .cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:8px; }
  .cal-day {
    background:#161b26; border:1px solid #2d3748; border-radius:10px;
    min-height:140px; padding:10px; display:flex; flex-direction:column; gap:6px;
    transition:border-color 0.15s;
  }
  .cal-day.drag-over { border-color:#3b82f6; background:#1a2540; }
  .cal-day-header { font-size:11px; font-weight:600; color:#64748b; letter-spacing:0.06em; text-transform:uppercase; margin-bottom:2px; }
  .cal-day-date { font-size:20px; font-weight:600; color:#e2e8f0; line-height:1; margin-bottom:6px; }
  .cal-day-date.today { color:#3b82f6; }

  .cal-route-chip {
    border-radius:6px; padding:5px 8px; font-size:11px; font-weight:600;
    cursor:grab; display:flex; align-items:center; justify-content:space-between; gap:6px;
    user-select:none; transition:opacity 0.15s;
  }
  .cal-route-chip:active { cursor:grabbing; opacity:0.7; }
  .cal-route-chip .chip-x { font-size:13px; line-height:1; opacity:0.6; cursor:pointer; }
  .cal-route-chip .chip-x:hover { opacity:1; }

  .unassigned-pool { background:#161b26; border:1px solid #2d3748; border-radius:10px; padding:14px 16px; }
  .unassigned-pool h3 { font-size:11px; font-weight:700; letter-spacing:0.08em; text-transform:uppercase; color:#475569; margin-bottom:10px; }
  .pool-chips { display:flex; flex-wrap:wrap; gap:8px; min-height:36px; }
  .pool-chips.drag-over { background:#1a2540; border-radius:6px; }

  .print-section { background:#161b26; border:1px solid #2d3748; border-radius:10px; padding:14px 16px; }
  .print-section h3 { font-size:11px; font-weight:700; letter-spacing:0.08em; text-transform:uppercase; color:#475569; margin-bottom:10px; }
  .print-row { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
  .print-select { background:#1e293b; border:1px solid #334155; border-radius:6px; padding:7px 10px; font-size:13px; color:#e2e8f0; outline:none; }
  .btn-print { background:#7c3aed; color:#fff; border:none; border-radius:6px; padding:8px 16px; font-size:12px; font-weight:600; cursor:pointer; }
  .btn-print:hover { background:#6d28d9; }
  .btn-print-all { background:#0f766e; color:#fff; border:none; border-radius:6px; padding:8px 16px; font-size:12px; font-weight:600; cursor:pointer; }
  .btn-print-all:hover { background:#0d6763; }

  /* ── Print styles ── */
  /* ── Report modal ── */
  #report-modal {
    display:none; position:fixed; top:0; left:0; right:0; bottom:0;
    background:rgba(0,0,0,0.75); z-index:9999; overflow-y:auto; padding:24px;
  }
  #report-modal.visible { display:block; }
  #report-inner {
    background:#fff; color:#000; max-width:860px; margin:0 auto;
    border-radius:10px; overflow:hidden;
    font-family:'Segoe UI',system-ui,sans-serif;
  }
  #report-toolbar {
    background:#1e293b; padding:12px 20px; display:flex; align-items:center; gap:10px; position:sticky; top:0; z-index:10;
  }
  #report-toolbar h3 { color:#e2e8f0; font-size:14px; font-weight:600; flex:1; }
  .btn-rpt { border:none; border-radius:6px; padding:8px 16px; font-size:12px; font-weight:600; cursor:pointer; }
  .btn-rpt-print { background:#7c3aed; color:#fff; }
  .btn-rpt-print:hover { background:#6d28d9; }
  .btn-rpt-close { background:#334155; color:#94a3b8; }
  .btn-rpt-close:hover { background:#475569; color:#fff; }
  #report-body { padding:28px; }

  .rpt-day-block { margin-bottom:32px; }
  .rpt-day-header { display:flex; align-items:flex-start; justify-content:space-between; border-bottom:2px solid #000; padding-bottom:10px; margin-bottom:18px; }
  .rpt-day-title { font-size:20px; font-weight:700; }
  .rpt-day-sub { font-size:12px; color:#555; margin-top:3px; }
  .rpt-day-meta { text-align:right; font-size:12px; color:#555; }

  .rpt-route-header { display:flex; align-items:center; gap:10px; padding:8px 12px; border-radius:4px; margin-bottom:10px; border-left-width:4px; border-left-style:solid; background:#f3f4f6; }
  .rpt-route-name { font-size:14px; font-weight:700; }
  .rpt-route-crew { font-size:12px; color:#555; }
  .rpt-route-sqft { margin-left:auto; font-size:12px; color:#555; }

  .rpt-job { border:1px solid #ddd; border-radius:6px; padding:12px 14px; margin-bottom:10px; background:#fff; }
  .rpt-job-top { display:flex; align-items:flex-start; gap:12px; }
  .rpt-job-info { flex:1; }
  .rpt-job-name { font-size:14px; font-weight:700; }
  .rpt-job-type { font-size:12px; color:#555; margin-top:1px; }
  .rpt-job-addr { font-size:12px; color:#333; margin-top:4px; }
  .rpt-qr { flex-shrink:0; text-align:center; }
  .rpt-qr-label { font-size:9px; color:#888; margin-top:3px; text-align:center; }
  .rpt-notes-label { font-size:10px; font-weight:700; color:#555; letter-spacing:0.05em; margin:10px 0 4px; border-top:1px solid #eee; padding-top:8px; }
  .rpt-notes-field { width:100%; border:1px solid #ddd; border-radius:4px; padding:8px; font-size:13px; font-family:inherit; resize:vertical; min-height:56px; background:#fafafa; color:#000; }
  .rpt-notes-field:focus { outline:none; border-color:#3b82f6; background:#fff; }

  .rpt-day-notes { border:1px solid #ccc; border-radius:6px; padding:12px 14px; background:#fffbeb; margin-top:8px; }
  .rpt-day-notes-label { font-size:11px; font-weight:700; color:#555; letter-spacing:0.05em; margin-bottom:6px; }
  .rpt-day-notes-field { width:100%; border:1px solid #ddd; border-radius:4px; padding:8px; font-size:13px; font-family:inherit; resize:vertical; min-height:72px; background:#fff; color:#000; }
  .rpt-day-notes-field:focus { outline:none; border-color:#f59e0b; }

  @media print {
    #report-modal { position:static; background:none; padding:0; overflow:visible; display:block !important; }
    #report-inner { border-radius:0; box-shadow:none; }
    #report-toolbar { display:none !important; }
    #report-body { padding:16px; }
    .rpt-day-block { page-break-after:always; }
    .rpt-day-block:last-child { page-break-after:auto; }
    .rpt-notes-field, .rpt-day-notes-field { background:#fff !important; border:1px solid #ccc !important; }
    body > *:not(#report-modal) { display:none !important; }
  }

  #print-area { display:none; }

  /* ── Save indicator ── */
  #save-indicator { font-size:11px; padding:3px 10px; border-radius:20px; background:#1e293b; color:#475569; transition:all 0.4s; }
  #save-indicator.saved { color:#22c55e; background:#14290e; }
  #save-indicator.saving { color:#f59e0b; }

  /* ── Weather ── */
  .cal-weather { margin-top:2px; display:flex; flex-direction:column; gap:2px; }
  .wx-temp { font-size:12px; font-weight:600; color:#94a3b8; }
  .wx-rain { font-size:10px; color:#64748b; }
  .wx-warn { font-size:10px; color:#ef4444; font-weight:600; background:rgba(239,68,68,0.12); border-radius:3px; padding:1px 5px; margin-top:2px; display:inline-block; }
  .wx-ok { font-size:10px; color:#22c55e; }
  .wx-loading { font-size:10px; color:#475569; font-style:italic; }

  /* ── Job status ── */
  .status-badge { font-size:10px; font-weight:700; padding:2px 7px; border-radius:20px; cursor:pointer; user-select:none; }
  .status-pending   { background:#1e293b; color:#64748b; border:1px solid #334155; }
  .status-completed { background:#14290e; color:#22c55e; border:1px solid #16a34a44; }
  .status-postponed { background:#2d1a00; color:#f59e0b; border:1px solid #d9770644; }
  .status-noshow    { background:#2a0d0d; color:#ef4444; border:1px solid #ef444444; }

  /* ── Route stop ordering ── */
  .stop-list { list-style:none; padding:0; margin:0; }
  .stop-item { display:flex; align-items:center; gap:8px; padding:6px 12px 6px 8px; font-size:12px; color:#94a3b8; border-top:1px solid #1e293b; cursor:grab; transition:background 0.1s; }
  .stop-item:active { cursor:grabbing; }
  .stop-item.drag-over-stop { background:#1a2540; }
  .stop-handle { color:#334155; font-size:14px; cursor:grab; flex-shrink:0; padding:0 2px; }
  .stop-num { font-size:10px; font-weight:700; color:#475569; min-width:16px; }
  .stop-name { flex:1; }
  .stop-name strong { color:#cbd5e1; }
  .stop-status { flex-shrink:0; }

  /* ── History tab ── */
  .hist-week { background:#1e293b; border:1px solid #2d3748; border-radius:8px; padding:12px 14px; margin-bottom:8px; }
  .hist-week-label { font-size:13px; font-weight:600; color:#e2e8f0; margin-bottom:8px; }
  .hist-day { padding:5px 0; border-top:1px solid #2d3748; display:flex; align-items:flex-start; gap:10px; }
  .hist-day:first-child { border-top:none; }
  .hist-day-label { font-size:11px; color:#64748b; min-width:90px; }
  .hist-routes { display:flex; flex-wrap:wrap; gap:5px; }
  .hist-chip { font-size:10px; font-weight:600; padding:2px 8px; border-radius:12px; }
  /* History sub-tab nav */
  .hist-tab { background:transparent; border:none; border-bottom:2px solid transparent; padding:8px 14px 10px; font-size:12px; font-weight:600; color:#64748b; cursor:pointer; transition:all 0.15s; }
  .hist-tab:hover:not(.active) { color:#e2e8f0; background:rgba(30,41,59,0.4); }
  .hist-tab.active { color:#f1f5f9; border-bottom-color:#3b82f6; background:transparent; }
  .hist-stat-card { background:#161b26; border:1px solid #2d3748; border-radius:10px; padding:14px 16px; display:flex; flex-direction:column; }
  .hist-stat-label { font-size:10px; color:#64748b; text-transform:uppercase; letter-spacing:0.05em; font-weight:700; }
  .hist-stat-value { font-size:26px; font-weight:800; color:#e2e8f0; margin-top:4px; line-height:1.1; }
  .hist-stat-sub { font-size:11px; color:#94a3b8; margin-top:4px; }
  .hist-stat-delta-up { color:#22c55e; }
  .hist-stat-delta-down { color:#ef4444; }
  .hist-trend-bar { flex:1; min-width:0; display:flex; flex-direction:column; justify-content:flex-end; gap:2px; }
  .hist-trend-value { background:linear-gradient(180deg,#3b82f6,#1e40af); border-radius:3px 3px 0 0; min-height:2px; transition:height 0.3s; }
  .hist-trend-label { font-size:9px; color:#64748b; text-align:center; margin-top:2px; }
  .hist-job-row { background:#161b26; border:1px solid #2d3748; border-radius:8px; padding:10px 14px; margin-bottom:6px; cursor:pointer; transition:background 0.1s; }
  .hist-job-row:hover { background:#1e293b; }



  /* ── Chip expanded job list ── */
  .chip-job-list { display:none; margin-top:6px; border-top:1px solid rgba(255,255,255,0.08); padding-top:6px; }
  .chip-job-list.open { display:block; }
  .chip-job-row { display:flex; flex-direction:column; gap:3px; padding:5px 0; border-bottom:1px solid rgba(255,255,255,0.05); }
  .chip-job-row:last-child { border-bottom:none; }
  .chip-job-name { font-size:11px; font-weight:600; opacity:0.9; }
  .chip-job-type { font-size:10px; opacity:0.6; }
  .chip-job-notes {
    width:100%; background:rgba(0,0,0,0.2); border:1px solid rgba(255,255,255,0.1);
    border-radius:4px; padding:5px 8px; font-size:11px; color:inherit; font-family:inherit;
    resize:vertical; min-height:40px; outline:none; margin-top:3px;
  }
  .chip-job-notes:focus { border-color:rgba(255,255,255,0.3); background:rgba(0,0,0,0.3); }
  .chip-job-notes::placeholder { opacity:0.4; }
  .chip-expand-btn {
    font-size:10px; font-weight:600; opacity:0.65; cursor:pointer;
    background:none; border:none; color:inherit; padding:0; text-align:left;
    margin-top:2px; display:flex; align-items:center; gap:4px;
  }
  .chip-expand-btn:hover { opacity:1; }

  /* ── Contact fields & material estimator ── */
  .chip-section-label { font-size:9px; font-weight:700; letter-spacing:0.08em; text-transform:uppercase; opacity:0.5; margin:8px 0 4px; }
  .chip-contact-row { display:flex; gap:6px; margin-bottom:3px; }
  .chip-field { flex:1; background:rgba(0,0,0,0.2); border:1px solid rgba(255,255,255,0.1); border-radius:4px; padding:4px 8px; font-size:11px; color:inherit; font-family:inherit; outline:none; }
  .chip-field:focus { border-color:rgba(255,255,255,0.3); }
  .chip-field::placeholder { opacity:0.4; }
  .mat-estimate { background:rgba(0,0,0,0.15); border-radius:5px; padding:6px 8px; margin-top:4px; font-size:10px; line-height:1.8; }
  .mat-cost-total { font-size:11px; font-weight:700; opacity:0.9; margin-top:3px; }

  /* ── Confirmation workflow ── */
  .chip-confirm-row { display:flex; align-items:center; gap:5px; margin:3px 0 1px; }
  .chip-cfm-btn { background:none; border:1px solid rgba(255,255,255,0.15); border-radius:4px; padding:2px 7px; font-size:10px; font-weight:600; cursor:pointer; color:inherit; transition:all 0.15s; }
  .chip-cfm-btn:hover { opacity:1; }
  .chip-cfm-confirmed { background:rgba(34,197,94,0.25); border-color:#22c55e; color:#22c55e; }
  .chip-cfm-unconfirmed { background:rgba(245,158,11,0.15); border-color:#f59e0b; color:#f59e0b; }
  .chip-decline-btn { background:none; border:none; font-size:10px; color:#ef4444; cursor:pointer; opacity:0.6; padding:2px 4px; }
  .chip-decline-btn:hover { opacity:1; }
  .cal-confirm-counter { font-size:10px; font-weight:600; color:#22c55e; margin-bottom:4px; }
  .cal-confirm-counter.incomplete { color:#f59e0b; }

  .call-list-section { background:#161b26; border:1px solid #2d3748; border-radius:10px; padding:14px 16px; }
  .call-list-section h3 { font-size:11px; font-weight:700; letter-spacing:0.08em; text-transform:uppercase; color:#475569; margin-bottom:10px; }
  .cl-day-hdr { font-size:12px; font-weight:600; color:#60a5fa; margin:10px 0 6px; border-bottom:1px solid #2d3748; padding-bottom:4px; }
  .cl-day-hdr:first-child { margin-top:0; }
  .cl-item { display:flex; align-items:center; gap:10px; padding:6px 8px; border-bottom:1px solid rgba(255,255,255,0.04); font-size:12px; }
  .cl-item:last-child { border-bottom:none; }
  .cl-name { font-weight:600; color:#e2e8f0; flex:1; }
  .cl-phone { color:#94a3b8; min-width:100px; }
  .cl-type { color:#64748b; font-size:11px; min-width:70px; }
  .cl-actions { display:flex; gap:5px; }
  .cl-confirm { background:rgba(34,197,94,0.2); border:1px solid #22c55e; border-radius:4px; padding:3px 8px; font-size:10px; font-weight:600; color:#22c55e; cursor:pointer; }
  .cl-confirm:hover { background:rgba(34,197,94,0.35); }
  .cl-decline { background:rgba(239,68,68,0.15); border:1px solid #ef4444; border-radius:4px; padding:3px 8px; font-size:10px; font-weight:600; color:#ef4444; cursor:pointer; }
  .cl-decline:hover { background:rgba(239,68,68,0.3); }

    background: #0d1117; border-bottom: 1px solid #2d3748;
    padding: 7px 20px; display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  }
  @keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.5;transform:scale(1.4)} }
  #apikey-bar label { font-size: 11px; color: #64748b; white-space: nowrap; }
  #osgps-key-input {
    flex: 1; background: #1e293b; border: 1px solid #16a34a44; border-radius: 5px;
    padding: 5px 10px; font-size: 12px; color: #22c55e; outline: none; font-family: monospace;
  }
  #osgps-key-input:focus { border-color: #22c55e; }
  #apikey-input {
    flex: 1; background: #1e293b; border: 1px solid #334155; border-radius: 5px;
    padding: 5px 10px; font-size: 12px; color: #e2e8f0; outline: none; font-family: monospace;
  }
  #apikey-input:focus { border-color: #3b82f6; }
  #apikey-input.ok { border-color: #22c55e; }
  #apikey-status { font-size: 11px; white-space: nowrap; }
  .marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background:transparent !important; }
  .marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background:#1e293b !important; color:#60a5fa !important; font-weight:800; font-size:14px; border:2px solid #3b82f6; border-radius:50%; width:40px; height:40px; line-height:36px; text-align:center; box-shadow:0 2px 10px rgba(0,0,0,0.5); }
  #today-page .today-route-card { background:#1e293b; border:1px solid #2d3748; border-radius:8px; padding:10px 12px; margin-bottom:8px; }
  #today-page .today-job-item { padding:5px 8px 5px 24px; font-size:11px; color:#94a3b8; border-top:1px solid rgba(255,255,255,0.05); display:flex; align-items:center; gap:6px; }
  #today-page .today-eta-badge { font-size:10px; font-weight:600; padding:2px 6px; border-radius:10px; display:inline-block; }
  #today-page .today-truck-badge { font-size:10px; font-weight:600; padding:2px 6px; border-radius:10px; display:inline-block; background:rgba(34,197,94,0.15); color:#22c55e; }

  /* ── Field Bid tab ──────────────────────────────────────────────────── */
  .fb-wrap { display: flex; width: 100%; height: 100%; min-height: 0; }
  .fb-pipeline {
    width: 300px; min-width: 300px; background: #161b26; border-right: 1px solid #2d3748;
    display: flex; flex-direction: column; overflow: hidden;
  }
  .fb-pipeline-header {
    padding: 14px 16px; border-bottom: 1px solid #2d3748;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
  }
  .fb-pipeline-list { flex: 1; overflow-y: auto; padding: 8px 10px 16px; }
  .fb-pipe-section { margin-top: 14px; }
  .fb-pipe-section:first-child { margin-top: 0; }
  .fb-pipe-section-hdr {
    font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
    margin-bottom: 6px; padding: 0 4px; display: flex; align-items: center; gap: 6px;
  }
  .fb-pipe-count {
    background: rgba(255,255,255,0.06); color: #94a3b8; font-size: 9px; font-weight: 700;
    padding: 1px 6px; border-radius: 8px;
  }
  .fb-pipe-empty { font-size: 11px; color: #334155; padding: 4px 8px; font-style: italic; }
  .fb-pipe-item {
    background: #1e293b; border: 1px solid #2d3748; border-radius: 8px;
    padding: 10px 12px; margin-bottom: 6px; cursor: pointer; transition: all 0.12s;
  }
  .fb-pipe-item:hover { background: #243047; border-color: #3b82f6; }
  .fb-pipe-item-active { border-color: #3b82f6 !important; background: #1e3a8a !important; }
  .fb-pipe-item-name { font-size: 13px; font-weight: 700; color: #f1f5f9; }
  .fb-pipe-item-meta {
    font-size: 10px; color: #64748b; margin-top: 4px;
    display: flex; justify-content: space-between; gap: 6px;
  }

  .fb-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
  .fb-empty {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 40px 20px; color: #475569;
  }

  .fb-price-panel {
    background: linear-gradient(135deg, #1e3a8a, #1e293b);
    border-bottom: 2px solid #3b82f6; padding: 16px 20px;
    display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  }
  .fb-price-main { flex: 1; min-width: 200px; }
  .fb-price-label { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #94a3b8; }
  .fb-price-value { font-size: 36px; font-weight: 900; color: #60a5fa; letter-spacing: -0.02em; line-height: 1; margin-top: 4px; }
  .fb-price-sub { display: flex; gap: 20px; }
  .fb-price-sub > div { min-width: 70px; }
  .fb-price-label-sm { font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #64748b; }
  .fb-price-val-sm { font-size: 16px; font-weight: 700; color: #e2e8f0; margin-top: 2px; }
  .fb-status-pill {
    display: inline-block; padding: 4px 10px; border-radius: 12px;
    font-size: 10px; font-weight: 800; letter-spacing: 0.08em; margin-top: 2px;
  }

  .fb-form-body {
    flex: 1; overflow-y: auto; padding: 20px 24px;
    display: flex; flex-direction: column; gap: 20px;
  }
  .fb-section { display: flex; flex-direction: column; gap: 8px; }
  .fb-label {
    font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    color: #94a3b8;
  }
  .fb-label-sm { font-size: 10px; font-weight: 600; color: #64748b; margin-bottom: 4px; }
  .fb-input {
    background: #1e293b; border: 1px solid #334155; border-radius: 8px;
    padding: 12px 14px; font-size: 14px; color: #e2e8f0; outline: none; width: 100%;
    font-family: inherit;
  }
  .fb-input:focus { border-color: #3b82f6; }
  .fb-input-big { font-size: 16px; padding: 14px 16px; }
  .fb-input-number { text-align: center; font-weight: 700; font-size: 22px; }

  .fb-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .fb-chip {
    background: #1e293b; border: 2px solid #334155; border-radius: 10px;
    padding: 14px 8px; font-size: 13px; font-weight: 700; color: #94a3b8;
    cursor: pointer; transition: all 0.15s; font-family: inherit;
    min-height: 52px;
  }
  .fb-chip:hover { border-color: #3b82f6; color: #e2e8f0; }
  .fb-chip-active {
    background: #1e3a8a; border-color: #3b82f6; color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(59,130,246,0.15);
  }

  .fb-sqft-row { display: flex; gap: 8px; align-items: center; }
  .fb-sqft-btn {
    background: #1e293b; border: 2px solid #334155; border-radius: 10px;
    padding: 14px 8px; font-size: 14px; font-weight: 700; color: #94a3b8;
    cursor: pointer; min-width: 56px; min-height: 52px; font-family: inherit;
  }
  .fb-sqft-btn:hover { border-color: #3b82f6; color: #e2e8f0; }
  .fb-sqft-btn:active { background: #334155; }
  .fb-sqft-row .fb-input { flex: 1; min-width: 0; }

  .fb-btn {
    background: #1e293b; border: 1px solid #334155; border-radius: 8px;
    padding: 12px 18px; font-size: 13px; font-weight: 700; color: #e2e8f0;
    cursor: pointer; font-family: inherit; min-height: 48px; white-space: nowrap;
  }
  .fb-btn:hover { filter: brightness(1.15); }
  .fb-btn:active { transform: translateY(1px); }
  .fb-btn-ghost { background: #1e293b; color: #94a3b8; }
  .fb-btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
  .fb-btn-blue { background: #2563eb; border-color: #2563eb; color: #fff; }
  .fb-btn-green { background: #15803d; border-color: #15803d; color: #fff; }
  .fb-btn-red { background: #b91c1c; border-color: #b91c1c; color: #fff; }
  .fb-btn-gps {
    background: #14290e; border: 2px solid #16a34a; color: #22c55e;
    font-size: 14px; padding: 14px 18px; width: 100%; min-height: 52px;
  }
  .fb-btn-gps:hover { background: #1a3513; }
  .fb-new-btn { min-height: 38px; padding: 8px 14px; font-size: 12px; }
  .fb-new-btn-big { font-size: 16px; padding: 16px 32px; }

  .fb-status-line { font-size: 12px; color: #64748b; min-height: 14px; line-height: 1.5; }
  .fb-addr-results {
    margin-top: 8px; background: #1e293b; border: 1px solid #334155; border-radius: 8px;
    max-height: 260px; overflow-y: auto;
  }
  .fb-addr-result {
    padding: 10px 14px; font-size: 13px; color: #cbd5e1; cursor: pointer;
    border-bottom: 1px solid #2d3748;
  }
  .fb-addr-result:last-child { border-bottom: none; }
  .fb-addr-result:hover { background: #243047; color: #f1f5f9; }

  /* Phase 2: measure buttons, walk overlay, satellite modal */
  .fb-measure-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px;
  }
  .fb-btn-measure {
    background: #1a1a2e; border: 2px solid #3b82f6; color: #60a5fa;
    font-size: 13px; font-weight: 700; padding: 14px 12px; min-height: 52px;
  }
  .fb-btn-measure:hover { background: #1e293b; border-color: #60a5fa; color: #93c5fd; }
  .fb-btn-purple { background: #7c3aed; border-color: #7c3aed; color: #fff; }
  .fb-btn-purple:hover { background: #8b5cf6; }

  /* Walk perimeter overlay */
  .fb-walk-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.88); z-index: 9999;
    align-items: center; justify-content: center; padding: 20px;
  }
  .fb-walk-overlay[style*="display:none"] { display: none !important; }
  .fb-walk-overlay { display: flex; }
  .fb-walk-card {
    background: #161b26; border: 1px solid #3b82f6; border-radius: 16px;
    padding: 28px 24px; max-width: 500px; width: 100%;
    box-shadow: 0 24px 80px rgba(0,0,0,0.8);
  }
  .fb-walk-title { font-size: 22px; font-weight: 800; color: #60a5fa; text-align: center; }
  .fb-walk-sub { font-size: 12px; color: #94a3b8; text-align: center; margin-top: 6px; }
  .fb-walk-stats {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px;
    background: #0f1117; border-radius: 12px; padding: 18px;
  }
  .fb-walk-stats > div { text-align: center; }
  .fb-walk-stat-label {
    font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: #64748b;
  }
  .fb-walk-stat-val {
    font-size: 22px; font-weight: 900; color: #e2e8f0; margin-top: 4px;
    line-height: 1; font-variant-numeric: tabular-nums;
  }
  .fb-walk-accuracy {
    font-size: 11px; color: #94a3b8; text-align: center; margin-top: 14px;
    padding: 8px; background: #0f1117; border-radius: 6px;
  }
  .fb-walk-buttons {
    display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 20px;
  }
  .fb-walk-buttons .fb-btn { min-height: 54px; font-size: 14px; }

  /* Satellite modal */
  .fb-sat-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85); z-index: 9999;
    align-items: center; justify-content: center;
  }
  .fb-sat-modal[style*="display:none"] { display: none !important; }
  .fb-sat-modal { display: flex; }
  .fb-sat-container {
    background: #0f1117; border-radius: 12px;
    width: 95vw; height: 92vh; max-width: 1200px;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.8);
    position: relative;
  }
  .fb-sat-header {
    padding: 14px 18px; background: #161b26; border-bottom: 1px solid #2d3748;
    display: flex; align-items: center; gap: 12px;
  }
  .fb-sat-map {
    flex: 1; min-height: 0; background: #0f1117; cursor: crosshair;
  }
  .fb-sat-badge {
    position: absolute; top: 80px; left: 20px;
    background: rgba(22, 27, 38, 0.94); border: 2px solid #f97316;
    border-radius: 12px; padding: 10px 14px; z-index: 1000;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    pointer-events: none; /* map pans through the badge; tabs below opt back in */
    min-width: 160px;
  }
  /* Only the tab pills capture clicks; text stays non-interactive so the map can pan */
  .fb-sat-section-tab { pointer-events: auto; }
  .fb-sat-badge-label {
    font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: #94a3b8;
  }
  .fb-sat-badge-val {
    font-size: 24px; font-weight: 900; color: #f97316;
    line-height: 1; margin-top: 2px; font-variant-numeric: tabular-nums;
  }
  .fb-sat-badge-points {
    font-size: 10px; color: #64748b; margin-top: 4px;
  }
  .fb-sat-controls {
    padding: 10px 14px; background: #161b26; border-top: 1px solid #2d3748;
    display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap;
  }
  .fb-sat-controls .fb-btn { min-height: 44px; padding: 0 12px; font-size: 12px; }

  /* 90° snap toggle — styled as a pressed/unpressed pill */
  .fb-sat-toggle-btn {
    font-weight: 700;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
  }
  .fb-sat-toggle-btn.active {
    background: #22c55e !important;
    border-color: #16a34a !important;
    color: #0f1117 !important;
    box-shadow: 0 0 0 2px rgba(34,197,94,0.3);
  }

  /* Cutout button — tinted red so it's visually distinct from + Section */
  .fb-sat-cutout-btn {
    color: #ef4444 !important;
    border-color: rgba(239,68,68,0.45) !important;
  }
  .fb-sat-cutout-btn:hover {
    background: rgba(239,68,68,0.12) !important;
  }

  /* Section pills inside the badge — tap to switch active section */
  .fb-sat-section-tab {
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18);
    color: #cbd5e1; font-size: 11px; font-weight: 700;
    padding: 3px 9px; border-radius: 12px; cursor: pointer;
    min-width: 26px; line-height: 1;
  }
  .fb-sat-section-tab.active {
    background: #f97316; border-color: #fb923c; color: #0f1117;
  }
  .fb-sat-section-tab.subtract {
    border-color: #ef4444; color: #ef4444;
  }
  .fb-sat-section-tab.subtract.active {
    background: #ef4444; color: #0f1117;
  }

  @media (max-width: 767px) {
    .fb-measure-row { grid-template-columns: 1fr; }
    .fb-walk-stats { grid-template-columns: 1fr 1fr; }
    .fb-walk-stats > div:last-child { grid-column: span 2; }
    .fb-sat-container { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }
    .fb-sat-badge { top: 72px; left: 12px; padding: 8px 12px; }
    .fb-sat-badge-val { font-size: 18px; }
  }

  /* Phase 3: photos, signature, share modal */
  .fb-btn-photos {
    background: #1a1a2e; border: 2px solid #22c55e; color: #4ade80;
    font-size: 14px; font-weight: 700; padding: 14px 16px; min-height: 52px;
    width: 100%; text-align: center;
  }
  .fb-btn-photos:hover { background: #14290e; border-color: #4ade80; }
  .fb-btn-sig {
    background: #1a1a2e; border: 2px solid #a78bfa; color: #c4b5fd;
    font-size: 14px; font-weight: 700; padding: 14px 16px; min-height: 52px;
    width: 100%; text-align: center;
  }
  .fb-btn-sig:hover { background: #1e1b4b; border-color: #c4b5fd; }

  .fb-photos-strip {
    display: flex; gap: 8px; overflow-x: auto; margin-top: 10px;
    padding-bottom: 4px;
  }
  .fb-photo-thumb {
    position: relative; width: 88px; height: 88px; flex-shrink: 0;
    border-radius: 8px; overflow: hidden; border: 2px solid #334155;
    background: #1e293b; cursor: pointer;
  }
  .fb-photo-thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
  }
  .fb-photo-thumb:hover { border-color: #3b82f6; }
  .fb-photo-thumb-del {
    position: absolute; top: 2px; right: 2px;
    background: rgba(220, 38, 38, 0.92); color: #fff;
    width: 22px; height: 22px; border-radius: 50%; border: none;
    font-size: 12px; font-weight: 800; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
  }
  .fb-photo-thumb-del:hover { background: #ef4444; }

  .fb-sig-preview-wrap {
    position: relative; margin-top: 10px; padding: 10px 14px;
    background: #1e293b; border: 1px solid #a78bfa; border-radius: 8px;
  }
  .fb-sig-preview {
    max-width: 100%; height: 60px; display: block;
    background: #fff; border-radius: 6px;
  }
  .fb-sig-preview-meta {
    margin-top: 6px; font-size: 11px; color: #94a3b8;
  }
  .fb-sig-clear-btn {
    position: absolute; top: 6px; right: 6px;
    background: rgba(220, 38, 38, 0.85); color: #fff;
    width: 26px; height: 26px; border-radius: 50%; border: none;
    font-size: 13px; font-weight: 800; cursor: pointer;
  }
  .fb-sig-clear-btn:hover { background: #ef4444; }

  /* Signature Pad modal */
  .fb-sig-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.88); z-index: 9999;
    align-items: center; justify-content: center; padding: 10px;
  }
  .fb-sig-modal[style*="display:none"] { display: none !important; }
  .fb-sig-modal { display: flex; }
  .fb-sig-container {
    background: #161b26; border: 1px solid #a78bfa; border-radius: 12px;
    width: 95vw; max-width: 720px; max-height: 95vh;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.8);
  }
  .fb-sig-header {
    padding: 14px 18px; border-bottom: 1px solid #2d3748;
    display: flex; align-items: center; gap: 12px;
  }
  .fb-sig-canvas-wrap {
    position: relative; flex: 1; min-height: 260px;
    background: #fff; border-bottom: 1px solid #2d3748;
    overflow: hidden;
  }
  .fb-sig-canvas {
    display: block; width: 100%; height: 100%;
    touch-action: none;
    cursor: crosshair;
  }
  .fb-sig-baseline {
    position: absolute; bottom: 16px; left: 0; right: 0;
    text-align: center; font-size: 10px; color: #999;
    pointer-events: none;
    border-top: 1px dashed #aaa;
    padding-top: 4px;
    margin: 0 40px;
  }
  .fb-sig-name-row {
    padding: 12px 18px; background: #0f1117;
    display: flex; align-items: center;
    border-bottom: 1px solid #2d3748;
  }
  .fb-sig-controls {
    padding: 12px 18px; background: #161b26;
    display: flex; gap: 10px; justify-content: flex-end;
  }
  .fb-sig-controls .fb-btn { min-height: 48px; }

  /* Photo Viewer modal */
  .fb-photo-viewer-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.95); z-index: 9999;
    align-items: center; justify-content: center;
  }
  .fb-photo-viewer-modal[style*="display:none"] { display: none !important; }
  .fb-photo-viewer-modal { display: flex; }
  .fb-photo-viewer-inner {
    width: 95vw; max-width: 1000px; height: 90vh;
    display: flex; flex-direction: column; gap: 10px;
  }
  .fb-photo-viewer-header {
    display: flex; align-items: center; gap: 10px;
  }
  .fb-photo-viewer-img {
    flex: 1; max-width: 100%; max-height: 100%;
    object-fit: contain; background: #000; border-radius: 8px;
  }

  /* Send Quote popup */
  .fb-share-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.88); z-index: 9999;
    align-items: center; justify-content: center; padding: 20px;
  }
  .fb-share-modal[style*="display:none"] { display: none !important; }
  .fb-share-modal { display: flex; }
  .fb-share-card {
    background: #161b26; border: 2px solid #7c3aed; border-radius: 16px;
    padding: 24px; max-width: 420px; width: 100%;
    display: flex; flex-direction: column; gap: 12px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.8);
  }
  .fb-share-title {
    font-size: 20px; font-weight: 800; color: #a78bfa; text-align: center;
  }
  .fb-share-sub {
    font-size: 12px; color: #94a3b8; text-align: center; margin-bottom: 8px;
  }
  .fb-share-hint {
    font-size: 10px; font-weight: 400; color: #94a3b8; margin-top: 2px;
  }
  .fb-btn-email {
    background: #15803d; border: 2px solid #22c55e; color: #fff;
    padding: 16px 20px; min-height: 72px;
    display: flex; align-items: center; gap: 14px;
    text-align: left;
  }
  .fb-btn-email:hover { background: #16a34a; }
  .fb-btn-email[disabled] {
    background: #1e293b; border-color: #334155; color: #64748b;
    cursor: not-allowed;
  }
  .fb-btn-share {
    padding: 14px 20px; min-height: 64px;
    display: flex; align-items: center; gap: 14px;
    text-align: left;
  }
  .fb-share-controls {
    margin-top: 6px; display: flex; justify-content: center;
  }

  @media (max-width: 767px) {
    .fb-sig-canvas-wrap { min-height: 200px; }
    .fb-photo-viewer-inner { width: 100vw; height: 100vh; height: 100dvh; padding: 8px; }
  }

  .fb-collapse-btn {
    width: 100%; background: #1e293b; border: 1px solid #334155; border-radius: 8px;
    padding: 10px 14px; font-size: 12px; font-weight: 700; color: #a78bfa;
    cursor: pointer; text-align: left; display: flex; align-items: center; gap: 8px;
    font-family: inherit;
  }
  .fb-bid-items {
    flex-direction: column; gap: 6px; padding: 12px 14px; background: #161b26;
    border: 1px solid #2d3748; border-top: none; border-radius: 0 0 8px 8px; margin-top: -8px;
  }
  .fb-bid-est { font-size: 12px; font-weight: 700; color: #a78bfa; min-height: 14px; }

  .fb-footer {
    border-top: 1px solid #2d3748; background: #161b26; padding: 12px 16px;
    display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
  }

  /* Phone layout: stack pipeline above form */
  @media (max-width: 767px) {
    .fb-wrap { flex-direction: column; }
    .fb-pipeline { width: 100%; min-width: 0; max-height: 180px; border-right: none; border-bottom: 1px solid #2d3748; }
    .fb-chips { grid-template-columns: repeat(2, 1fr); }
    .fb-price-value { font-size: 28px; }
    .fb-price-panel { gap: 14px; padding: 12px 16px; }
    .fb-form-body { padding: 14px 16px; }
    .fb-footer { justify-content: stretch; }
    .fb-footer .fb-btn { flex: 1; min-width: 44%; }
    .fb-sqft-btn { min-width: 44px; padding: 12px 4px; font-size: 12px; }
  }

  /* Phase 4: pipeline stats card */
  .fb-stats-card {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
    padding: 10px 12px; margin: 10px 10px 6px;
    background: #0f1117; border: 1px solid #2d3748; border-radius: 8px;
  }
  .fb-stat-box { text-align: center; padding: 4px; }
  .fb-stat-label {
    font-size: 9px; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase; color: #64748b;
  }
  .fb-stat-val {
    font-size: 16px; font-weight: 800; margin-top: 2px; line-height: 1;
    font-variant-numeric: tabular-nums;
  }
  .fb-stat-sub { font-size: 9px; color: #64748b; margin-top: 2px; }

  /* Phase 4: overdue follow-up section */
  .fb-pipe-overdue-section { background: rgba(245, 158, 11, 0.08); padding: 6px; border-radius: 6px; }
  .fb-pipe-overdue {
    border-left: 3px solid #f59e0b !important;
    display: flex; align-items: center; gap: 8px;
  }
  .fb-followup-btn {
    background: #14290e; border: 1px solid #22c55e; border-radius: 4px;
    padding: 6px 10px; font-size: 10px; font-weight: 700; color: #22c55e;
    cursor: pointer; flex-shrink: 0; white-space: nowrap;
  }
  .fb-followup-btn:hover { background: #15803d; color: #fff; }

  /* Sun mode overrides for Phase 4 additions */
  body.sun-mode .fb-stats-card {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
  }
  body.sun-mode .fb-stat-label,
  body.sun-mode .fb-stat-sub { color: #64748b !important; }
  body.sun-mode .fb-pipe-overdue-section { background: #fffbeb !important; }

  /* ────────────────────────────────────────────────────────────────────
     PHASE 4: SUN MODE — high-contrast outdoor-readable theme.
     Activated by `body.sun-mode`. Overrides dark surfaces with whites /
     blacks. Accent colors (green, red, blue, orange) are preserved so
     status pills and chips stay recognizable.
     ──────────────────────────────────────────────────────────────────── */
  body.sun-mode {
    background: #f8fafc !important;
    color: #0f172a !important;
  }
  body.sun-mode #topbar {
    background: #ffffff !important;
    border-bottom: 2px solid #1e293b !important;
  }
  body.sun-mode #topbar h1 { color: #0f172a !important; }
  body.sun-mode .eq-pill { color: #334155 !important; }
  body.sun-mode #job-count-label,
  body.sun-mode #status-label,
  body.sun-mode #save-indicator { color: #334155 !important; }

  body.sun-mode .page-tab {
    background: #e2e8f0 !important;
    color: #1e293b !important;
    border: 2px solid #cbd5e1 !important;
  }
  body.sun-mode .page-tab.active {
    background: #1e293b !important;
    color: #ffffff !important;
    border-color: #0f172a !important;
  }

  body.sun-mode #sidebar {
    background: #f1f5f9 !important;
    border-right: 2px solid #cbd5e1 !important;
  }
  body.sun-mode #sidebar .section-header,
  body.sun-mode #sidebar label,
  body.sun-mode #sidebar h3 { color: #0f172a !important; }
  body.sun-mode #sidebar button,
  body.sun-mode #sidebar input,
  body.sun-mode #sidebar select {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
  }

  body.sun-mode .job-card,
  body.sun-mode .route-card,
  body.sun-mode .route-header {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
  }
  body.sun-mode .tab {
    background: #e2e8f0 !important;
    color: #334155 !important;
  }
  body.sun-mode .tab.active {
    background: #1e293b !important;
    color: #ffffff !important;
  }

  body.sun-mode input,
  body.sun-mode select,
  body.sun-mode textarea {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
  }

  /* Field Bid surfaces */
  body.sun-mode #fieldbid-page,
  body.sun-mode #today-page,
  body.sun-mode #schedule-page,
  body.sun-mode #history-page {
    background: #f8fafc !important;
  }
  body.sun-mode .fb-pipeline {
    background: #ffffff !important;
    border-right: 2px solid #cbd5e1 !important;
  }
  body.sun-mode .fb-pipeline-header {
    border-bottom: 2px solid #cbd5e1 !important;
  }
  body.sun-mode .fb-pipe-item {
    background: #ffffff !important;
    border: 2px solid #cbd5e1 !important;
    color: #0f172a !important;
  }
  body.sun-mode .fb-pipe-item:hover {
    background: #f1f5f9 !important;
    border-color: #3b82f6 !important;
  }
  body.sun-mode .fb-pipe-item-active {
    background: #dbeafe !important;
    border-color: #1d4ed8 !important;
  }
  body.sun-mode .fb-pipe-item-name { color: #0f172a !important; }
  body.sun-mode .fb-pipe-item-meta { color: #334155 !important; }
  body.sun-mode .fb-empty { color: #334155 !important; }
  body.sun-mode .fb-main { background: #f8fafc !important; }
  body.sun-mode .fb-form-body { background: #f8fafc !important; }
  body.sun-mode .fb-section { color: #0f172a !important; }
  body.sun-mode .fb-label { color: #334155 !important; }
  body.sun-mode .fb-input {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
  }
  body.sun-mode .fb-chip {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
  }
  body.sun-mode .fb-chip-active {
    background: #1d4ed8 !important;
    color: #ffffff !important;
    border-color: #1d4ed8 !important;
  }
  body.sun-mode .fb-sqft-btn {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
  }
  body.sun-mode .fb-btn {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
  }
  body.sun-mode .fb-btn-ghost {
    background: #e2e8f0 !important;
    color: #334155 !important;
  }
  body.sun-mode .fb-price-panel {
    background: #1e293b !important;
    color: #ffffff !important;
    border-bottom: 3px solid #0f172a !important;
  }
  body.sun-mode .fb-price-label,
  body.sun-mode .fb-price-sub .fb-price-label,
  body.sun-mode .fb-price-label-sm { color: #cbd5e1 !important; }
  body.sun-mode .fb-price-val-sm { color: #ffffff !important; }
  body.sun-mode .fb-footer {
    background: #ffffff !important;
    border-top: 2px solid #cbd5e1 !important;
  }

  /* Modals */
  body.sun-mode .fb-walk-card,
  body.sun-mode .fb-sat-container,
  body.sun-mode .fb-sig-container,
  body.sun-mode .fb-share-card {
    background: #ffffff !important;
    color: #0f172a !important;
  }
  body.sun-mode .fb-walk-stats { background: #f1f5f9 !important; }
  body.sun-mode .fb-walk-stat-label { color: #64748b !important; }
  body.sun-mode .fb-walk-stat-val { color: #0f172a !important; }
  body.sun-mode .fb-walk-accuracy {
    background: #f1f5f9 !important;
    color: #334155 !important;
  }

  /* Sun mode-specific: force-larger touch targets */
  body.sun-mode .fb-btn,
  body.sun-mode .fb-sqft-btn,
  body.sun-mode .page-tab { font-weight: 700 !important; }

  /* ─── Customer detail two-column layout ────────────────────────────────
     Left: form + stats + actions (who they are)
     Right: jobs + activity (what they've done)
     Stacks to single column on narrow viewports (< ~1100px screen).
  ─────────────────────────────────────────────────────────────────────── */
  .cust-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    max-width: 1600px;
    width: 100%;
  }
  .cust-detail-col-left, .cust-detail-col-right { min-width: 0; }
  /* Right column gets a subtle visual separation on wider screens */
  @media (min-width: 1101px) {
    .cust-detail-col-right {
      padding-left: 18px;
      border-left: 1px solid #2d3748;
    }
  }
  /* Stack vertically when not enough room */
  @media (max-width: 1100px) {
    .cust-detail-grid { grid-template-columns: 1fr; gap: 16px; }
  }

  /* ─── Measurement Calculator Modal ─────────────────────────────────────── */
  .measure-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85); z-index: 9999;
    align-items: center; justify-content: center; padding: 16px;
  }
  .measure-modal[style*="display:none"] { display: none !important; }
  .measure-modal { display: flex; }
  .measure-modal-inner {
    background: #0f1117; border-radius: 12px;
    width: 100%; max-width: 620px; max-height: 92vh;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.8);
  }
  .measure-modal-header {
    padding: 14px 18px; background: #161b26; border-bottom: 1px solid #2d3748;
    display: flex; align-items: flex-start; gap: 12px;
  }
  .measure-total-bar {
    padding: 14px 18px; background: linear-gradient(135deg, #1e293b, #161b26);
    border-bottom: 1px solid #2d3748;
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  }
  .measure-total-label {
    font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: #94a3b8;
  }
  .measure-total-value {
    font-size: 24px; font-weight: 800; color: #22c55e;
    font-variant-numeric: tabular-nums;
  }
  .measure-sections-list {
    flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px;
    background: #0a0d13;
  }
  .measure-section {
    background: #161b26; border: 1px solid #2d3748; border-radius: 8px;
    padding: 10px; display: flex; flex-direction: column; gap: 8px;
  }
  .measure-section-top {
    display: flex; align-items: center; gap: 6px;
  }
  .measure-shape-select {
    background: #0f1117; border: 1px solid #334155; border-radius: 6px;
    padding: 6px 8px; font-size: 12px; font-weight: 600; color: #e2e8f0;
    outline: none; cursor: pointer; min-width: 105px;
  }
  .measure-label-input {
    flex: 1; min-width: 0;
    background: #0f1117; border: 1px solid #334155; border-radius: 6px;
    padding: 6px 10px; font-size: 12px; color: #e2e8f0; outline: none;
  }
  .measure-label-input::placeholder { color: #475569; }
  .measure-sign-btn {
    flex-shrink: 0; width: 32px; height: 32px;
    border-radius: 6px; font-size: 16px; font-weight: 800; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid; transition: all 0.15s;
  }
  .measure-sign-btn.plus {
    background: rgba(34,197,94,0.15); border-color: #22c55e55; color: #22c55e;
  }
  .measure-sign-btn.minus {
    background: rgba(239,68,68,0.15); border-color: #ef444455; color: #ef4444;
  }
  .measure-remove-btn {
    flex-shrink: 0; width: 32px; height: 32px;
    background: transparent; border: 1px solid #334155; border-radius: 6px;
    color: #64748b; font-size: 13px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: all 0.15s;
  }
  .measure-remove-btn:hover {
    background: rgba(239,68,68,0.1); border-color: #ef444488; color: #ef4444;
  }
  .measure-section-fields {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px;
    align-items: end;
  }
  .measure-field {
    display: flex; flex-direction: column; gap: 3px;
  }
  .measure-field > span {
    font-size: 10px; font-weight: 600; color: #64748b;
    letter-spacing: 0.04em; text-transform: uppercase;
  }
  .measure-field input[type="number"] {
    background: #0f1117; border: 1px solid #334155; border-radius: 6px;
    padding: 8px 10px; font-size: 15px; font-weight: 700; color: #e2e8f0;
    outline: none; width: 100%; font-variant-numeric: tabular-nums;
  }
  .measure-field input[type="number"]:focus {
    border-color: #3b82f6; background: #111827;
  }
  .measure-section-area {
    text-align: right; font-size: 14px; font-weight: 700;
    color: #22c55e; padding: 6px 8px;
    background: rgba(34,197,94,0.08); border-radius: 6px;
    font-variant-numeric: tabular-nums; align-self: end;
    min-width: 100px;
  }
  .measure-add-row {
    padding: 10px 14px; background: #161b26; border-top: 1px solid #2d3748;
    display: flex; gap: 6px; flex-wrap: wrap;
  }
  .measure-add-row .fb-btn { font-size: 11px; padding: 7px 10px; }
  .measure-footer {
    padding: 12px 18px; background: #0a0d13; border-top: 1px solid #2d3748;
    display: flex; gap: 10px; justify-content: flex-end;
  }
  .measure-footer .fb-btn { min-width: 110px; }

  /* Tablet / mobile adjustments — stack controls vertically on narrow screens */
  @media (max-width: 520px) {
    .measure-section-top { flex-wrap: wrap; }
    .measure-label-input { order: 3; flex-basis: 100%; }
    .measure-section-area { grid-column: 1 / -1; }
  }