
/* ══════════════════════════════════════════════════════════════════
   PHONE OPTIMIZATION — fix: modal must sit ABOVE the bottom tab bar (≤640px)
   Full-screen modals have a fixed Save/Cancel footer, but the bottom tab
   bar (z-index 200) was rendering on top of it, so the Save button (e.g.
   saving a job cost breakdown) couldn't be tapped. Raise the modal overlay
   above the tab bar (200) and the "More" sheet (250) so its buttons are
   reachable and the full-screen modal covers the nav while it's open.
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  #modalOverlay { z-index: 300 !important; }
}

/* ══════════════════════════════════════════════════════════════════
   PHONE OPTIMIZATION — hide the dashboard quick-add "brand" dropdown (≤640px)
   The Tasks-due-this-week quick-add row has its own Graham/LV selector
   (which company a new task is filed under). On phones that reads as a
   confusing second company switcher next to the one in the top bar, so
   hide it here — quick-added tasks then file under the company you're
   currently viewing. Desktop/tablet keep it.
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  #content #dashQuickBrand { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════════
   PHONE OPTIMIZATION — Phase 3 polish (≤640px)
   - The Company switcher now lives at the top of #main (js/mobile-brand.js),
     so it shows on every view — including Dashboard and Photos, which hide
     #topbar and render their own header. Give that bar screen gutters + a
     solid backdrop.
   - Photo markup editor: keep its canvas within the screen width.
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  #main > #mobileBrandWrap {
    padding: 8px 16px 10px;
    background: var(--surface);
  }

  #content canvas { max-width: 100% !important; height: auto; }
  #content .markup-toolbar,
  #content .annot-toolbar { flex-wrap: wrap; }
}

/* ══════════════════════════════════════════════════════════════════
   PHONE OPTIMIZATION — mobile brand/company switcher (≤640px)
   The sidebar (which holds the real #brandSelect) is hidden on phones,
   so js/mobile-brand.js injects a mirror "Company" dropdown into the
   top bar. Shown only on phones; desktop/tablet use the sidebar one.
   ══════════════════════════════════════════════════════════════════ */
#mobileBrandWrap { display: none; }

@media (max-width: 640px) {
  /* Let the brand row sit on its own line above the title + actions. */
  #topbar { flex-wrap: wrap; }
  #mobileBrandWrap {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    order: -1;
    padding: 4px 0 10px;
    margin-bottom: 8px;
    border-bottom: 0.5px solid var(--border);
  }
  .mbrand-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text3);
    white-space: nowrap;
  }
  .mbrand-select {
    flex: 1;
    min-height: 40px;
    font-size: 16px;
    padding: 6px 10px;
    border-radius: var(--radius);
    border: 0.5px solid var(--border2);
    background: var(--green-light);
    color: var(--green-dark);
    font-weight: 600;
  }
}

/* ═════════════════════════════════════════════════════════════════
   PHONE OPTIMIZATION — Phase 2 (≤640px): wide tables become cards
   Any data table inside #content restacks into one card per row, with
   each cell showing "Header: value" (labels injected by js/mobile.js).
   Desktop/tablet keep the normal table. Nothing here is destructive.
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* Header row is redundant once each cell carries its own label. */
  #content table thead { display: none; }

  #content table,
  #content table tbody,
  #content table tr,
  #content table td {
    display: block;
    width: auto;
  }

  /* Each row is a card. */
  #content table tr {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    margin-bottom: 10px;
  }

  /* Each cell: label on the left, value on the right. */
  #content table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 5px 0;
    border: none !important;
    text-align: right;
    min-height: 32px;
    white-space: normal;
    word-break: break-word;
  }
  #content table td::before {
    content: attr(data-label);
    flex: 0 0 40%;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text3);
  }
  /* Cells with no label (e.g. the actions column) show only their content. */
  #content table td:not([data-label])::before { content: ""; }
  #content table td:not([data-label]) {
    justify-content: flex-start;
    padding-top: 8px;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Any table we didn't restack (or an unusually wide one) can still be
     read by scrolling sideways instead of being crushed. */
  #content .table-scroll,
  #content .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Keep the view's search / filter bar in reach while scrolling a long list. */
  #topbar { position: sticky; top: 0; z-index: 50; background: var(--surface); }
}

/* ═════════════════════════════════════════════════════════════════
   PHONE OPTIMIZATION — Phase 1 (≤640px)
   Added, not edited. Bottom tab bar replaces the sidebar, content goes
   full-width, modals become full-screen sheets, touch targets ≥44px,
   16px inputs to stop iOS zoom-on-focus. Behavior lives in js/mobile.js.
   Sidebar is only hidden once js/mobile.js has added .has-mobile-nav to
   <body>, so navigation can never disappear if that script fails.
   ══════════════════════════════════════════════════════════════════ */

/* Mobile-only elements are inert on desktop/tablet. */
#mobileTabBar, #mobileMoreSheet { display: none; }

/* Stop iOS auto-zoom when focusing a field (needs font-size ≥16px). */
@media (max-width: 640px) {
  input, select, textarea { font-size: 16px !important; }
}

@media (max-width: 640px) {

  /* Sidebar out, content full-width (only when the JS nav is present). */
  body.has-mobile-nav #sidebar { display: none !important; }

  /* Scroll area clears the fixed bottom bar. */
  body.has-mobile-nav #content {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Touch targets — sized for a mouse today, thumb-friendly now. */
  .nav-item, .btn, button, select, .icon-btn,
  .topbar-actions > * { min-height: 44px; }

  /* ── Bottom tab bar ─────────────────────────────────────────── */
  #mobileTabBar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface);
    border-top: 0.5px solid var(--border);
    box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.06);
    z-index: 200;
  }
  #mobileTabBar .mtab {
    flex: 1; min-height: 44px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    border: none; background: none; cursor: pointer;
    font-size: 10px; color: var(--text3);
    text-decoration: none; font-family: inherit;
  }
  #mobileTabBar .mtab .mtab-icon { font-size: 20px; line-height: 1; }
  #mobileTabBar .mtab.active { color: var(--green); }

  /* ── "More" slide-up sheet ──────────────────────────────────── */
  #mobileMoreSheet { position: fixed; inset: 0; z-index: 250; background: rgba(0, 0, 0, 0.35); }
  #mobileMoreSheet.open { display: block; }
  #mobileMoreSheet .sheet-panel {
    position: absolute; left: 0; right: 0; bottom: 0;
    background: var(--surface);
    border-radius: 16px 16px 0 0;
    padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px));
    max-height: 70vh; overflow-y: auto;
  }
  #mobileMoreSheet .sheet-grip {
    width: 40px; height: 4px; border-radius: 2px;
    background: var(--border2); margin: 4px auto 12px;
  }
  #mobileMoreSheet .sheet-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 10px; min-height: 44px;
    font-size: 15px; color: var(--text);
    border-radius: var(--radius); text-decoration: none;
  }
  #mobileMoreSheet .sheet-item .nav-icon { font-size: 18px; width: 24px; text-align: center; }
  #mobileMoreSheet .sheet-item:active { background: var(--surface2); }

  /* ── Full-screen modal sheet ────────────────────────────────── */
  #modalOverlay { padding: 0 !important; align-items: stretch !important; }
  #modalBox {
    width: 100% !important; max-width: 100% !important;
    min-height: 100vh; margin: 0 !important;
    border: none !important; border-radius: 0 !important;
    padding: 16px !important;
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  }
  /* Save/Cancel stay reachable at the bottom on a tall sheet. */
  #modalBox .modal-footer {
    position: fixed; left: 0; right: 0; bottom: 0;
    margin: 0; z-index: 10;
    background: var(--surface);
    border-top: 0.5px solid var(--border);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  }
}
/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --green: #0F6E56; --green-light: #E1F5EE; --green-dark: #085041;
  --blue: #185FA5; --blue-light: #E6F1FB;
  --amber: #BA7517; --amber-light: #FAEEDA;
  --red: #A32D2D; --red-light: #FCEBEB;
  --purple: #534AB7; --purple-light: #EEEDFE;
  --teal-light: #9FE1CB;
  --bg: #f5f5f3; --surface: #ffffff; --surface2: #f9f9f7;
  --border: rgba(0,0,0,0.1); --border2: rgba(0,0,0,0.18);
  --text: #1a1a18; --text2: #555552; --text3: #888884;
  --radius: 8px; --radius-lg: 12px;
  --sidebar-w: 220px;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }

