/* ══════════════════════════════════════════════════════════════════════════
   JOB CARD — mobile 2-col · desktop 3-col · tall thumb spans full height
   ══════════════════════════════════════════════════════════════════════════ */

.job-card {
    max-width: 720px;
    width: 100%;
    box-sizing: border-box;
}

/* Mobile: kill the 4px colored state stripe on the left edge */
@media (max-width: 768px) {
    .job-card {
        border-left-color: transparent !important;
        border-left-width: 1px !important;
    }
}

/* Header as a CSS grid — positions & spans change per breakpoint */
.job-card .job-header {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 12px;
    row-gap: 10px;
    padding: 14px 16px 14px 14px;
    cursor: pointer;
    user-select: none;
}
.job-card .job-header:hover { background: rgba(41, 104, 166, 0.035); }
[data-theme="dark"] .job-card .job-header:hover { background: rgba(138, 170, 200, 0.05); }

/* ─── Thumbnail ─── */
.jc-thumb {
    grid-column: 1;
    grid-row: 1;
    width: 64px;
    height: 80px;
    border-radius: 14px;
    background-color: var(--gray-1);
    border: 1px dashed var(--gray-2);
    color: var(--gray-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    /* Longhand `background-color` (not shorthand `background`) so the
       transition can't sweep `background-position` and pan the photo
       on hover for `.jc-thumb-photo`. */
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.jc-thumb:hover {
    background-color: rgba(41, 104, 166, 0.08);
    border-color: var(--blue);
    color: var(--blue);
}
.jc-thumb-placeholder svg { opacity: 0.6; }
.jc-thumb-placeholder:hover svg { opacity: 1; }

/* Typed fallback thumbnail — muted gradient tile with a white glyph centered.
   Used when a job has no uploaded photo yet but its job_type maps to a
   known category (EV charger, panel, etc.). Clicking still triggers the
   camera (quickAddPhoto) so the call-to-action is preserved.

   iOS-style raised tile: narrow tonal delta + inset top highlight +
   bottom edge line + faint outer drop. Icon sits at 55% opacity so the
   tile reads as a quiet chip, not a logo. */
.jc-thumb-typed,
.jc-thumb-typed:hover,
.jc-thumb-typed:focus,
.jc-thumb-typed:active {
    border: 0;
    background: linear-gradient(160deg, #2A3D55 0%, #3B5273 100%);
    color: #FFFFFF;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.10),
        inset 0 -1px 0 rgba(0, 0, 0, 0.22),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04),
        0 1px 2px rgba(15, 32, 60, 0.10);
}
.jc-thumb-typed::after {
    /* Soft bottom vignette — keeps the glyph weight balanced and gives
       the tile a hint of depth without darkening the icon. */
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(0,0,0,0) 35%, rgba(0,0,0,0.14) 100%);
    pointer-events: none;
    border-radius: inherit;
}
.jc-thumb-typed { position: relative; }
.jc-thumb-glyph {
    width: 58%;
    height: 58%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.55);
    position: relative;
    z-index: 1;
    transition: color 0.18s ease;
}
.jc-thumb-glyph svg { width: 100%; height: 100%; display: block; }
.jc-thumb-typed:hover .jc-thumb-glyph,
.jc-thumb-typed:focus .jc-thumb-glyph { color: rgba(255, 255, 255, 0.78); }

/* Per-category background — muted, narrow tonal delta.
   All sit in the navy-blue family so the card list reads as a coherent
   set, with hue shifts to differentiate types without looking bright. */