/* ── Login ── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-card { background: var(--surface); border: 0.5px solid var(--border2); border-radius: var(--radius-lg); padding: 40px 36px; width: 340px; }
.login-logo { font-size: 22px; font-weight: 600; color: var(--green); margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--text3); margin-bottom: 24px; }
.error-msg { background: var(--red-light); color: var(--red); font-size: 12px; padding: 8px 10px; border-radius: var(--radius); margin-bottom: 12px; }

/* ── Layout ── */
#app { display: flex; height: 100vh; overflow: hidden; }
#sidebar { width: var(--sidebar-w); min-width: var(--sidebar-w); background: var(--surface2); border-right: 0.5px solid var(--border); display: flex; flex-direction: column; }
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── Sidebar ── */
.sidebar-top { padding: 16px; border-bottom: 0.5px solid var(--border); }
.app-logo { font-size: 15px; font-weight: 600; color: var(--green); margin-bottom: 10px; }
#brandSelect { width: 100%; padding: 6px 8px; font-size: 13px; border-radius: var(--radius); border: 0.5px solid var(--border2); background: var(--surface); color: var(--text); cursor: pointer; }
nav { flex: 1; padding: 8px; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; font-size: 13px; color: var(--text2); margin-bottom: 2px; text-decoration: none; user-select: none; }
.nav-item:hover, .nav-item.active { background: var(--surface); color: var(--text); }
.nav-icon { font-size: 13px; width: 16px; text-align: center; }
.nav-count { margin-left: auto; background: var(--bg); color: var(--text3); font-size: 11px; padding: 1px 7px; border-radius: 20px; }
.sidebar-footer { padding: 12px; border-top: 0.5px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.btn-text { background: none; border: none; cursor: pointer; font-size: 12px; color: var(--text3); text-align: left; padding: 4px 6px; border-radius: var(--radius); }
.btn-text:hover { background: var(--bg); color: var(--text); }
.btn-text.danger:hover { color: var(--red); }

/* ── Topbar ── */
#topbar { padding: 12px 20px; border-bottom: 0.5px solid var(--border); display: flex; align-items: center; gap: 12px; background: var(--surface); }
#topbar h1 { font-size: 16px; font-weight: 500; flex: 1; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
#searchInput { padding: 6px 10px; border-radius: var(--radius); border: 0.5px solid var(--border2); background: var(--surface2); color: var(--text); font-size: 13px; width: 220px; }

/* ── Content ── */
#content { flex: 1; overflow-y: auto; padding: 20px; }
.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--surface2); border-radius: var(--radius); padding: 12px 14px; }
.stat-label { font-size: 11px; color: var(--text3); margin-bottom: 4px; }
.stat-val { font-size: 20px; font-weight: 500; }

/* ── Contact Cards ── */
.contacts-list { display: flex; flex-direction: column; gap: 8px; }
.contact-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 13px 16px; cursor: pointer; transition: border-color 0.1s; }
.contact-card:hover { border-color: var(--green); }
.card-row { display: flex; align-items: center; gap: 12px; }
.avatar { width: 38px; height: 38px; min-width: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 500; font-size: 13px; }
.av-0 { background: #9FE1CB; color: #085041; }
.av-1 { background: #B5D4F4; color: #0C447C; }
.av-2 { background: #FAC775; color: #633806; }
.av-3 { background: #F5C4B3; color: #712B13; }
.av-4 { background: #CECBF6; color: #3C3489; }
.card-info { flex: 1; min-width: 0; }
.card-name { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-size: 12px; color: var(--text3); margin-top: 1px; }
.card-tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-left: auto; }

/* ── Tags & Badges ── */
.tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.tag-investor { background: #B5D4F4; color: #0C447C; }
.tag-agent { background: #9FE1CB; color: #085041; }
.tag-subcontractor { background: #CECBF6; color: #3C3489; }
.tag-lead { background: #FAC775; color: #633806; }
.tag-gutter { background: #9FE1CB; color: #085041; }
.tag-lanai { background: #CECBF6; color: #3C3489; }
.tag-both { background: #FAC775; color: #633806; }
.tag-client { background: #B5D4F4; color: #0C447C; }
.tag-partner { background: #F5C4B3; color: #712B13; }
.pipe-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.pipe-prospect { background: #F1EFE8; color: #5F5E5A; }
.pipe-qualified { background: #FAEEDA; color: #633806; }
.pipe-active { background: #9FE1CB; color: #085041; }
.pipe-closed { background: #B5D4F4; color: #0C447C; }
.jobs-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--surface2); color: var(--text3); }

.field-row { margin-bottom: 10px; }

/* ── Jobs ── */
.job-item { background: var(--surface2); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.job-item-name { font-size: 13px; font-weight: 500; }
.job-item-meta { font-size: 11px; color: var(--text3); margin-top: 3px; }
.fin-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.fin-chip { font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.chip-sale { background: var(--green-light); color: var(--green-dark); }
.chip-profit { background: #EAF3DE; color: #27500A; }
.chip-comm { background: var(--amber-light); color: var(--amber); }

/* ── Pipeline ── */
.pipeline-board { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.pipeline-col { background: var(--surface2); border-radius: var(--radius-lg); padding: 12px; }
.pipeline-col-title { font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 10px; }
.pipeline-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.pipeline-card:hover { border-color: var(--border2); }
.pipeline-card-name { font-size: 13px; font-weight: 500; }
.pipeline-card-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ── Jobs view ── */
.jobs-list { display: flex; flex-direction: column; gap: 8px; }
.job-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 13px 16px; }
.job-card-row { display: flex; align-items: flex-start; gap: 12px; }
.job-card-info { flex: 1; min-width: 0; }
.job-card-name { font-size: 14px; font-weight: 500; }
.job-card-sub { font-size: 12px; color: var(--text3); margin-top: 2px; margin-bottom: 6px; }
.pdf-btn { font-size: 11px; padding: 4px 9px; border-radius: var(--radius); border: 0.5px solid var(--green); color: var(--green); background: transparent; cursor: pointer; white-space: nowrap; }
.pdf-btn:hover { background: var(--green-light); }

/* ── Buttons ── */
.btn { padding: 7px 14px; border-radius: var(--radius); border: 0.5px solid var(--border2); background: var(--surface); color: var(--text); cursor: pointer; font-size: 13px; white-space: nowrap; }
.btn:hover { background: var(--surface2); }
.btn.primary { background: var(--green); color: var(--green-light); border-color: var(--green); }
.btn.primary:hover { background: var(--green-dark); }
.btn.teal { background: #1D9E75; color: var(--green-light); border-color: #1D9E75; font-size: 12px; padding: 5px 10px; }
.btn.teal:hover { background: var(--green); }
.btn.danger-outline { background: transparent; color: var(--red); border-color: var(--border); font-size: 12px; padding: 5px 9px; }
.btn.danger-outline:hover { background: var(--red-light); }
.btn.full { width: 100%; margin-top: 16px; }
.btn.sm { font-size: 12px; padding: 5px 10px; }

/* ── Forms ── */
.fg { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.fg label { font-size: 12px; color: var(--text2); }
.fg input, .fg select, .fg textarea { padding: 7px 9px; border-radius: var(--radius); border: 0.5px solid var(--border2); background: var(--surface2); color: var(--text); font-size: 13px; font-family: inherit; width: 100%; }
.fg textarea { resize: vertical; min-height: 60px; }
.form-row { display: grid; gap: 12px; margin-bottom: 0; }
.form-row.two { grid-template-columns: 1fr 1fr; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
.form-row.addr { grid-template-columns: 2fr 1.2fr 0.7fr 0.9fr; }
@media (max-width: 600px) { .form-row.addr { grid-template-columns: 1fr 1fr; } }
.section-lbl { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; margin: 14px 0 8px; }

/* ── Modal ── */
#modalOverlay { position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding-top: 40px; overflow-y: auto; }
#modalBox { background: var(--surface); border: 0.5px solid var(--border2); border-radius: var(--radius-lg); padding: 24px; width: 580px; max-width: 96vw; margin-bottom: 40px; }
#modalBox h3 { font-size: 15px; font-weight: 500; margin-bottom: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ── Materials table ── */
.mat-table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.mat-table th { font-size: 11px; color: var(--text3); text-align: left; padding: 4px 6px; border-bottom: 0.5px solid var(--border); }
.mat-table td { padding: 3px 3px; vertical-align: middle; }
.mat-table td input { width: 100%; padding: 5px 7px; border-radius: var(--radius); border: 0.5px solid var(--border2); background: var(--surface2); color: var(--text); font-size: 12px; font-family: inherit; }
.add-row-btn { font-size: 12px; padding: 5px 10px; border-radius: var(--radius); border: 0.5px dashed var(--border2); background: transparent; color: var(--text3); cursor: pointer; width: 100%; margin-bottom: 10px; }
.add-row-btn:hover { background: var(--surface2); }

/* ── Financials summary ── */
.fin-summary { background: var(--surface2); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.fin-line { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.fin-line.divider { border-top: 0.5px solid var(--border2); margin-top: 4px; padding-top: 6px; font-weight: 500; }
.fin-line.green { color: var(--green); font-weight: 500; }
.fin-line.amber { color: var(--amber); }
.fin-line.red { color: var(--red); font-weight: 500; }

/* ── Loading ── */
.loading { text-align: center; padding: 60px; color: var(--text3); font-size: 13px; }
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border2); border-top-color: var(--green); border-radius: 50%; animation: spin 0.7s linear infinite; margin-bottom: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 20px; border-radius: 20px; font-size: 13px; opacity: 0; transition: opacity 0.3s; pointer-events: none; z-index: 999; }
#toast.show { opacity: 1; }

/* ── PDF preview ── */
.pdf-preview { background: #fff; border: 0.5px solid #ddd; border-radius: 10px; padding: 32px; font-family: Georgia, serif; color: #1a1a1a; max-width: 560px; margin: 0 auto; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); font-size: 13px; }

/* ── Saving indicator ── */
.save-indicator { font-size: 11px; color: var(--text3); padding: 4px 8px; }
.save-indicator.saving { color: var(--amber); }
.save-indicator.saved { color: var(--green); }

/* ── Profile View ── */
.profile-topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 0.5px solid var(--border); background: var(--surface); }
.profile-back { background: none; border: 1px solid var(--border2); }
.profile-header { display: flex; align-items: center; gap: 16px; padding: 24px; background: var(--surface); border-bottom: 0.5px solid var(--border); }
.profile-header-info { flex: 1; }
.profile-name { font-size: 20px; font-weight: 600; }
.profile-tags { display: flex; gap: 8px; margin-top: 4px; }
.profile-meta { font-size: 12px; color: var(--text3); text-align: right; }
.profile-body { display: flex; gap: 0; flex: 1; overflow-y: auto; }
.profile-left { flex: 1; padding: 20px 24px; border-right: 0.5px solid var(--border); overflow-y: auto; }
.profile-notes-col { width: 380px; min-width: 380px; padding: 20px 24px; background: var(--surface2); overflow-y: auto; }
.profile-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.profile-card-title { font-size: 11px; text-transform: uppercase; color: var(--text3); letter-spacing: 0.05em; margin-bottom: 12px; font-weight: 600; }
.profile-card-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.profile-fields { display: grid; grid-template-columns: 100px 1fr; gap: 8px; font-size: 13px; }
.profile-field-lbl { color: var(--text3); }
.profile-field-val { color: var(--text); }
.profile-field-val a { color: var(--blue); text-decoration: none; }
.btn-sm { border: 0.5px solid var(--border2); background: none; border-radius: 4px; padding: 2px 8px; font-size: 11px; cursor: pointer; }
.btn-sm:hover { background: var(--surface2); }

/* ── Document List ── */
.profile-doc-list { display: flex; flex-direction: column; gap: 1px; }
.profile-doc-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0.5px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.profile-doc-icon { font-size: 14px; }
.profile-doc-info { flex: 1; }
.profile-doc-name { font-weight: 500; font-size: 12px; }
.profile-doc-meta { font-size: 11px; color: var(--text3); }

/* ── Notes Timeline ── */
.notes-timeline { position: relative; padding-left: 20px; border-left: 2px solid var(--border); }
.note-entry { position: relative; margin-bottom: 20px; }
.note-dot { position: absolute; left: -25px; top: 2px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--surface2); }
.note-content { background: var(--surface); border: 0.5px solid var(--border); border-radius: 6px; padding: 10px 12px; }
.note-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.note-type { font-size: 11px; font-weight: 500; }
.note-date { font-size: 10px; color: var(--text3); }
.note-text { font-size: 12px; line-height: 1.5; }
.note-followup-badge { margin-top: 6px; padding: 4px 8px; background: var(--amber-light); border-radius: 4px; font-size: 11px; color: var(--amber); }
.note-followup-done { margin-top: 6px; font-size: 11px; color: var(--green); }

/* ── Add Note Form ── */
.add-note-form { background: var(--surface); border: 0.5px solid var(--border2); border-radius: var(--radius); padding: 12px; margin-bottom: 16px; }
.add-note-row { display: flex; gap: 8px; margin-bottom: 8px; }
.add-note-row select, .add-note-row input { border: 0.5px solid var(--border2); border-radius: 4px; padding: 4px 8px; font-size: 12px; background: var(--surface); }
.add-note-form textarea { width: 100%; border: 0.5px solid var(--border2); border-radius: 4px; padding: 8px; font-size: 12px; resize: vertical; font-family: inherit; box-sizing: border-box; }
.add-note-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.edit-form .fg { margin-bottom: 8px; }
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* ── Responsive Profile ── */
@media (max-width: 900px) {
  .profile-body { flex-direction: column; }
  .profile-left { border-right: none; border-bottom: 0.5px solid var(--border); }
  .profile-notes-col { width: 100%; min-width: 0; }
}

/* ── Activity Dashboard ── */
.dash-content { max-width: 700px; padding-bottom: 32px; }
.dash-section { margin-bottom: 24px; }
.dash-section-label { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.dash-dot { width: 8px; height: 8px; border-radius: 50%; }
.dash-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px; border-left: 3px solid #ddd; }
.dash-card-inner { display: flex; align-items: center; gap: 12px; }
.dash-card-body { flex: 1; }
.dash-card-top { display: flex; justify-content: space-between; align-items: center; }
.dash-card-name { font-weight: 600; font-size: 13px; cursor: pointer; color: var(--blue); text-decoration: none; }
.dash-card-name:hover { text-decoration: underline; }
.dash-card-text { font-size: 12px; color: var(--text2); margin-top: 2px; }
.dash-card-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }
.dash-card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.dash-badge { padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.dash-badge-red { background: var(--red-light); color: var(--red); }
.dash-badge-amber { background: var(--amber-light); color: var(--amber); }
.dash-badge-blue { background: var(--blue-light); color: var(--blue); }

/* ── Tasks Dashboard ── */
.tasks-quickadd { display:flex; gap:10px; align-items:center; padding:12px 0; margin-bottom:12px; }
.tasks-quickadd input[type="text"] { flex:1; padding:8px 12px; border:0.5px solid var(--border2); border-radius:var(--radius); font-size:13px; }
.tasks-quickadd input[type="date"] { padding:6px 8px; border:0.5px solid var(--border2); border-radius:var(--radius); font-size:13px; }
.tasks-quickadd select { padding:6px 8px; border:0.5px solid var(--border2); border-radius:var(--radius); font-size:13px; }

.tasks-filters { display:flex; gap:4px; margin-bottom:16px; }
.tasks-filter-tab { padding:6px 14px; border-radius:20px; font-size:12px; cursor:pointer; border:none; background:var(--surface2); color:var(--text2); }
.tasks-filter-tab.active { background:var(--green); color:#fff; font-weight:500; }

.tasks-section { margin-bottom:20px; }
.tasks-section-hdr { font-size:12px; font-weight:600; color:var(--text2); text-transform:uppercase; letter-spacing:0.04em; padding:8px 0 6px; cursor:pointer; user-select:none; display:flex; align-items:center; gap:6px; }
.tasks-section-hdr .count { font-weight:400; color:var(--text3); }
.tasks-section.overdue .tasks-section-hdr { color:var(--red); }
.tasks-section.overdue { border-left:3px solid var(--red); padding-left:12px; }
.tasks-section.collapsed .tasks-section-body { display:none; }

.task-row { display:flex; align-items:center; gap:10px; padding:10px 12px; background:var(--surface); border:0.5px solid var(--border); border-radius:var(--radius); margin-bottom:6px; cursor:pointer; transition:border-color 0.1s; }
.task-row:hover { border-color:var(--border2); }
.task-row.done .task-title { text-decoration:line-through; color:var(--text3); }
.task-row .task-check { width:18px; height:18px; cursor:pointer; accent-color:var(--green); }
.task-row .priority-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.task-row .priority-dot.high { background:var(--red); }
.task-row .priority-dot.medium { background:var(--amber); }
.task-row .priority-dot.low { background:var(--text3); }
.task-row .priority-dot.urgent { background:#b30000; box-shadow:0 0 0 2px #b3000033; }
.task-row .task-title { flex:1; font-size:13px; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.task-row .brand-badge { font-size:11px; padding:2px 8px; border-radius:20px; }
.task-row .task-contact { font-size:12px; color:var(--text2); max-width:120px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.task-row .task-due { font-size:12px; color:var(--text3); white-space:nowrap; }
.task-row .task-due.overdue { color:var(--red); font-weight:500; }

.task-expand { padding:12px 16px; margin:-4px 0 6px; background:var(--surface2); border:0.5px solid var(--border); border-top:none; border-radius:0 0 var(--radius) var(--radius); }
.task-expand .field-row { display:flex; gap:10px; margin-bottom:10px; align-items:center; }
.task-expand .field-row label { font-size:12px; color:var(--text3); width:80px; flex-shrink:0; }
.task-expand .field-row input, .task-expand .field-row select, .task-expand .field-row textarea { flex:1; padding:6px 8px; border:0.5px solid var(--border2); border-radius:var(--radius); font-size:13px; }
.task-expand .expand-actions { display:flex; gap:8px; margin-top:12px; }

/* ── Email Templates ── */
.tpl-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.tpl-header h2 { font-size:16px; font-weight:500; }

.tpl-filters { display:flex; gap:4px; margin-bottom:16px; }
.tpl-filter-tab { padding:6px 14px; border-radius:20px; font-size:12px; cursor:pointer; border:none; background:var(--surface2); color:var(--text2); }
.tpl-filter-tab.active { background:var(--green); color:#fff; font-weight:500; }

.tpl-list { display:flex; flex-direction:column; gap:8px; }
.tpl-row { display:flex; align-items:center; gap:10px; padding:12px 14px; background:var(--surface); border:0.5px solid var(--border); border-radius:var(--radius); cursor:pointer; transition:border-color 0.1s; }
.tpl-row:hover { border-color:var(--border2); }
.tpl-row .tpl-cat { font-size:11px; padding:2px 8px; border-radius:20px; flex-shrink:0; }
.tpl-row .tpl-cat.cat-follow-up { background:var(--amber-light); color:var(--amber); }
.tpl-row .tpl-cat.cat-introduction { background:var(--blue-light); color:var(--blue); }
.tpl-row .tpl-cat.cat-invoice { background:var(--green-light); color:var(--green); }
.tpl-row .tpl-cat.cat-onboarding { background:var(--purple-light); color:var(--purple); }
.tpl-row .tpl-cat.cat-general { background:var(--surface2); color:var(--text3); }
.tpl-row .tpl-name { font-size:13px; font-weight:500; flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tpl-row .tpl-subject { font-size:12px; color:var(--text3); max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.tpl-expand { padding:14px 16px; margin:-6px 0 8px; background:var(--surface2); border:0.5px solid var(--border); border-top:none; border-radius:0 0 var(--radius) var(--radius); }
.tpl-expand .field-row { display:flex; gap:10px; margin-bottom:10px; align-items:flex-start; }
.tpl-expand .field-row label { font-size:12px; color:var(--text3); width:80px; flex-shrink:0; padding-top:6px; }
.tpl-expand .field-row input, .tpl-expand .field-row select { flex:1; padding:6px 8px; border:0.5px solid var(--border2); border-radius:var(--radius); font-size:13px; }
.tpl-expand .field-row textarea { flex:1; padding:8px; border:0.5px solid var(--border2); border-radius:var(--radius); font-size:13px; font-family:inherit; resize:vertical; min-height:100px; }
.tpl-expand .expand-actions { display:flex; gap:8px; margin-top:12px; }
.tpl-expand .var-chips { display:flex; flex-wrap:wrap; gap:4px; margin-top:8px; }
.tpl-expand .var-chip { font-size:11px; padding:3px 8px; border-radius:4px; background:var(--surface); border:0.5px solid var(--border2); cursor:pointer; color:var(--text2); }
.tpl-expand .var-chip:hover { background:var(--blue-light); color:var(--blue); }

.tpl-create-form { background:var(--surface); border:0.5px solid var(--border2); border-radius:var(--radius); padding:16px; margin-bottom:16px; }
.tpl-create-form .field-row { display:flex; gap:10px; margin-bottom:10px; align-items:flex-start; }
.tpl-create-form .field-row label { font-size:12px; color:var(--text3); width:80px; flex-shrink:0; padding-top:6px; }
.tpl-create-form .field-row input, .tpl-create-form .field-row select { flex:1; padding:6px 8px; border:0.5px solid var(--border2); border-radius:var(--radius); font-size:13px; }
.tpl-create-form .field-row textarea { flex:1; padding:8px; border:0.5px solid var(--border2); border-radius:var(--radius); font-size:13px; font-family:inherit; resize:vertical; min-height:80px; }

/* ── LV Documents (Quote / Material List / Contract) ── */
.profile-doc-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.doc-type-badge { font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; }
.doc-type-badge.badge-invoice { background: var(--green-light); color: var(--green-dark); }
.doc-type-badge.badge-onboarding { background: var(--purple-light); color: var(--purple); }
.doc-type-badge.badge-bill { background: var(--blue-light); color: var(--blue); }
.doc-type-badge.badge-quote { background: var(--amber-light); color: var(--amber); }
.doc-type-badge.badge-materiallist { background: #E8F5E1; color: #27500A; }
.doc-type-badge.badge-contract { background: var(--red-light); color: var(--red); }

/* Quote builder table */
.qb-table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.qb-table th { font-size: 11px; color: var(--text3); text-align: left; padding: 6px 8px; border-bottom: 0.5px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.qb-table td { padding: 6px 8px; vertical-align: middle; border-bottom: 0.5px solid var(--border); font-size: 12px; }
.qb-table tr.qb-cat-row td { background: var(--surface2); font-weight: 600; color: var(--text2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; padding: 8px; }
.qb-table .qb-item-name { font-weight: 500; font-size: 13px; color: var(--text); }
.qb-table .qb-item-desc { font-size: 11px; color: var(--text3); margin-top: 1px; }
.qb-table .qb-unit { color: var(--text2); }
.qb-table .qb-price { text-align: right; color: var(--text2); }
.qb-table .qb-line-total { text-align: right; color: var(--green-dark); font-weight: 500; }
.qb-table input.qb-qty { width: 70px; padding: 4px 6px; border-radius: var(--radius); border: 0.5px solid var(--border2); background: var(--surface2); font-size: 12px; }

/* Material list builder table */
.ml-table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.ml-table th { font-size: 11px; color: var(--text3); text-align: left; padding: 4px 6px; border-bottom: 0.5px solid var(--border); }
.ml-table td { padding: 3px 3px; vertical-align: middle; }
.ml-table td input { width: 100%; padding: 5px 7px; border-radius: var(--radius); border: 0.5px solid var(--border2); background: var(--surface2); color: var(--text); font-size: 12px; font-family: inherit; }
.ml-table .ml-line-total { text-align: right; padding: 5px 7px; color: var(--green-dark); font-weight: 500; font-size: 12px; }

/* Contract placeholder note */
.contract-placeholder-note { background: var(--amber-light); color: var(--amber); padding: 10px 14px; border-radius: var(--radius); font-size: 12px; margin-bottom: 16px; border-left: 3px solid var(--amber); }

/* Wider modal for builders */
#modalBox.wide { width: 880px; }

/* ── Email Compose Window ── */
.compose-window { background:var(--surface); border:0.5px solid var(--border2); border-radius:var(--radius); padding:16px; margin-bottom:16px; }
.compose-header { font-size:13px; font-weight:600; margin-bottom:12px; color:var(--text); }
.compose-field { margin-bottom:10px; }
.compose-field label { display:block; font-size:11px; color:var(--text3); margin-bottom:4px; }
.compose-field input, .compose-field select { width:100%; padding:7px 9px; border:0.5px solid var(--border2); border-radius:var(--radius); font-size:13px; background:var(--surface2); color:var(--text); }
.compose-field input[readonly] { background:var(--bg); color:var(--text2); }
.compose-field textarea { width:100%; padding:8px 9px; border:0.5px solid var(--border2); border-radius:var(--radius); font-size:13px; font-family:inherit; resize:vertical; min-height:140px; background:var(--surface2); color:var(--text); }
.compose-actions { display:flex; gap:8px; margin-top:12px; }

/* ── Send Quote & Contract combined compose ── */
.send-summary-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:6px; margin-bottom:12px; }
.send-summary { background:var(--surface2); border:0.5px solid var(--border2); border-radius:var(--radius); padding:12px 14px; }
.send-summary-title { font-size:11px; text-transform:uppercase; letter-spacing:0.05em; color:var(--text3); font-weight:600; margin-bottom:8px; }
.send-summary-line { display:flex; justify-content:space-between; gap:12px; font-size:12px; padding:3px 0; color:var(--text2); }
.send-summary-line span:first-child { color:var(--text3); }
.send-summary-line span:last-child { color:var(--text); font-weight:500; }
.send-summary-line.total { border-top:0.5px solid var(--border2); margin-top:6px; padding-top:6px; font-weight:600; }
.send-summary-line.total span:last-child { color:var(--green); }
.send-summary-scope { margin-top:6px; padding-top:6px; border-top:0.5px solid var(--border2); font-size:12px; }
.send-summary-scope > span { display:block; color:var(--text3); margin-bottom:4px; }
.send-summary-scope > div { color:var(--text2); line-height:1.5; white-space:pre-wrap; }
.send-pdf-note { background:var(--amber-light); color:var(--amber); padding:10px 14px; border-radius:var(--radius); font-size:12px; margin-bottom:12px; border-left:3px solid var(--amber); line-height:1.5; }

/* ── Crews (LV) ── */
.crew-list { display:flex; flex-direction:column; gap:8px; }
.crew-card { display:flex; align-items:center; gap:12px; padding:12px 14px; background:var(--surface); border:0.5px solid var(--border); border-radius:var(--radius-lg); }
.crew-card:hover { border-color:var(--border2); }
.crew-card-info { flex:1; min-width:0; }
.crew-card-name { font-size:14px; font-weight:500; }
.crew-card-meta { font-size:12px; color:var(--text2); margin-top:2px; }
.crew-card-contact { font-size:11px; color:var(--text3); margin-top:2px; }
.crew-card-actions { display:flex; gap:6px; flex-shrink:0; }

/* ── Crew Assignment Panel (Profile) ── */
.crew-assignment-panel { background:var(--surface2); border:0.5px solid var(--border2); border-radius:var(--radius); padding:14px 16px; margin-bottom:12px; }
.crew-assignment-title { font-size:11px; text-transform:uppercase; letter-spacing:0.05em; color:var(--text3); font-weight:600; margin-bottom:10px; }
.crew-assignment-row { display:grid; grid-template-columns:1fr 2fr; gap:12px; margin-bottom:10px; }
.crew-assignment-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:8px; }

.crew-checkbox-list { display:flex; flex-direction:column; gap:4px; max-height:180px; overflow-y:auto; padding:6px; background:var(--surface); border:0.5px solid var(--border2); border-radius:var(--radius); }
.crew-checkbox-row { display:flex; align-items:center; gap:8px; padding:5px 6px; border-radius:4px; cursor:pointer; font-size:12px; }
.crew-checkbox-row:hover { background:var(--surface2); }
.crew-checkbox-row input[type="checkbox"] { accent-color:var(--green); }
.crew-cb-name { flex:1; font-weight:500; color:var(--text); }
.crew-cb-spec { font-size:11px; color:var(--text3); }

.slot-selector { display:flex; gap:4px; }
.slot-btn { flex:1; padding:6px 10px; border:0.5px solid var(--border2); background:var(--surface); color:var(--text2); border-radius:var(--radius); font-size:12px; cursor:pointer; }
.slot-btn:hover { background:var(--surface2); }
.slot-btn.active { background:var(--green); color:var(--green-light); border-color:var(--green); font-weight:500; }

/* ── Document Status Badges (Quote / Contract pipeline) ── */
.doc-status-badge { display:inline-block; font-size:10px; padding:1px 7px; border-radius:20px; font-weight:600; text-transform:uppercase; letter-spacing:0.04em; vertical-align:1px; }
.doc-status-draft { background:var(--surface2); color:var(--text3); border:0.5px solid var(--border2); }
.doc-status-sent { background:var(--blue-light); color:var(--blue); }
.doc-status-accepted { background:var(--green-light); color:var(--green-dark); }
.doc-status-signed { background:var(--green-light); color:var(--green-dark); }
.doc-status-rejected { background:var(--red-light); color:var(--red); }

/* Inline status <select>. Wears the same color variants as .doc-status-badge
   (.doc-status-draft, .doc-status-sent, …) — see set above. */
.doc-status-select {
  display:inline-block;
  font-size:10px;
  padding:1px 18px 1px 7px;
  border-radius:20px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.04em;
  vertical-align:1px;
  font-family:inherit;
  cursor:pointer;
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'><path d='M1 2.5l3 3 3-3' stroke='%23666' stroke-width='1.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat:no-repeat;
  background-position:right 5px center;
  background-size:8px;
}
.doc-status-select:hover { filter:brightness(0.97); }
.doc-status-select:focus { outline:0.5px solid var(--green); outline-offset:1px; }
.doc-status-select option { font-size:12px; text-transform:none; letter-spacing:normal; color:var(--text); background:var(--surface); }

/* ── Start Job Setup Button (Profile / Documents) ── */
.btn-job-setup { display:block; width:100%; margin:12px 0; padding:14px 18px; border-radius:var(--radius); border:none; background:var(--green); color:var(--green-light); font-size:15px; font-weight:600; cursor:pointer; text-align:center; letter-spacing:0.02em; box-shadow:0 2px 6px rgba(15,110,86,0.20); }
.btn-job-setup:hover { background:var(--green-dark); box-shadow:0 3px 8px rgba(15,110,86,0.28); }

/* ── Job Setup Modal Sections ── */
.js-section-title { font-size:11px; text-transform:uppercase; letter-spacing:0.05em; color:var(--text3); font-weight:600; margin:14px 0 8px; display:flex; align-items:center; gap:8px; }
.js-section-title:first-of-type { margin-top:4px; }
.js-section-meta { font-size:10px; color:var(--text3); font-weight:400; text-transform:none; letter-spacing:0; }
.js-ml-preview { background:var(--surface2); border:0.5px solid var(--border2); border-radius:var(--radius); padding:8px 12px; max-height:180px; overflow-y:auto; }
.js-ml-table { width:100%; border-collapse:collapse; font-size:12px; }
.js-ml-table th { font-size:10px; color:var(--text3); text-align:left; padding:4px 6px; border-bottom:0.5px solid var(--border); font-weight:600; text-transform:uppercase; letter-spacing:0.04em; }
.js-ml-table td { padding:5px 6px; border-bottom:0.5px solid var(--border); color:var(--text2); }
.js-ml-table tr:last-child td { border-bottom:none; }

/* ── Price Sheet (LV) ── */
.ps-table-wrap { background:var(--surface); border:0.5px solid var(--border); border-radius:var(--radius); padding:14px 16px; }
.ps-table { width:100%; border-collapse:collapse; }
.ps-table th { font-size:11px; color:var(--text3); text-align:left; padding:6px 8px; border-bottom:0.5px solid var(--border); text-transform:uppercase; letter-spacing:0.04em; font-weight:600; }
.ps-table td { padding:4px 6px; vertical-align:middle; border-bottom:0.5px solid var(--border); }
.ps-table tbody tr:last-child td { border-bottom:none; }
.ps-table td input { width:100%; padding:6px 8px; border-radius:var(--radius); border:0.5px solid var(--border2); background:var(--surface2); color:var(--text); font-size:12px; font-family:inherit; }
.ps-table td input[type="number"] { text-align:right; }
.ps-table td input:focus { outline:0.5px solid var(--green); outline-offset:0; background:var(--surface); }

/* ── Job Setup Panel (Profile, inline) ── */
.job-setup-panel { background:var(--surface2); border:0.5px solid var(--border2); border-radius:var(--radius); padding:16px; margin:12px 0; }
.job-setup-section { margin-bottom:14px; }
.job-setup-section:last-of-type { margin-bottom:0; }
.job-setup-section-title { font-size:11px; text-transform:uppercase; letter-spacing:0.05em; color:var(--text3); font-weight:600; margin-bottom:8px; display:flex; align-items:center; justify-content:space-between; gap:8px; }
.job-setup-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:14px; padding-top:12px; border-top:0.5px solid var(--border); }
.js-mat-row { display:grid; grid-template-columns:1fr 2fr auto; gap:10px; padding:5px 8px; font-size:12px; color:var(--text2); border-bottom:0.5px solid var(--border); }
.js-mat-row:last-child { border-bottom:none; }
.js-mat-mfr { color:var(--text3); }
.js-mat-name { color:var(--text); }
.js-mat-qty { color:var(--text2); white-space:nowrap; text-align:right; }

.slot-btn.suggested { box-shadow:inset 0 0 0 1px var(--green); }
.slot-btn.suggested.active { box-shadow:none; }

/* ── Job Profitability Table (Profile) ── */
.job-prof-table { width:100%; border-collapse:collapse; font-size:12px; }
.job-prof-table th { font-size:11px; color:var(--text3); text-align:left; padding:6px 8px; border-bottom:0.5px solid var(--border); text-transform:uppercase; letter-spacing:0.04em; font-weight:600; }
.job-prof-table td { padding:6px 8px; vertical-align:middle; border-bottom:0.5px solid var(--border); color:var(--text); }
.job-prof-table tbody tr:last-child td { border-bottom:none; }

/* ── Job Cost Breakdown Card (Profile, below Job Summary) ── */
.job-cost-card { background:var(--surface); border:0.5px solid var(--border); border-radius:var(--radius); margin:12px 0; overflow:hidden; }
.job-cost-header { padding:12px 16px; border-bottom:0.5px solid var(--border); background:var(--surface2); }
.job-cost-title { font-size:13px; font-weight:600; color:var(--text); letter-spacing:0.02em; }
.job-cost-body { padding:14px 16px; display:grid; grid-template-columns:1fr 1fr; gap:10px 14px; }
.job-cost-row { display:flex; flex-direction:column; gap:4px; }
.job-cost-row.job-cost-row-full { grid-column:1 / -1; }
.job-cost-row label { font-size:11px; color:var(--text3); font-weight:500; }
.job-cost-row input, .job-cost-row textarea { padding:7px 9px; border:0.5px solid var(--border2); border-radius:var(--radius); background:var(--surface2); color:var(--text); font-size:13px; font-family:inherit; }
.job-cost-row input[readonly] { background:var(--bg); color:var(--text2); }
.job-cost-row input[type="number"] { text-align:right; }
.job-cost-row textarea { resize:vertical; min-height:60px; }
.job-cost-actions { grid-column:1 / -1; display:flex; justify-content:flex-end; padding-top:10px; border-top:0.5px solid var(--border); margin-top:4px; }

/* ── Job Summary Card (replaces Start Job Setup button after scheduling) ── */
.job-summary-card { background:var(--green-light); border:0.5px solid var(--green); border-radius:var(--radius); padding:14px 16px; margin:12px 0; }
.job-summary-header { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.job-summary-title { font-size:13px; font-weight:600; color:var(--green-dark); flex:1; letter-spacing:0.02em; }
.job-status-badge { font-size:10px; padding:2px 9px; border-radius:20px; font-weight:600; text-transform:uppercase; letter-spacing:0.04em; }
.job-status-badge.badge-scheduled { background:var(--blue-light); color:var(--blue); }
.job-status-badge.badge-dispatched { background:var(--amber-light); color:var(--amber); }
.job-status-badge.badge-in-progress { background:var(--purple-light); color:var(--purple); }
.job-status-badge.badge-complete { background:#fff; color:var(--green-dark); border:0.5px solid var(--green); }
.job-status-badge.badge-cancelled { background:var(--red-light); color:var(--red); }
.job-status-badge.badge-new { background:var(--surface2); color:var(--text2); }
.job-status-badge.badge-quoted { background:var(--amber-light); color:var(--amber); }
.job-status-badge.badge-contracted { background:var(--green-light); color:var(--green-dark); }
.job-summary-body { display:flex; flex-direction:column; gap:2px; }

/* ── Partners (LV) ── */
.partner-table-wrap { overflow-x:auto; }
.partner-table { width:100%; border-collapse:collapse; font-size:13px; }
.partner-table th { text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:0.04em; color:var(--text3); font-weight:600; padding:8px 10px; border-bottom:0.5px solid var(--border2); }
.partner-table td { padding:9px 10px; border-bottom:0.5px solid var(--border); vertical-align:middle; }
.partner-table tr:hover td { background:var(--surface2); }
.partner-link { color:var(--blue); cursor:pointer; font-weight:500; }
.partner-link:hover { text-decoration:underline; }
.partner-row-click { cursor:pointer; }
.partner-section { margin-top:24px; }
.partner-section-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.partner-section-header h3 { font-size:14px; font-weight:600; }
.partner-back { background:none; border:none; color:var(--text2); cursor:pointer; font-size:13px; padding:4px 0; margin-bottom:8px; }
.partner-back:hover { color:var(--text); }
.partner-form-grid { display:grid; gap:10px; max-width:680px; }
.partner-readonly { display:flex; gap:12px; font-size:13px; padding:6px 0; color:var(--text2); }
.partner-readonly strong { color:var(--text); font-weight:500; }
.job-summary-actions { display:flex; justify-content:flex-end; margin-top:10px; padding-top:10px; border-top:0.5px solid rgba(15,110,86,0.2); }

.js-summary-row { display:flex; gap:12px; font-size:12px; padding:4px 0; color:var(--text2); }
.js-summary-row span:first-child { width:90px; flex-shrink:0; color:var(--text3); font-weight:500; }
.js-summary-row span:last-child { color:var(--text); }

/* ── Tasks View Switcher (List / Calendar) ── */
.tasks-view-switch { display:flex; gap:0; margin-bottom:14px; border-bottom:0.5px solid var(--border); }
.tasks-view-tab { padding:8px 18px; border:none; background:transparent; color:var(--text3); font-size:13px; cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-0.5px; }
.tasks-view-tab.active { color:var(--text); font-weight:500; border-bottom-color:var(--green); }
.tasks-view-tab:hover { color:var(--text2); }

/* ── Calendar Toolbar ── */
.cal-toolbar { display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin-bottom:12px; padding:8px 0; }
.cal-mode-tabs { display:flex; gap:2px; background:var(--surface2); border-radius:var(--radius); padding:3px; }
.cal-mode-tab { padding:5px 14px; border:none; background:transparent; color:var(--text3); font-size:12px; border-radius:6px; cursor:pointer; }
.cal-mode-tab.active { background:var(--surface); color:var(--text); font-weight:500; box-shadow:0 1px 2px rgba(0,0,0,0.05); }
.cal-nav { display:flex; gap:4px; }
.cal-nav-btn { padding:5px 10px; min-width:28px; border:0.5px solid var(--border2); background:var(--surface); color:var(--text2); border-radius:var(--radius); font-size:14px; cursor:pointer; line-height:1; }
.cal-nav-btn:hover { background:var(--surface2); color:var(--text); }
.cal-today-btn { font-size:12px; padding:5px 12px; }
.cal-period-label { font-size:14px; font-weight:500; color:var(--text); margin-right:auto; }
.cal-legend { display:flex; gap:12px; align-items:center; font-size:11px; color:var(--text3); flex-wrap:wrap; }
.cal-legend-item { display:flex; gap:5px; align-items:center; }
.cal-dot { display:inline-block; width:9px; height:9px; border-radius:50%; }
.cal-dot.cal-job { background:var(--blue); }
.cal-dot.cal-followup { background:var(--purple); }
.cal-dot.cal-task.cal-brand-graham { background:var(--green); }
.cal-dot.cal-task.cal-brand-lv { background:var(--amber); }

/* ── Calendar Month Grid ── */
.cal-month-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:0; border:0.5px solid var(--border2); border-radius:var(--radius); overflow:hidden; background:var(--surface); }
.cal-day-header { padding:8px 10px; font-size:11px; text-transform:uppercase; letter-spacing:0.05em; color:var(--text3); font-weight:600; background:var(--surface2); border-bottom:0.5px solid var(--border); border-right:0.5px solid var(--border); }
.cal-day-header:last-child { border-right:none; }
.cal-day-cell { min-height:108px; padding:6px 6px 8px; border-right:0.5px solid var(--border); border-bottom:0.5px solid var(--border); display:flex; flex-direction:column; gap:3px; background:var(--surface); }
.cal-day-cell:nth-child(7n+7) { border-right:none; }
.cal-day-cell.other-month { background:var(--surface2); }
.cal-day-cell.other-month .cal-day-num { color:var(--text3); }
.cal-day-cell.today { background:#FFFCEF; }
.cal-day-cell.today .cal-day-num { background:var(--green); color:#fff; border-radius:50%; width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; font-weight:600; }
.cal-day-num { font-size:12px; color:var(--text2); font-weight:500; padding:1px 2px; }
.cal-more { font-size:10px; color:var(--text3); padding:1px 4px; cursor:pointer; }

/* ── Calendar Week Grid ── */
.cal-week-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:0; border:0.5px solid var(--border2); border-radius:var(--radius); overflow:hidden; background:var(--surface); min-height:420px; }
.cal-week-col { display:flex; flex-direction:column; border-right:0.5px solid var(--border); }
.cal-week-col:last-child { border-right:none; }
.cal-week-col.today { background:#FFFCEF; }
.cal-week-header { padding:10px 12px; font-size:12px; color:var(--text2); font-weight:500; background:var(--surface2); border-bottom:0.5px solid var(--border); }
.cal-week-col.today .cal-week-header { background:#FFF6CC; }
.cal-week-num { color:var(--text); font-weight:600; }
.cal-week-events { padding:6px; display:flex; flex-direction:column; gap:4px; flex:1; }
.cal-empty { font-size:11px; color:var(--text3); padding:4px 2px; }

/* ── Calendar Day View ── */
.cal-day-view { background:var(--surface); border:0.5px solid var(--border2); border-radius:var(--radius); padding:14px; display:flex; flex-direction:column; gap:8px; min-height:300px; }
.cal-empty-large { color:var(--text3); font-size:13px; padding:40px 0; text-align:center; }
.cal-day-event { display:flex; gap:12px; align-items:flex-start; padding:11px 14px; border-radius:var(--radius); border:0.5px solid var(--border); cursor:pointer; background:var(--surface); transition:border-color 0.1s, transform 0.1s; }
.cal-day-event:hover { border-color:var(--border2); }
.cal-day-event-pill { font-size:10px; text-transform:uppercase; letter-spacing:0.05em; padding:3px 8px; border-radius:10px; font-weight:600; flex-shrink:0; align-self:flex-start; }
.cal-day-event.cal-job .cal-day-event-pill { background:var(--blue-light); color:var(--blue); }
.cal-day-event.cal-task.cal-brand-graham .cal-day-event-pill { background:var(--green-light); color:var(--green-dark); }
.cal-day-event.cal-task.cal-brand-lv .cal-day-event-pill { background:var(--amber-light); color:var(--amber); }
.cal-day-event.cal-followup .cal-day-event-pill { background:var(--purple-light); color:var(--purple); }
.cal-day-event-body { flex:1; min-width:0; }
.cal-day-event-title { font-size:13px; color:var(--text); font-weight:500; }
.cal-day-event-meta { font-size:11px; color:var(--text3); margin-top:3px; }

/* ── Calendar Event Chip (Month / Week) ── */
.cal-event { font-size:11px; padding:2px 6px; border-radius:4px; cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; line-height:1.4; border-left:3px solid transparent; }
.cal-event.cal-job { background:var(--blue-light); color:var(--blue); border-left-color:var(--blue); }
.cal-event.cal-task.cal-brand-graham { background:var(--green-light); color:var(--green-dark); border-left-color:var(--green); }
.cal-event.cal-task.cal-brand-lv { background:var(--amber-light); color:var(--amber); border-left-color:var(--amber); }
.cal-event.cal-followup { background:var(--purple-light); color:var(--purple); border-left-color:var(--purple); }
.cal-event:hover { filter:brightness(0.96); }

/* ── Calendar Event Popup ── */
.cal-popup-overlay { position:fixed; inset:0; background:transparent; z-index:90; }
.cal-popup { position:fixed; transform:translate(-50%, 8px); width:320px; max-width:calc(100vw - 24px); background:var(--surface); border:0.5px solid var(--border2); border-radius:var(--radius-lg); box-shadow:0 8px 24px rgba(0,0,0,0.18); padding:14px 16px; z-index:91; }
.cal-popup-header { display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.cal-popup-pill { font-size:10px; text-transform:uppercase; letter-spacing:0.05em; padding:3px 9px; border-radius:10px; font-weight:600; }
.cal-popup-pill.cal-job { background:var(--blue-light); color:var(--blue); }
.cal-popup-pill.cal-task.cal-brand-graham { background:var(--green-light); color:var(--green-dark); }
.cal-popup-pill.cal-task.cal-brand-lv { background:var(--amber-light); color:var(--amber); }
.cal-popup-pill.cal-followup { background:var(--purple-light); color:var(--purple); }
.cal-popup-close { margin-left:auto; background:none; border:none; font-size:18px; line-height:1; color:var(--text3); cursor:pointer; padding:0 4px; }
.cal-popup-close:hover { color:var(--text); }
.cal-popup-name { display:block; font-size:15px; font-weight:600; color:var(--text); margin-bottom:10px; }
.cal-popup-name-link { color:var(--green); cursor:pointer; text-decoration:none; }
.cal-popup-name-link:hover { text-decoration:underline; }
.cal-popup-meta { display:flex; flex-direction:column; gap:6px; margin-bottom:0; }
.cal-popup-row { display:flex; gap:10px; font-size:12px; }
.cal-popup-row span:first-child { width:70px; flex-shrink:0; color:var(--text3); font-weight:500; }
.cal-popup-row span:last-child { color:var(--text); flex:1; word-break:break-word; }