.jc-thumb-ev-charger { background: linear-gradient(160deg, #1F3D5C 0%, #355A7E 100%); }
.jc-thumb-main-panel { background: linear-gradient(160deg, #243144 0%, #3A4F6A 100%); }
.jc-thumb-sub-panel  { background: linear-gradient(160deg, #2C415A 0%, #455F7C 100%); }
.jc-thumb-lighting   { background: linear-gradient(160deg, #3D4660 0%, #5A6480 100%); }
.jc-thumb-outlet     { background: linear-gradient(160deg, #28415A 0%, #44617D 100%); }
.jc-thumb-service    { background: linear-gradient(160deg, #3A4250 0%, #545C6E 100%); }
.jc-thumb-generator  { background: linear-gradient(160deg, #1F3F4E 0%, #355A6B 100%); }
.jc-thumb-other      { background: linear-gradient(160deg, #33414F 0%, #4F5D6C 100%); }

/* Photo thumbnail — fills the button with the latest Drive photo.
   No hover/tap color change: with a real image filling the frame the
   border-color flip read as the thumbnail "floating" on touch.
   Override .jc-thumb's hover too so :hover doesn't reach through. */
.jc-thumb-photo,
.jc-thumb-photo:hover,
.jc-thumb-photo:focus,
.jc-thumb-photo:active {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-style: solid;
    border-color: var(--gray-2);
    color: var(--gray-3);
    overflow: hidden;
    padding: 0;
}
.jc-thumb-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
}
/* Dark theme parity — no tap flash on the photo thumb. The doubled
   class chain (.jc-thumb.jc-thumb-photo) outranks the generic
   `[data-theme="dark"] .jc-thumb:hover` rule that lives further down. */
[data-theme="dark"] .jc-thumb.jc-thumb-photo,
[data-theme="dark"] .jc-thumb.jc-thumb-photo:hover,
[data-theme="dark"] .jc-thumb.jc-thumb-photo:focus,
[data-theme="dark"] .jc-thumb.jc-thumb-photo:active {
    background-color: transparent;
    border-color: var(--gray-2);
}
[data-theme="dark"] .jc-thumb.jc-thumb-typed,
[data-theme="dark"] .jc-thumb.jc-thumb-typed:hover,
[data-theme="dark"] .jc-thumb.jc-thumb-typed:focus,
[data-theme="dark"] .jc-thumb.jc-thumb-typed:active {
    border-color: rgba(255, 255, 255, 0.10);
    color: #FFFFFF;
}

/* ─── Identity column ─── */
.jc-identity {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 0;
}
.jc-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.jc-client-name {
    font-weight: 700;
    font-size: 17px;
    color: var(--navy);
    line-height: 1.25;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: transparent;
    border: none;
    padding: 0;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}
.jc-client-name:hover { color: var(--blue); }

/* Top-right controls */
.jc-status-pill { flex: 0 0 auto; }
.jc-expand-desktop { display: none; }
.jc-kebab {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    color: var(--gray-3);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.jc-kebab:hover { background: var(--gray-1); color: var(--text); }

/* Open/Close button. On a closed card it sits in the top-right status slot;
   when opened, it becomes the bottom-centered Close dock. */
.jc-expand {
    flex: 0 0 auto;
    margin-left: auto;
    background: var(--blue);
    color: var(--white);
    border: none;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: background 0.15s, transform 0.12s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.jc-expand:hover { background: var(--navy); }
.jc-expand:active { transform: scale(0.96); }
.jc-expand svg { margin-right: 6px; }
.jc-expand .jc-expand-close { display: none; }
.job-card.is-expanded .jc-expand .jc-expand-open { display: none; }
.job-card.is-expanded .jc-expand .jc-expand-close { display: inline; }
/* When the card is open, the same button becomes a bottom-centered docked
   action. It stays reachable while reading long sections without fighting
   the header or looking like a stray floating menu. */
.job-card.is-expanded .jc-expand {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
    z-index: 7900;
    width: min(520px, calc(100vw - 32px));
    height: 52px;
    justify-content: center;
    border-radius: 16px;
    font-size: 13px;
    box-shadow: 0 12px 30px rgba(15, 27, 45, 0.24);
    transform: translateX(-50%);
}
.job-card.is-expanded .jc-expand:active { transform: translateX(-50%) scale(0.985); }
.job-card.is-expanded .close-card-block { display: none; }
/* Suppress the card's hover translateY when the card is open — that
   transform creates a containing block for the fixed Close button, which
   would re-anchor it to the card on mouseover instead of the viewport. */
.job-card.is-expanded:hover { transform: none; }

/* While a card is expanded, hide every other card, the section group
   dividers, and the bars above the job list (stats + filter bar). The page
   then only contains the open card — bounding scroll on both ends so the
   user can't drift into unrelated UI by scrolling. */
body.has-expanded-job .job-card:not(.is-expanded) { display: none; }
body.has-expanded-job .job-section-divider { display: none; }
body.has-expanded-job #stats-bar { display: none !important; }
body.has-expanded-job #filter-bar { display: none !important; }

/* Job-type pill */
.jc-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    background: #FFE7B5;
    color: #6E4700;
    border: 1px solid #C58A1F;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    width: fit-content;
    max-width: 100%;
    margin-top: 2px;
}
[data-theme="dark"] .jc-type-pill {
    background: rgba(245, 158, 11, 0.18);
    color: #F5C56D;
    border-color: rgba(245, 158, 11, 0.45);
}
.jc-type-icon { font-size: 13px; line-height: 1; }
.jc-type-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40ch;
}

/* Address (plain clickable) */
.jc-addr {
    font-size: 13px;
    color: var(--text-lt);
    line-height: 1.35;
    text-decoration: none;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    width: fit-content;
    max-width: 100%;
    text-align: left;
}
.jc-addr:hover { color: var(--blue); text-decoration: underline; }
.jc-addr-empty { color: var(--red); font-style: italic; }
.jc-addr-empty:hover { color: var(--red); text-decoration: underline; }
[data-theme="dark"] .jc-addr-empty { color: #E74C3C; }

.jc-city {
    font-size: 13px;
    color: var(--text-lt);
    line-height: 1.35;
}

.jc-jobnum {
    font-size: 11px;
    color: var(--gray-3);
    font-family: 'DM Mono', ui-monospace, monospace;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* ─── Meta column (desktop) — badge+kebab top, financials stacked ─── */
.jc-meta { display: none; }
.jc-meta-top {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}
.jc-fin-stack {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 8px;
}
.jc-fin-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 18px;
    font-size: 12px;
}
.jc-fin-line .jc-fin-lbl {
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-lt);
    font-size: 10px;
}
.jc-fin-line .jc-fin-val {
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.jc-fin-line .jc-fin-val.received { color: var(--green); }
.jc-fin-line .jc-fin-val.balance  { color: var(--red); }

/* ─── Progress row (pills + bar) — mobile: indented under identity ─── */
.jc-progress-row {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.jc-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid transparent;
}
.jc-pill-state                    { background: #C7DEFB; color: #154E8A; border-color: #2E75B6; }
.jc-pill-state.progress-ready     { background: #CFEDD8; color: #0F5A2D; border-color: #1F9D55; }
.jc-pill-state.progress-permit    { background: #FFE7B5; color: #7E5300; border-color: #C58A1F; }
.jc-pill-state.progress-material  { background: #FFE0C6; color: #8A3D08; border-color: #E07D1F; }
.jc-pill-state.progress-progress  { background: #C7DEFB; color: #154E8A; border-color: #2E75B6; }
.jc-pill-state.progress-blocked   { background: #FBD0D0; color: #931515; border-color: #C0392B; }
.jc-pill-state.progress-closed    { background: #DDE0E5; color: #4B5563; border-color: #99A0AB; }
.jc-pill-state.progress-pending   { background: #E5E7EB; color: #4B5563; border-color: #99A0AB; }
.jc-pill-pct   { background: #EEF1F5; color: #2A3545; border-color: #C8CFD8; }
[data-theme="dark"] .jc-pill-pct { background: var(--gray-2); color: var(--text-lt); border-color: transparent; }
[data-theme="dark"] .jc-pill-state                   { background: rgba(46, 117, 182, 0.22); color: #9BC4F0; border-color: rgba(46, 117, 182, 0.55); }
[data-theme="dark"] .jc-pill-state.progress-ready    { background: rgba(31, 157, 85, 0.22); color: #6FD89B; border-color: rgba(31, 157, 85, 0.55); }
[data-theme="dark"] .jc-pill-state.progress-permit   { background: rgba(197, 138, 31, 0.22); color: #F0C97D; border-color: rgba(197, 138, 31, 0.55); }
[data-theme="dark"] .jc-pill-state.progress-material { background: rgba(224, 125, 31, 0.22); color: #F1A86A; border-color: rgba(224, 125, 31, 0.55); }
[data-theme="dark"] .jc-pill-state.progress-progress { background: rgba(46, 117, 182, 0.22); color: #9BC4F0; border-color: rgba(46, 117, 182, 0.55); }
[data-theme="dark"] .jc-pill-state.progress-blocked  { background: rgba(192, 57, 43, 0.22); color: #F09185; border-color: rgba(192, 57, 43, 0.55); }
[data-theme="dark"] .jc-pill-state.progress-closed,
[data-theme="dark"] .jc-pill-state.progress-pending  { background: rgba(153, 160, 171, 0.18); color: #B6BEC9; border-color: rgba(153, 160, 171, 0.45); }

.jc-bar-wrap {
    flex: 1 1 100%;
    height: 6px;
    background: var(--gray-1);
    border-radius: 3px;
    overflow: hidden;
    min-width: 120px;
}
.jc-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--green));
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* ─── Milestone rail ─── replaces the financial bar in the card header.
   Compact dot-and-line strip that mirrors the expanded-card hstrip but
   without labels — same visual language, just dense for the collapsed view. */
.jc-rail {
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 120px;
    height: 12px;
}
.jc-rail-node {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-2, #D1D7DF);
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
.jc-rail-node.done    { background: #1F9D55; }
.jc-rail-node.current { background: var(--blue, #2E75B6); box-shadow: 0 0 0 2px rgba(46, 117, 182, 0.22); }
.jc-rail-node.overdue { background: #C0392B; box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.22); }
.jc-rail-line {
    flex: 1 1 auto;
    height: 2px;
    background: var(--gray-1, #E4E8ED);
    min-width: 4px;
    border-radius: 2px;
}
.jc-rail-line.done { background: #1F9D55; }
[data-theme="dark"] .jc-rail-node { background: #3A4658; }
[data-theme="dark"] .jc-rail-line { background: #2A3545; }
[data-theme="dark"] .jc-rail-node.done { background: #4CD592; }
[data-theme="dark"] .jc-rail-node.current {
    background: #4A90D9;
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.32);
}
[data-theme="dark"] .jc-rail-node.overdue {
    background: #E74C3C;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.32);
}
[data-theme="dark"] .jc-rail-line.done { background: #4CD592; }

/* ─── Mobile 3-col financial grid ─── */
.jc-fin-grid {
    grid-column: 2;
    grid-row: 3;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    padding-top: 2px;
}
.jc-fin-grid .jc-fin-cell { text-align: left; }
.jc-fin-grid .jc-fin-lbl {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-lt);
    margin-bottom: 2px;
}
.jc-fin-grid .jc-fin-val {
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.jc-fin-grid .jc-fin-val.received { color: var(--green); }
.jc-fin-grid .jc-fin-val.balance  { color: var(--red); }

/* ─── Divider (full-width on mobile) ─── */
.jc-divider {
    grid-column: 1 / -1;
    grid-row: 4;
    border: 0;
    border-top: 1px solid var(--gray-1);
    margin: 4px 0 2px;
    width: 100%;
}
[data-theme="dark"] .jc-divider { border-top-color: var(--gray-2); }

/* ─── Bottom strip (full-width on mobile) ─── */
.jc-bottom {
    grid-column: 1 / -1;
    grid-row: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.jc-next-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
    line-height: 1.35;
    flex: 1 1 220px;
    min-width: 0;
}
.jc-next-line strong { color: var(--text); font-weight: 700; }
.jc-next-icon { font-size: 14px; line-height: 1; }

/* Appointment button — responsive label + icon (mobile short, desktop full) */
.jc-appt-icon        { display: none; }
.jc-appt-text-short  { display: inline; }
.jc-appt-text-full   { display: none; }

/* Mobile: no icons in the bottom strip; keep everything on one line */
@media (max-width: 768px) {
    .jc-next-icon { display: none; }
    .jc-bottom    { flex-wrap: nowrap; }
    .jc-next-line {
        flex: 1 1 auto;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.jc-bottom-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.jc-appt-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(41, 104, 166, 0.1);
    color: var(--blue);
    border: 1px solid rgba(41, 104, 166, 0.3);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    box-sizing: border-box;
    transition: background 0.15s;
}
.jc-appt-btn:hover { background: rgba(41, 104, 166, 0.18); }

.jc-confirm-btn {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(39, 174, 96, 0.12);
    color: var(--green);
    border: 1px solid rgba(39, 174, 96, 0.35);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    box-sizing: border-box;
    transition: background 0.15s;
}
.jc-confirm-btn:hover { background: rgba(39, 174, 96, 0.2); }
[data-theme="dark"] .jc-confirm-btn {
    background: rgba(46, 204, 113, 0.12);
    border-color: rgba(46, 204, 113, 0.32);
    color: #5BD48B;
}

/* Map button — desktop-only; red teardrop + "Map" */
.jc-map-btn {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(192, 57, 43, 0.1);
    color: var(--red);
    border: 1px solid rgba(192, 57, 43, 0.3);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s;
}
.jc-map-btn:hover { background: rgba(192, 57, 43, 0.18); }

/* Dark-mode nudges */
[data-theme="dark"] .jc-appt-btn {
    background: rgba(74, 144, 217, 0.14);
    border-color: rgba(74, 144, 217, 0.35);
    color: #6AAAF0;
}
[data-theme="dark"] .jc-appt-btn:hover { background: rgba(74, 144, 217, 0.22); }
[data-theme="dark"] .jc-thumb:hover { background-color: rgba(74, 144, 217, 0.12); }

/* ══════════════════════════════════════════════════════════════════════════
   DESKTOP LAYOUT (≥769px): 3-col grid, tall thumbnail spans full card height
   ══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
    .job-card .job-header {
        grid-template-columns: 140px 1fr auto;
        grid-template-rows: auto 1fr auto auto auto;
        column-gap: 20px;
        row-gap: 12px;
        padding: 18px 22px 18px 18px;
    }
    .jc-thumb {
        grid-column: 1;
        grid-row: 1 / -1;
        width: 140px;
        height: auto;
        min-height: 180px;
        align-self: stretch;
    }
    .jc-identity {
        grid-column: 2;
        grid-row: 1;
        padding-right: 0; /* chevron moves right of meta col */
    }
    .jc-meta {
        display: flex;
        grid-column: 3;
        grid-row: 1;
        flex-direction: column;
        min-width: 200px;
        padding-right: 22px; /* room for chevron */
    }

    /* Hide mobile-only controls; .jc-meta shows the desktop pair. */
    .jc-name-row .jc-expand-mobile,
    .jc-name-row .jc-kebab { display: none; }
    .jc-expand-desktop { display: inline-flex; }

    /* Hide mobile fin-grid on desktop */
    .jc-fin-grid { display: none; }

    /* Divider + progress row + bottom span cols 2 & 3 (not under the thumb) */
    .jc-divider {
        grid-column: 2 / 4;
        grid-row: 2;
        margin-top: 6px;
    }
    .jc-progress-row {
        grid-column: 2 / 4;
        grid-row: 3;
    }
    .jc-bottom {
        grid-column: 2 / 4;
        grid-row: 4;
    }

    /* Desktop: pull Appt + Map pills to the left of the bottom row. */
    .jc-bottom .jc-bottom-actions { order: -1; }
    .jc-bottom .jc-next-line { order: 0; flex: 1 1 auto; }

    /* Show Map pill on desktop */
    .jc-map-btn { display: inline-flex; }

    /* Desktop: show the calendar icon + full "+ Appointment" label */
    .jc-appt-icon       { display: inline-block; }
    .jc-appt-text-short { display: none; }
    .jc-appt-text-full  { display: inline; }

    /* Larger client name on desktop */
    .jc-client-name { font-size: 18px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   CARD POLISH v2 — tap pulse, photo modal, link-styled address, thumb sizing,
   tighter appt pill, 2-col card grid on wide desktop, stat-card border retired
   ══════════════════════════════════════════════════════════════════════════ */

/* ─── Address — tappable to open preview modal, no longer a Google Maps link.
   The dedicated Map button below the card handles maps. ─── */
.jc-addr {
    color: var(--text-lt);
    text-decoration: none;
    font-weight: 500;
}
.jc-addr:hover { color: var(--blue); }
[data-theme="dark"] .jc-addr { color: var(--text-lt); }
[data-theme="dark"] .jc-addr:hover { color: var(--blue); }

/* ─── Mobile thumb: more width + height ─── */
@media (max-width: 768px) {
    .jc-thumb { width: 84px; height: 100px; }
}

/* ─── Appointment button — tighter vertical padding, matches map-pill height ─── */
/* Bottom-strip pills — identical sizing box so the three buttons line up */
.jc-appt-btn,
.jc-map-btn,
.jc-confirm-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    line-height: 1.2;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    height: 30px;
    box-sizing: border-box;
    border-radius: 10px;
}

/* iPhone collapsed job card: content must not share the narrow thumb column.
   Keep the image/name as the top row, then let progress, numbers, and next
   action use the full card width below. */
@media (max-width: 768px) {
    .job-card {
        max-width: none;
        overflow: hidden;
    }

    .job-card .job-header {
        grid-template-columns: 92px minmax(0, 1fr);
        grid-template-rows: auto auto auto auto auto;
        column-gap: 12px;
        row-gap: 12px;
        min-height: 236px;
        padding: 16px 14px 14px;
        align-items: start;
    }

    .jc-thumb {
        grid-column: 1;
        grid-row: 1;
        width: 84px;
        height: 104px;
        align-self: start;
    }

    .jc-identity {
        grid-column: 2;
        grid-row: 1;
        min-height: 104px;
        justify-content: flex-start;
        padding-right: 0;
    }

    .jc-name-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: start;
        gap: 6px;
    }

    .jc-client-name {
        display: block;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        line-height: 1.18;
        max-height: none;
    }

    .jc-addr {
        display: block;
        width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.25;
    }

    .jc-city {
        line-height: 1.25;
    }

    .jc-type-pill {
        max-width: 100%;
    }

    .jc-progress-row {
        grid-column: 1 / -1;
        grid-row: 2;
        padding-top: 2px;
    }

    .jc-fin-grid {
        grid-column: 1 / -1;
        grid-row: 3;
        gap: 8px;
        padding-top: 0;
    }

    .jc-fin-grid .jc-fin-val {
        font-size: 13px;
    }

    .jc-divider {
        grid-column: 1 / -1;
        grid-row: 4;
        margin: 0;
    }

    .jc-bottom {
        grid-column: 1 / -1;
        grid-row: 5;
        flex-wrap: wrap;
        align-items: flex-start;
        padding-top: 0;
        min-height: 32px;
    }

    .jc-next-line {
        flex: 1 1 100%;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}

/* ─── Tap-feedback pulse ───
   Card sets --pulse (R,G,B) per state; the animation uses rgba() so the ring
   fades cleanly. Default falls back to the app blue. */
.job-card              { --pulse: 41, 104, 166; }
.job-card.card-ready   { --pulse: 26, 128, 64; }
.job-card.card-permit  { --pulse: 212, 160, 23; }
.job-card.card-material{ --pulse: 230, 126, 34; }
.job-card.card-progress{ --pulse: 41, 104, 166; }
.job-card.card-blocked { --pulse: 192, 57, 43; }
.job-card.card-closed  { --pulse: 156, 163, 175; }

@keyframes jcCardPulse {
    0%   { box-shadow: 0 0 0 0   rgba(var(--pulse), 0.55); }
    45%  { box-shadow: 0 0 0 6px rgba(var(--pulse), 0.15); }
    100% { box-shadow: 0 0 0 0   rgba(var(--pulse), 0);    }
}
.job-card.jc-tap-pulse { animation: jcCardPulse 450ms ease-out; }

/* ─── Photo upload progress overlay ─── */
.photo-uploading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.photo-uploading-overlay.photo-uploading-visible {
    opacity: 1;
    pointer-events: auto;
}
.photo-uploading-card {
    background: #fff;
    color: var(--navy);
    padding: 22px 28px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-width: 220px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .photo-uploading-card {
    background: var(--card-bg, #1f2530);
    color: var(--text);
}
.photo-uploading-spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid rgba(41, 104, 166, 0.2);
    border-top-color: var(--blue);
    animation: spin 0.9s linear infinite;
}
.photo-uploading-label {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

/* ─── Background upload chip ─── */
/* Non-blocking chip that appears while photo uploads run in the
   background. Sits at the bottom of the screen above the bottom nav,
   doesn't intercept taps elsewhere. Replaces the legacy full-screen
   .photo-uploading-overlay for the new fire-and-forget flow. */
.upload-chip {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + var(--btab-h, 0px) + 16px);
    transform: translate(-50%, 12px);
    z-index: 9000;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(27, 51, 80, 0.96);
    color: #fff;
    font: 600 13px/1 'DM Sans', sans-serif;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.30);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
    max-width: calc(100vw - 32px);
}
.upload-chip.upload-chip-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}
.upload-chip-spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    animation: spin 0.9s linear infinite;
    flex: 0 0 auto;
}
.upload-chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
[data-theme="dark"] .upload-chip {
    background: rgba(15, 21, 32, 0.96);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

/* ─── Photo cropper modal ─── */
.photo-crop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    z-index: 10000;
    padding: 20px;
    /* Disable native pinch-zoom while cropping so it doesn't fight the
       pointer-event drag on the crop rectangle. */
    touch-action: none;
    user-select: none;
    animation: jcFadeIn 0.15s ease-out;
}
.photo-crop-stage {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    max-width: 92vw;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.photo-crop-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}
.photo-crop-rect {
    position: absolute;
    border: 2px solid rgba(255, 255, 255, 0.95);
    /* Single huge box-shadow = the dim mask outside the crop rect. */
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
    cursor: move;
    box-sizing: border-box;
}
.photo-crop-handle {
    position: absolute;
    width: 22px;
    height: 22px;
    background: #fff;
    border: 2px solid var(--blue);
    border-radius: 50%;
    box-sizing: border-box;
    /* Sized for fingers — sits half outside the rect for easy grab. */
}
.photo-crop-handle[data-handle="nw"] { top: -11px; left: -11px;  cursor: nwse-resize; }
.photo-crop-handle[data-handle="ne"] { top: -11px; right: -11px; cursor: nesw-resize; }
.photo-crop-handle[data-handle="sw"] { bottom: -11px; left: -11px;  cursor: nesw-resize; }
.photo-crop-handle[data-handle="se"] { bottom: -11px; right: -11px; cursor: nwse-resize; }
.photo-crop-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    flex: 0 0 auto;
}
.photo-crop-btn {
    appearance: none;
    border: 0;
    border-radius: 10px;
    padding: 12px 18px;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    background: var(--blue);
    color: #fff;
    cursor: pointer;
    min-width: 150px;
    transition: filter 0.15s, transform 0.08s;
}
.photo-crop-btn:hover  { filter: brightness(1.08); }
.photo-crop-btn:active { transform: scale(0.97); }
.photo-crop-btn-ghost {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    min-width: 130px;
}
.photo-crop-btn-ghost:hover { background: rgba(255, 255, 255, 0.18); }

/* ─── Photo lightbox modal ─── */
.photo-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: zoom-out;
    padding: 20px;
    animation: jcFadeIn 0.15s ease-out;
}
.photo-modal-img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
/* Stack used when the modal needs action buttons under the image
   (job-card thumbnail flow). Plain showPhotoModal still works
   without this wrapper. */
.photo-modal-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    cursor: default;
    max-width: 95vw;
}
.photo-modal-stack .photo-modal-img {
    max-height: 80vh;
}
.photo-modal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
.photo-modal-btn {
    appearance: none;
    border: 0;
    border-radius: 10px;
    padding: 10px 18px;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    background: var(--blue);
    color: #fff;
    cursor: pointer;
    min-width: 140px;
    transition: filter 0.15s, transform 0.08s;
}
.photo-modal-btn:hover  { filter: brightness(1.08); }
.photo-modal-btn:active { transform: scale(0.97); }

/* Lightbox kebab + dropdown — appears top-right of the photo modal
   when caller passes jobNumber + filename. Provides per-photo actions
   (currently: Delete) without crowding the image. */
.photo-modal-kebab {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 20px);
    right: 20px;
    z-index: 10001;
    appearance: none;
    border: 0;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.photo-modal-kebab:hover { background: rgba(255, 255, 255, 0.28); }
.photo-modal-kebab:active { background: rgba(255, 255, 255, 0.36); }
.photo-modal-menu {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 68px);
    right: 20px;
    z-index: 10001;
    min-width: 180px;
    padding: 6px 0;
    background: #FFFFFF;
    border: 1px solid rgba(15, 26, 45, 0.10);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.40);
    cursor: default;
}
[data-theme="dark"] .photo-modal-menu {
    background: #1C202A;
    border-color: rgba(255, 255, 255, 0.10);
}
.photo-modal-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    appearance: none;
    background: transparent;
    border: 0;
    padding: 10px 14px;
    font: 500 13px/1.2 'DM Sans', sans-serif;
    color: var(--text);
    cursor: pointer;
}
.photo-modal-menu-item:hover { background: rgba(15, 26, 45, 0.06); }
[data-theme="dark"] .photo-modal-menu-item { color: #E4E8ED; }
[data-theme="dark"] .photo-modal-menu-item:hover { background: rgba(255, 255, 255, 0.06); }
.photo-modal-menu-item-danger { color: #C0392B; }
[data-theme="dark"] .photo-modal-menu-item-danger { color: #F5A89D; }
.photo-modal-menu-divider {
    height: 1px;
    background: rgba(15, 26, 45, 0.08);
    margin: 4px 0;
}
[data-theme="dark"] .photo-modal-menu-divider { background: rgba(255, 255, 255, 0.08); }
.photo-modal-menu-label {
    padding: 6px 14px 2px;
    font: 600 10px/1.2 'DM Sans', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #6B7280);
}
[data-theme="dark"] .photo-modal-menu-label { color: #9CA3AF; }
.photo-modal-btn-ghost {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
}
.photo-modal-btn-ghost:hover { background: rgba(255, 255, 255, 0.18); }
/* AI modal "click-outside ignored" feedback — runs on the modal box
   when the user taps the dim area. Tells them the click registered
   but the modal won't close (a deliberate choice so in-progress AI
   work isn't lost to a stray outside click). */
@keyframes ai-modal-shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-5px); }
    40%      { transform: translateX(5px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(3px); }
}
.ai-modal-shake {
    animation: ai-modal-shake 0.35s ease-in-out;
}

@keyframes jcFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ─── Wide desktop: 2-column card grid per section ─── */
@media (min-width: 1400px) {
    .job-section-cards {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
        /* `stretch` (the default) so both cards in a row match the
           taller one's height — keeps the row visually even when one
           card has more content (extra "Next:" line, longer name, etc.)
           or the other doesn't have a photo. */
        align-items: stretch;
    }
    .job-section-cards .job-card {
        margin-bottom: 0;
        max-width: 100%;
        justify-self: start;
        width: 100%;
        /* Flex-column so the inner `.job-header` can grow to fill the
           stretched card box; otherwise the right-side text would top-
           align and leave a gap, defeating the equal-height intent. */
        display: flex;
        flex-direction: column;
    }
    .job-section-cards .job-card > .job-header { flex: 1 0 auto; }
    /* When a card is opened it spans both columns so the expanded body
       gets the full reading width on desktop. */
    .job-section-cards .job-card.is-expanded { grid-column: 1 / -1; }
}

/* ══════════════════════════════════════════════════════════════════════════
   Job sections polish — financial dashboard style
   ══════════════════════════════════════════════════════════════════════════ */
.job-card.is-expanded .section-card {
    border-radius: 18px;
    margin-bottom: 12px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.96));
    box-shadow: 0 12px 30px rgba(15, 27, 45, 0.08);
}

.job-card.is-expanded .section-card.open {
    border-color: rgba(148, 163, 184, 0.34);
    box-shadow:
        inset 3px 0 0 var(--sc-tint-fg),
        0 18px 42px rgba(15, 27, 45, 0.12);
}

.job-card.is-expanded .section-card-header {
    min-height: 66px;
    padding: 16px 18px;
    gap: 14px;
}

.job-card.is-expanded .section-card-icon {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
    border-radius: 14px;
}

.job-card.is-expanded .section-card-name {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0;
}

.job-card.is-expanded .section-card-summary {
    margin-top: 4px;
    font-size: 13px;
}

.job-card.is-expanded .section-card-body {
    padding: 18px 20px 20px;
    background: linear-gradient(180deg, rgba(246, 248, 251, 0.64), rgba(255, 255, 255, 0));
}

.job-card.is-expanded .section-card-body .section-actions,
.job-card.is-expanded .section-card-body .inline-edit-actions {
    gap: 10px;
    margin-bottom: 16px;
}

.job-card.is-expanded .section-card-body .doc-import-btn,
.job-card.is-expanded .section-card-body .qa-btn {
    min-height: 36px;
    border-radius: 999px;
    font-weight: 800;
}

[data-theme="dark"] .job-card.is-expanded .section-card {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(23, 34, 51, 0.96));
    border-color: rgba(148, 163, 184, 0.18);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}

[data-theme="dark"] .job-card.is-expanded .section-card.open {
    border-color: rgba(166, 181, 204, 0.34);
    box-shadow:
        inset 3px 0 0 var(--sc-tint-fg),
        0 24px 64px rgba(0, 0, 0, 0.34);
}

[data-theme="dark"] .job-card.is-expanded .section-card.open .section-card-header {
    background: linear-gradient(90deg, var(--sc-tint-bg), rgba(30, 41, 59, 0));
}

[data-theme="dark"] .job-card.is-expanded .section-card-body {
    border-top-color: rgba(148, 163, 184, 0.16);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.22), rgba(23, 34, 51, 0));
}

.job-card.is-expanded .section-card[data-section="payments"] {
    --sc-tint-bg: rgba(100, 216, 135, 0.13);
    --sc-tint-fg: #32B86B;
}

[data-theme="dark"] .job-card.is-expanded .section-card[data-section="payments"] {
    --sc-tint-bg: rgba(100, 216, 135, 0.18);
    --sc-tint-fg: #64D887;
}

.job-card.is-expanded .payments-action-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, auto));
    justify-content: start;
    gap: 10px;
}

.job-card.is-expanded .payments-action-bar .doc-import-btn {
    border-radius: 999px;
    padding-inline: 15px;
}

.job-card.is-expanded .payments-summary-grid {
    gap: 12px;
    margin: 0 0 20px;
}

.job-card.is-expanded .payments-summary-tile,
.job-card.is-expanded .profitability-row-compact span {
    border-radius: 16px;
    padding: 16px 17px;
    background: rgba(255, 255, 255, 0.62);
    border-color: rgba(148, 163, 184, 0.24);
}

.job-card.is-expanded .payments-summary-tile strong {
    margin-top: 2px;
    font-size: 20px;
    line-height: 1.15;
}

.job-card.is-expanded .payment-card-list {
    gap: 11px;
}

.job-card.is-expanded .payment-row-card {
    border-radius: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.58);
    border-color: rgba(148, 163, 184, 0.24);
}

.job-card.is-expanded .payment-row-title {
    font-size: 15px;
    font-weight: 800;
}

.job-card.is-expanded .payment-row-meta {
    font-size: 13px;
    line-height: 1.4;
}

.job-card.is-expanded .payment-chip {
    min-height: 27px;
    padding: 4px 10px;
    border-radius: 999px;
}

.job-card.is-expanded .payment-subtitle,
.job-card.is-expanded .finance-subtitle {
    margin-top: 22px;
    margin-bottom: 12px;
}

.job-card.is-expanded .profitability-row-compact {
    padding: 0;
    gap: 10px;
}

.job-card.is-expanded .finance-details {
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.48);
    border-color: rgba(148, 163, 184, 0.24);
}

.job-card.is-expanded .finance-details summary {
    padding: 14px 16px;
}

[data-theme="dark"] .job-card.is-expanded .payments-summary-tile,
[data-theme="dark"] .job-card.is-expanded .payment-row-card,
[data-theme="dark"] .job-card.is-expanded .profitability-row-compact span,
[data-theme="dark"] .job-card.is-expanded .finance-details {
    background: rgba(255, 255, 255, 0.028);
    border-color: rgba(148, 163, 184, 0.18);
}

[data-theme="dark"] .job-card.is-expanded .payment-row-card:hover,
[data-theme="dark"] .job-card.is-expanded .payments-summary-tile:hover {
    border-color: rgba(148, 163, 184, 0.28);
}

@media (max-width: 768px) {
    .job-card.is-expanded .section-card {
        border-radius: 16px;
        margin-bottom: 10px;
    }

    .job-card.is-expanded .section-card-header {
        min-height: 62px;
        padding: 14px 15px;
    }

    .job-card.is-expanded .section-card-icon {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .job-card.is-expanded .section-card-body {
        padding: 15px;
    }

    .job-card.is-expanded .payments-action-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .job-card.is-expanded .payments-summary-tile {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 14px;
    }

    .job-card.is-expanded .payments-summary-tile span {
        margin-bottom: 0;
    }

    .job-card.is-expanded .payments-summary-tile strong {
        font-size: 19px;
        text-align: right;
    }

    .job-card.is-expanded .payment-row-card {
        padding: 15px;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   SCHEDULE VIEW — FullCalendar theming
   ══════════════════════════════════════════════════════════════════════════ */
.sched-wrap {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 14px 16px 18px;
    margin-bottom: 20px;
}

/* Tighten the toolbar + title on mobile */
.fc .fc-toolbar-title { font-size: 16px; }
.fc .fc-button {
    font-size: 12px;
    padding: 6px 10px;
    font-weight: 600;
}
.fc .fc-button-primary {
    background: var(--gray-bg);
    border: 1px solid var(--gray-2);
    color: var(--text);
}
.fc .fc-button-primary:hover {
    background: rgba(41, 104, 166, 0.08);
    border-color: var(--blue);
    color: var(--blue);
}
.fc .fc-button-primary:not(:disabled).fc-button-active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}
.fc .fc-today-button { text-transform: none; }
.fc-theme-standard th, .fc-theme-standard td { border-color: var(--gray-1); }
.fc-theme-standard .fc-scrollgrid { border-color: var(--gray-1); }

/* Event colors by source */
.fc-event.sched-src-job {
    background: rgba(41, 104, 166, 0.15);
    border-color: rgba(41, 104, 166, 0.5);
    color: var(--blue);
}
.fc-event.sched-src-milestone {
    background: rgba(31, 157, 85, 0.15);
    border-color: rgba(31, 157, 85, 0.5);
    color: #1F9D55;
}
.fc-event.sched-src-external {
    background: rgba(156, 163, 175, 0.2);
    border-color: rgba(156, 163, 175, 0.4);
    color: var(--gray-3);
}
.fc-event.sched-overdue {
    background: rgba(192, 57, 43, 0.18);
    border-color: rgba(192, 57, 43, 0.55);
    color: #C0392B;
}
.fc-event.sched-complete { opacity: 0.55; }

/* Today highlight gentler than default yellow */
.fc .fc-day-today {
    background: rgba(41, 104, 166, 0.06) !important;
}

/* Dark mode */
[data-theme="dark"] .sched-wrap {
    background: #121C2C;
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
[data-theme="dark"] .fc {
    color: #E6EAF0;
}
[data-theme="dark"] .fc-theme-standard th,
[data-theme="dark"] .fc-theme-standard td,
[data-theme="dark"] .fc-theme-standard .fc-scrollgrid {
    border-color: rgba(148, 163, 184, 0.22);
}
[data-theme="dark"] .fc .fc-col-header-cell {
    background: #172337;
}
[data-theme="dark"] .fc .fc-col-header-cell-cushion,
[data-theme="dark"] .fc .fc-daygrid-day-number,
[data-theme="dark"] .fc .fc-list-day-text,
[data-theme="dark"] .fc .fc-list-day-side-text {
    color: #DDE6F3;
}
[data-theme="dark"] .fc .fc-daygrid-day {
    background: rgba(15, 23, 42, 0.22);
}
[data-theme="dark"] .fc .fc-day-other {
    background: rgba(15, 23, 42, 0.38);
}
[data-theme="dark"] .fc .fc-day-other .fc-daygrid-day-number {
    color: #718096;
}
[data-theme="dark"] .fc .fc-button-primary {
    background: var(--gray-1);
    border-color: var(--gray-2);
    color: var(--text);
}
[data-theme="dark"] .fc .fc-button-primary:not(:disabled).fc-button-active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}
[data-theme="dark"] .fc-event {
    color: #F4F8FF;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}
[data-theme="dark"] .fc-event.sched-src-job {
    background: rgba(96, 165, 250, 0.26);
    border-color: rgba(96, 165, 250, 0.62);
    color: #CFE6FF;
}
[data-theme="dark"] .fc-event.sched-src-milestone {
    background: rgba(100, 216, 135, 0.24);
    border-color: rgba(100, 216, 135, 0.62);
    color: #C9F7D8;
}
[data-theme="dark"] .fc-event.sched-src-external {
    background: rgba(148, 163, 184, 0.24);
    border-color: rgba(148, 163, 184, 0.52);
    color: #E2E8F0;
}
[data-theme="dark"] .fc-event.sched-overdue {
    background: rgba(248, 113, 113, 0.28);
    border-color: rgba(248, 113, 113, 0.68);
    color: #FFE0DD;
}
[data-theme="dark"] .fc .fc-day-today {
    background: rgba(96, 165, 250, 0.16) !important;
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.32);
}
[data-theme="dark"] .fc .fc-highlight {
    background: rgba(96, 165, 250, 0.2);
}
[data-theme="dark"] .fc .fc-list,
[data-theme="dark"] .fc .fc-list-table td,
[data-theme="dark"] .fc .fc-list-day-cushion {
    background: #121C2C;
    border-color: rgba(148, 163, 184, 0.22);
}
[data-theme="dark"] .fc .fc-list-event:hover td {
    background: #1A273B;
}

@media (max-width: 768px) {
    .sched-wrap { padding: 8px 10px 12px; }
    .fc .fc-toolbar { gap: 6px; flex-wrap: wrap; }
    .fc .fc-toolbar-title { font-size: 15px; }
    .fc .fc-daygrid-day-number { font-size: 12px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PILL SYSTEM v2 — iOS-flavored unification
   Two visual treatments:
   • INFO pills (display only): flat capsule, tinted bg + colored border,
     no shadow, no hover state
   • ACTION pills (clickable): capsule + outer shadow, hover lifts 1px,
     press scales to 0.97 — recognizable affordance vs info badges
   ══════════════════════════════════════════════════════════════════════════ */

/* ─── INFO pills — display only, no interaction state. Capsule shape so
       they read as labels/badges. ─── */
.badge,
.jc-pill,
.jc-type-pill,
.timeline-status {
    border-radius: 999px;
    border-width: 1px;
    border-style: solid;
    line-height: 1.4;
    box-shadow: none;
    transition: none;
    text-transform: uppercase;
}
.badge          { padding: 4px 14px; font-size: 11px;   font-weight: 600; letter-spacing: 0.5px; }
.jc-pill        { padding: 4px 14px; font-size: 10px;   font-weight: 700; letter-spacing: 0.6px; }
.jc-type-pill   { padding: 4px 14px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.3px; text-transform: none; }
.timeline-status{ padding: 4px 14px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.8px; }

/* ─── ACTION pills v3 — all share the Edit Job ghost-button style:
       transparent fill, 1px colored border + text, slight 5px radius,
       fills with the accent on hover. Strong visual contrast vs the
       capsule info pills above. ─── */
.qa-btn,
.jc-appt-btn,
.jc-confirm-btn,
.jc-map-btn,
.jc-expand,
.card-preview-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    padding: 0 14px;
    background: transparent;
    border-width: 1px;
    border-style: solid;
    border-radius: 5px;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1;
    text-transform: none;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.18s;
    -webkit-tap-highlight-color: transparent;
}
.qa-btn:active,
.jc-appt-btn:active,
.jc-confirm-btn:active,
.jc-map-btn:active,
.jc-expand:active,
.card-preview-share:active { transform: scale(0.96); }

/* Color variants — outline takes the accent; hover fills it. */
.qa-btn                     { border-color: var(--navy); color: var(--navy); }
.qa-btn:hover               { background: var(--navy); color: var(--white); }

.jc-appt-btn                { border-color: var(--blue); color: var(--blue); }
.jc-appt-btn:hover          { background: var(--blue); color: var(--white); }

.jc-confirm-btn             { border-color: var(--green); color: var(--green); }
.jc-confirm-btn:hover       { background: var(--green); color: var(--white); }

.jc-map-btn                 { border-color: var(--red); color: var(--red); }
.jc-map-btn:hover           { background: var(--red); color: var(--white); }

.qa-btn.qa-collect          { border-color: var(--green); color: var(--green); font-weight: 700; }
.qa-btn.qa-collect:hover    { background: var(--green); color: var(--white); }

.qa-btn.qa-secondary        { border-color: var(--gray-3); color: var(--gray-3); }
.qa-btn.qa-secondary:hover  { background: var(--gray-3); color: var(--white); }

.qa-btn.qa-ai               { border-color: #7C3BF0; color: #7C3BF0; background: transparent; }
.qa-btn.qa-ai:hover         { background: #7C3BF0; color: var(--white); border-color: #7C3BF0; }

.jc-expand                  { border-color: var(--blue); color: var(--blue); padding: 0 18px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; }
.jc-expand:hover            { background: var(--blue); color: var(--white); }

/* When the Expand button floats at the top, keep ghost style but add a
   soft shadow so it stands out against any backdrop. */
.job-card.is-expanded .jc-expand {
    background: var(--surface, var(--white));
    box-shadow: 0 4px 14px rgba(15, 27, 45, 0.18);
}
.job-card.is-expanded .jc-expand:hover {
    background: var(--blue);
    color: var(--white);
}

.card-preview-share         { border-color: var(--blue); color: var(--blue); padding: 0 20px; }
.card-preview-share:hover   { background: var(--blue); color: var(--white); }

/* Maps link inside the preview modal — text-only secondary affordance. */
.card-preview-maps {
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--blue);
    font-size: 14px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.card-preview-maps:hover {
    background: rgba(46, 117, 182, 0.08);
    color: var(--navy);
}

/* Dark-mode adjustments — softer accent colors to pop on dark surfaces. */
[data-theme="dark"] .qa-btn                  { border-color: #8BB8E0; color: #8BB8E0; }
[data-theme="dark"] .qa-btn:hover            { background: #8BB8E0; color: var(--navy); }
[data-theme="dark"] .qa-btn.qa-secondary     { border-color: #6B7785; color: #B6BEC9; }
[data-theme="dark"] .qa-btn.qa-secondary:hover { background: #6B7785; color: var(--white); }
[data-theme="dark"] .qa-btn.qa-collect       { border-color: #5BD48B; color: #5BD48B; }
[data-theme="dark"] .qa-btn.qa-collect:hover { background: #5BD48B; color: var(--navy); }
[data-theme="dark"] .qa-btn.qa-ai            { border-color: #B58CFF; color: #C9B0FF; }
[data-theme="dark"] .qa-btn.qa-ai:hover      { background: #B58CFF; color: var(--navy); }
[data-theme="dark"] .jc-appt-btn             { border-color: #6AAAF0; color: #6AAAF0; }
[data-theme="dark"] .jc-appt-btn:hover       { background: #6AAAF0; color: var(--navy); }
[data-theme="dark"] .jc-confirm-btn          { border-color: #5BD48B; color: #5BD48B; }
[data-theme="dark"] .jc-confirm-btn:hover    { background: #5BD48B; color: var(--navy); }
[data-theme="dark"] .jc-map-btn              { border-color: #F09185; color: #F09185; }
[data-theme="dark"] .jc-map-btn:hover        { background: #F09185; color: var(--navy); }
[data-theme="dark"] .jc-expand               { border-color: #6AAAF0; color: #6AAAF0; }
[data-theme="dark"] .jc-expand:hover         { background: #6AAAF0; color: var(--navy); }
[data-theme="dark"] .job-card.is-expanded .jc-expand {
    background: #1A2332;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
[data-theme="dark"] .job-card.is-expanded .jc-expand:hover { background: #6AAAF0; color: var(--navy); }
[data-theme="dark"] .card-preview-share      { border-color: #6AAAF0; color: #6AAAF0; }
[data-theme="dark"] .card-preview-share:hover{ background: #6AAAF0; color: var(--navy); }
[data-theme="dark"] .card-preview-maps       { color: #6AAAF0; }
[data-theme="dark"] .card-preview-maps:hover { background: rgba(106, 170, 240, 0.12); color: #8BB8E0; }

@media (max-width: 768px) {
    .job-card.is-expanded .jc-expand {
        bottom: calc(var(--btab-h) + env(safe-area-inset-bottom, 0px) + 12px);
        width: min(560px, calc(100vw - 24px));
        height: 54px;
        border-radius: 18px;
    }
    body.clock-active .job-card.is-expanded .jc-expand {
        bottom: calc(var(--btab-h) + env(safe-area-inset-bottom, 0px) + 62px);
    }
}

/* ── Job-aware Create / AI Assistant — 2026-04-27 upgrade ── */

/* Scope preview — clamp to one line on the card; full text in modal */
.section-note.scope-preview {
    display: flex;
    align-items: baseline;
    gap: 6px;
    overflow: hidden;
}
.section-note.scope-preview .scope-preview-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.scope-preview-more {
    flex: 0 0 auto;
    background: none;
    border: none;
    padding: 0;
    color: var(--blue, #2968A6);
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.scope-preview-more:hover { color: var(--navy, #1F3A5F); }
[data-theme="dark"] .scope-preview-more { color: #6AAAF0; }
[data-theme="dark"] .scope-preview-more:hover { color: #8BB8E0; }

.scope-preview-modal {
    max-width: 560px;
    width: calc(100vw - 32px);
}
.scope-preview-modal-body {
    margin: 12px 0 0;
    padding: 14px 16px;
    background: #FFFBF0;
    border-left: 3px solid var(--gold, #D4A017);
    border-radius: 0 6px 6px 0;
    color: var(--text-lt, #3B4252);
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 60vh;
    overflow-y: auto;
}
[data-theme="dark"] .scope-preview-modal-body {
    background: rgba(212,160,23,0.08);
    color: #E2E6ED;
}

/* Action-sheet title takes the focused-job string when a card is open
   ("JOB #2534 — AASHAY SHRINGARPURE") in the same uppercase tone as
   "CREATE" — one line, ellipsis on overflow so a long client name
   doesn't push the title down. Scoped state gets a gold underline so
   the scoping reads as a banner without needing a separate block. */
.action-sheet-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 16px;
}
.action-sheet-title.action-sheet-title-scoped {
    padding-bottom: 10px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(212, 160, 23, 0.35);
}
[data-theme="dark"] .action-sheet-title.action-sheet-title-scoped {
    border-bottom-color: rgba(212, 160, 23, 0.45);
}

/* AI Assistant tile — golden sparkling stars accent. The icon is the real
   ✨ emoji (renders in native color across platforms), sized up inside a
   warm radial-gradient ring with a soft outer glow. The whole tile gets
   a thin gold frame so it reads as the "highlighted" action of the sheet. */
.action-sheet-item-ai {
    border-color: rgba(212, 160, 23, 0.55);
    box-shadow: 0 0 0 1px rgba(212, 160, 23, 0.20), 0 0 10px rgba(212, 160, 23, 0.10);
}
.action-sheet-item-ai .action-sheet-item-icon {
    background: radial-gradient(circle at 35% 30%, rgba(255, 233, 168, 0.85), rgba(212, 160, 23, 0.18));
    border-color: rgba(212, 160, 23, 0.55);
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.08);
}
.action-sheet-emoji {
    font-size: 22px;
    line-height: 1;
    filter: drop-shadow(0 0 3px rgba(212, 160, 23, 0.55));
}
.action-sheet-item-ai .action-sheet-item-label {
    color: #8E6A0F;
    font-weight: 600;
}
[data-theme="dark"] .action-sheet-item-ai {
    border-color: rgba(255, 233, 168, 0.55);
    box-shadow: 0 0 0 1px rgba(255, 233, 168, 0.22), 0 0 10px rgba(255, 233, 168, 0.12);
}
[data-theme="dark"] .action-sheet-item-ai .action-sheet-item-icon {
    background: radial-gradient(circle at 35% 30%, rgba(255, 233, 168, 0.32), rgba(212, 160, 23, 0.10));
    border-color: rgba(255, 233, 168, 0.55);
    box-shadow: 0 0 0 3px rgba(255, 233, 168, 0.10);
}
[data-theme="dark"] .action-sheet-item-ai .action-sheet-emoji {
    filter: drop-shadow(0 0 4px rgba(255, 233, 168, 0.70));
}
[data-theme="dark"] .action-sheet-item-ai .action-sheet-item-label {
    color: #FFE9A8;
}

/* AI Assistant sheet — opened from Create → AI Assistant. Rows show
   icon + label + one-line description so each tool is self-explanatory. */
.ai-sheet-box {
    max-width: 460px;
    width: calc(100vw - 32px);
}
.ai-sheet-context {
    margin: 8px 0 12px;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(124, 59, 240, 0.08);
    border-left: 3px solid #7C3BF0;
    font-size: 12px;
    color: var(--text-lt, #3B4252);
}
.ai-sheet-context strong { color: var(--navy, #1F3A5F); }
.ai-sheet-context-empty {
    background: rgba(122, 134, 148, 0.10);
    border-left-color: var(--gray-3, #7A8694);
    color: var(--gray-3, #7A8694);
}
[data-theme="dark"] .ai-sheet-context {
    background: rgba(181, 140, 255, 0.10);
    color: #E2E6ED;
}
[data-theme="dark"] .ai-sheet-context strong { color: #C9B0FF; }
[data-theme="dark"] .ai-sheet-context-empty {
    background: rgba(122, 134, 148, 0.14);
    border-left-color: #8896A6;
    color: #8896A6;
}

.ai-sheet-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 60vh;
    overflow-y: auto;
}
.ai-sheet-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: var(--white, #fff);
    border: 1px solid var(--gray-1, #E4E8ED);
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    font-family: 'DM Sans', sans-serif;
}
.ai-sheet-row:hover {
    background: rgba(124, 59, 240, 0.05);
    border-color: rgba(124, 59, 240, 0.4);
}
.ai-sheet-row-icon {
    flex: 0 0 auto;
    font-size: 20px;
    line-height: 1;
    margin-top: 2px;
}
.ai-sheet-row-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ai-sheet-row-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--navy, #1F3A5F);
}
.ai-sheet-row-desc {
    font-size: 12px;
    color: var(--gray-3, #7A8694);
    line-height: 1.35;
}
.ai-sheet-row-hint {
    flex: 0 0 auto;
    align-self: center;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-3, #7A8694);
}
[data-theme="dark"] .ai-sheet-row {
    background: var(--surface, #1A2332);
    border-color: var(--gray-2-dark, #2A3447);
}
[data-theme="dark"] .ai-sheet-row:hover {
    background: rgba(181, 140, 255, 0.10);
    border-color: rgba(181, 140, 255, 0.5);
}
[data-theme="dark"] .ai-sheet-row-label { color: #E2E6ED; }
[data-theme="dark"] .ai-sheet-row-desc { color: #8896A6; }
[data-theme="dark"] .ai-sheet-row-hint { color: #8896A6; }

/* ── Add Contact (AI) modal ─────────────────────────────────────────── */
.add-contact-ai-box {
    width: min(460px, 94vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.add-contact-ai-title-sub {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-3, #7A8694);
    margin-left: 6px;
}
.add-contact-ai-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 4px 0;
}
.add-contact-ai-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}
.add-contact-ai-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-3, #7A8694);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.add-contact-ai-drop {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 2px dashed var(--gray-2, #C4CCD6);
    border-radius: 12px;
    background: var(--gray-1, #F4F6F9);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.add-contact-ai-drop:hover,
.add-contact-ai-drop-over {
    background: rgba(41, 104, 166, 0.08);
    border-color: var(--blue, #2968A6);
}
.add-contact-ai-drop-icon { font-size: 24px; }
.add-contact-ai-drop-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    color: var(--text, #1A2433);
}
.add-contact-ai-drop-sub {
    font-size: 11px;
    color: var(--gray-3, #7A8694);
}
.add-contact-ai-thumb-wrap {
    position: relative;
    display: inline-block;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--gray-2, #C4CCD6);
    max-width: 100%;
}
.add-contact-ai-thumb {
    display: block;
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
    background: #000;
}
.add-contact-ai-thumb-x {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 16px;
    line-height: 22px;
    padding: 0;
    cursor: pointer;
}
.add-contact-ai-thumb-x:hover { background: rgba(0, 0, 0, 0.85); }
.add-contact-ai-status {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-family: 'DM Sans', sans-serif;
    background: rgba(41, 104, 166, 0.10);
    color: var(--blue, #2968A6);
}
.add-contact-ai-status-error {
    background: rgba(231, 76, 60, 0.10);
    color: #C0392B;
}
.add-contact-ai-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-1, #E4E8ED);
}
.add-contact-ai-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
[data-theme="dark"] .add-contact-ai-drop {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--gray-2-dark, #2A3447);
}
[data-theme="dark"] .add-contact-ai-drop:hover,
[data-theme="dark"] .add-contact-ai-drop-over {
    background: rgba(106, 170, 240, 0.10);
    border-color: #6AAAF0;
}
[data-theme="dark"] .add-contact-ai-status {
    background: rgba(106, 170, 240, 0.12);
    color: #6AAAF0;
}
[data-theme="dark"] .add-contact-ai-status-error {
    background: rgba(231, 76, 60, 0.18);
    color: #F9A8A0;
}
[data-theme="dark"] .add-contact-ai-actions {
    border-top-color: var(--gray-2-dark, #2A3447);
}
