/* rmq-job-action.css — the Job Action overlay
 * ============================================================================
 * A port of RMQ's #atomic-overlay (rmq_v2/templates/referrals.html, CSS
 * L1166-1470): same overlay gradient, the same 420px inner column, the same
 * header box, 2-column grid, tile shape, per-tile border tints, teal Back bar,
 * sub-panels and post-action box — so a rep who knows RMQ's action screen
 * slides straight into this one (Robert, 2026-09-06: "consistency").
 *
 * Every class is prefixed ja- so nothing collides with jobs.html. The tile
 * tint modifiers keep RMQ's own names (.tile-call …) but are scoped under
 * .ja-tile; the Service-only tints (.tile-items, .tile-order, .tile-invoice,
 * .tile-payment, .tile-docs) come from the approved side-by-side page
 * (CARD_ACTION_TILES_COMPARE.html). Contract: JOB_ACTION_DESIGN.md.
 */

/* ── Overlay ── */
.ja-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-3) 100%);
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    color: var(--text);
}
.ja-overlay.active { display: block; }
.ja-inner { max-width: 420px; margin: 0 auto; padding: 16px; padding-bottom: 80px; }

/* Full-width "Back to job" control sitting mid-grid (spans both tile
   columns) so you can leave from the middle of the page without scrolling
   to the bottom. It's navigation, not an action — styled as a teal bar,
   distinct from the action tiles. (RMQ .atomic-back-row) */
.ja-back-row { --a: var(--teal-rgb); grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 15px; margin: 4px 0; }

/* ── Job header (RMQ .atomic-prospect) ── */
.ja-prospect { padding: 16px; margin-bottom: 16px; }
.ja-prospect-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ja-prospect-name { font-size: 1.2rem; font-weight: 700; margin-bottom: 2px; }
.ja-prospect-meta { font-size: 0.8rem; color: var(--gray-70); }
.ja-prospect-phone { font-size: 0.85rem; color: var(--red); margin-top: 4px; }
/* The job site in teal (a separate site never passes for the home address);
   the customer's own address stays grey — same rule as the card */
.ja-prospect-site { font-size: 0.8rem; color: var(--teal); margin-top: 4px; display: flex; align-items: flex-start; gap: 5px; }
.ja-prospect-site.home { color: var(--gray-a0); }
.ja-prospect-site svg { flex-shrink: 0; margin-top: 2px; }
/* The status badge — the card's .status-badge values, self-contained here */
.ja-badge { white-space: nowrap; }

/* ── Action grid (RMQ .atomic-grid / .atomic-tile) ── */
.ja-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* The tablet shape (768 and wider, an iPad either way up): the overlay is the width of a one-form page
   (rmq-layout.css data-rmq-wide="form", 760) and the tiles go three across, not a phone column in the middle.
   It holds for every overlay that is not docked, at any width from 768: at 1100 and up an overlay opened fresh docks
   beside the open job (.ja-pane, below), but one opened on an iPad in portrait and then turned to landscape stays a
   sheet, and keeps this shape rather than falling back to the 420px phone column (Safari walk 2026-11-17). */
@media (min-width: 768px) {
    .ja-overlay:not(.ja-pane) .ja-inner { max-width: 760px; padding: 24px 32px 80px; }
    .ja-overlay:not(.ja-pane) .ja-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}
.ja-tile { padding: 16px 12px; text-align: center; position: relative; display: block; }
.ja-tile .ja-tile-icon { margin-bottom: 6px; }
.ja-tile .ja-tile-icon svg { display: inline-block; vertical-align: middle; }
.ja-tile .ja-tile-sub { margin-top: 3px; }

/* Tile colour accents — RMQ's values, RMQ's names */
.ja-tile.tile-call { --a: var(--green-rgb); }
.ja-tile.tile-text { --a: var(--blue-rgb); }
.ja-tile.tile-email { --a: var(--violet-rgb); }
.ja-tile.tile-facetime { --a: var(--green-525-rgb); }
.ja-tile.tile-contact { --a: var(--teal-rgb); }
.ja-tile.tile-schedule { --a: var(--gold-deep-rgb); }
.ja-tile.tile-quote { --a: var(--orange-500-rgb); }
/* The Sold slot — Complete Job wears RMQ's gradient "kill shot" tile */
.ja-tile.tile-assign { --a: var(--purple-rgb); }
.ja-tile.tile-convert { --a: var(--green-rgb); }
.ja-tile.tile-product { --a: var(--orange-475-rgb); }
.ja-tile.tile-status { --a: var(--blue-rgb); }
/* Service-only tiles — tints from the approved page */
.ja-tile.tile-items { --a: var(--teal-rgb); }
/* RFPA (214) — the one purple tile (proposed in the mockups) */
.ja-tile.tile-rfpa { --a: var(--violet-rgb); }
.ja-tile.tile-order { --a: var(--blue-rgb); }
.ja-tile.tile-invoice { --a: var(--orange-500-rgb); }
.ja-tile.tile-payment { --a: var(--gold-rgb); }

/* ── Compose screen (Text / Email) — RMQ .atomic-compose ── */
.ja-compose { display: none; padding: 16px; margin-top: 12px; }
.ja-compose.active { display: block; }
.ja-compose-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 12px; padding-bottom: 10px;
    border-bottom: 1px solid var(--line-06);
}
.ja-compose-channel { font-size: 1rem; font-weight: 600; }
.ja-compose-channel svg { display: inline-block; vertical-align: middle; }
.ja-compose-to { font-size: 0.82rem; color: var(--gray-a0); margin-top: 2px; }
.ja-compose-close {
    background: none; border: none; color: var(--gray-60); font-size: 1.2rem;
    cursor: pointer; padding: 0 4px; font-family: inherit;
}
.ja-compose-close:hover { color: var(--text); }
.ja-compose-subject-field {
    width: 100%; padding: 10px 12px; margin-bottom: 8px; box-sizing: border-box;
    background: var(--surface-05); border: 1px solid var(--line-15);
    border-radius: 8px; color: var(--text); font-size: 0.9rem; font-family: inherit;
}
.ja-compose-subject-field:focus { outline: none; border-color: var(--purple); }
.ja-compose-message-field {
    width: 100%; min-height: 100px; padding: 12px; box-sizing: border-box;
    background: var(--surface-05); border: 1px solid var(--line-15);
    border-radius: 8px; color: var(--text); font-size: 0.9rem; resize: vertical;
    font-family: inherit;
}
.ja-compose-message-field:focus { outline: none; border-color: var(--red); }
.ja-compose-hint { font-size: 0.7rem; color: var(--gray-60); margin-top: 6px; text-align: center; }
.ja-compose-send-btn { width: 100%; margin-top: 12px; }
.ja-compose-send-btn svg { display: inline-block; vertical-align: middle; }

/* ── GPS picker — RMQ .atomic-gps-picker ── */
.ja-gps-picker { --a: var(--teal-rgb); display: none; text-align: center; padding: 24px 16px; margin-top: 12px; }
.ja-gps-picker.active { display: block; }
.ja-gps-picker-title { font-size: 1rem; font-weight: 600; color: var(--gray-e0); margin: 8px 0 4px; }
.ja-gps-picker-sub { font-size: 0.8rem; color: var(--gray-88); margin-bottom: 16px; }
.ja-gps-picker-options { display: flex; flex-direction: column; gap: 8px; max-width: 260px; margin: 0 auto; }
/* One option row — the GPS apps, and the Edit Status moves share this shape */
.ja-option { width: 100%; }
.ja-option svg { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.ja-panel-icon { font-size: 1.3rem; margin-bottom: 4px; }
.ja-panel-icon svg { display: inline-block; vertical-align: middle; }

/* ── Call confirm — RMQ .atomic-call-confirm ── */
.ja-call-confirm { --a: var(--green-rgb); display: none; text-align: center; padding: 24px 16px; margin-top: 12px; }
.ja-call-confirm.active { display: block; }
.ja-call-confirm-phone { font-size: 1.5rem; font-weight: 700; color: var(--green); margin: 12px 0; letter-spacing: 0.05em; }
.ja-call-confirm-name { font-size: 0.9rem; color: var(--gray-a0); margin-bottom: 16px; }
.ja-call-confirm-btns { display: flex; gap: 10px; justify-content: center; }
.ja-call-confirm-btns button {
    padding: 12px 24px; border-radius: 10px; font-size: 0.9rem;
    font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; font-family: inherit;
}
.ja-call-confirm-btns button svg { display: inline-block; vertical-align: middle; }
.ja-btn-call-cancel { --a: var(--gray-a0-rgb); }
.ja-btn-call-go { --a: var(--green-rgb); }
/* the picker's own Cancel reuses the call-cancel look (RMQ does the same) */
.ja-gps-picker .ja-btn-call-cancel { margin-top: 12px; }

/* ── Post-action confirmation — RMQ .atomic-post-action ── */
.ja-post-action { display: none; text-align: center; padding: 24px 16px; margin-top: 12px; }
.ja-post-action.active { display: block; }
.ja-post-check { font-size: 2.5rem; margin-bottom: 8px; }
.ja-post-check svg { display: inline-block; vertical-align: middle; }
.ja-post-message { font-size: 0.9rem; color: var(--gray-c0); margin-bottom: 6px; }
.ja-post-logged { font-size: 0.72rem; color: var(--green); margin-bottom: 16px; }
.ja-post-logged svg { display: inline-block; vertical-align: middle; }
.ja-post-note-area {
    background: var(--surface-05); border: 1px solid var(--line-15);
    border-radius: 10px; padding: 10px; margin-bottom: 12px; text-align: left;
}
.ja-post-note-input {
    width: 100%; background: transparent; border: none; color: var(--text);
    font-size: 0.85rem; resize: none; outline: none; font-family: inherit;
    min-height: 60px; box-sizing: border-box;
}
.ja-post-note-input::placeholder { color: var(--gray-50); }
.ja-post-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.ja-btn-post {
    padding: 10px 20px; border-radius: 10px; font-size: 0.85rem;
    font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; font-family: inherit;
}
.ja-btn-post-skip { --a: var(--gray-a0-rgb); }

/* ── Pipeline input (Complete Job, and the Quote / Invoice / Documents /
      Edit Status hubs) — RMQ .atomic-pipeline-input ── */
.ja-pipeline-input { display: none; margin-top: 12px; padding: 16px; }
.ja-pipeline-input.active { display: block; }
.ja-pipeline-title { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.ja-pipeline-title svg { display: inline-block; vertical-align: middle; }
.ja-pipeline-sub { font-size: 0.82rem; color: var(--gray-a0); margin: -6px 0 12px; line-height: 1.5; }
.ja-pipeline-input-field {
    width: 100%; padding: 12px; margin-bottom: 10px; box-sizing: border-box;
    background: var(--surface-05); border: 1px solid var(--line-20);
    border-radius: 8px; color: var(--text); font-size: 1rem; font-family: inherit;
}
.ja-pipeline-input-field:focus { outline: none; border-color: var(--red); }
.ja-pipeline-note-field {
    width: 100%; min-height: 50px; padding: 10px; box-sizing: border-box;
    background: var(--surface-05); border: 1px solid var(--line-15);
    border-radius: 8px; color: var(--text); font-size: 0.85rem; resize: vertical;
    font-family: inherit; margin-bottom: 10px;
}
.ja-pipeline-note-field:focus { outline: none; border-color: var(--red); }
.ja-pipeline-btns { display: flex; gap: 8px; }
.ja-pipeline-btns button {
    flex: 1; padding: 12px; border-radius: 10px; font-size: 0.9rem;
    font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; font-family: inherit;
}
.ja-pipeline-btns button svg { display: inline-block; vertical-align: middle; }
.ja-btn-pipeline-cancel { --a: var(--gray-a0-rgb); }

/* ── Custom action panels — RMQ .atomic-custom ── */
.ja-custom { display: none; margin-top: 12px; padding: 16px; }
.ja-custom.active { display: block; }

/* ── No phone / email on file — RMQ .atomic-add-email shape ── */
.ja-add-contact { --a: var(--violet-rgb); display: none; margin-top: 12px; padding: 16px; }
.ja-add-contact.active { display: block; }
.ja-add-contact-icon { font-size: 1.3rem; text-align: center; margin-bottom: 8px; }
.ja-add-contact-icon svg { display: inline-block; vertical-align: middle; }
.ja-add-contact-title { text-align: center; font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }
.ja-add-contact-text { text-align: center; font-size: 0.82rem; color: var(--gray-a0); margin-bottom: 16px; line-height: 1.5; }
.ja-add-contact-text svg { display: inline-block; vertical-align: middle; }

/* ── Form group — RMQ .address-form-group ── */
.ja-form-group { margin-bottom: 12px; }
.ja-form-group label { display: block; font-size: 0.75rem; color: var(--gray-a0); margin-bottom: 4px; }
.ja-form-group input { width: 100%; font-family: inherit; }

/* ── Hub panels (Quote / Invoice / Documents) — the card's own rows and
      chips, so a quote reads the same in the overlay as on the card ── */
.ja-hub-row {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 8px 0; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ja-hub-row .ja-hub-main { font-weight: 600; font-size: 0.875rem; }
.ja-hub-row .ja-hub-main .muted { font-weight: 400; font-size: 0.72rem; color: var(--gray-a0); }
.ja-hub-row .ja-hub-meta { color: var(--gray-a0); font-size: 0.75rem; }
.ja-hub-sent { color: var(--gray-a0); font-size: 0.72rem; margin-top: 4px; }
.ja-hub-note { color: var(--gray-a0); font-size: 0.8rem; line-height: 1.5; padding: 4px 0 8px; }
.ja-hub-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ja-btn-small.ok { --a: var(--green-rgb); }
.ja-btn-small.send { --a: var(--teal-rgb); }
/* the card's glowing Generate button, without the animation (it sits in a panel) */
.ja-btn-generate { width: 100%; margin-top: 8px; }
.ja-rmq-line {
    display: flex; justify-content: space-between; align-items: center; padding: 8px 10px;
    margin-bottom: 8px; background: rgb(var(--teal-rgb) / 0.08); border: 1px solid rgb(var(--teal-rgb) / 0.3);
    border-radius: 8px; font-size: 0.8rem; color: var(--teal);
}
.ja-rmq-line b { color: var(--text); font-weight: 700; }
.ja-rmq-context { color: var(--gray-a0); font-size: 0.72rem; margin-top: 6px; }
/* invoice summary box — the card's .invoice-box values */
.ja-invoice-box { margin-top: 6px; padding: 12px 14px; }
.ja-invoice-box-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ja-invoice-number { font-size: 0.9rem; font-weight: 700; }
.ja-inv-line { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--gray-c0); padding: 2px 0; }
.ja-inv-balance-row {
    display: flex; justify-content: space-between; font-size: 0.95rem; font-weight: 700;
    padding-top: 8px; margin-top: 6px; border-top: 1px solid var(--line-08);
}
.ja-balance-due-pos { color: var(--gold); }
.ja-balance-zero { color: var(--teal); }
.ja-inv-stale {
    margin-top: 6px; padding: 6px 10px; background: rgb(var(--gold-rgb) / 0.08);
    border: 1px solid rgb(var(--gold-rgb) / 0.35); border-radius: 8px; color: var(--gold); font-size: 0.75rem;
}
/* document rows (Documents panel) */
.ja-doc-list { display: flex; flex-direction: column; gap: 8px; }
.ja-status-current { text-align: center; font-size: 0.82rem; color: var(--gray-a0); margin-bottom: 12px; }
.ja-status-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

/* ── Panel error line — RMQ .atomic-error ── */
.ja-error { color: var(--red); font-size: 0.8rem; margin-top: 8px; text-align: center; display: none; }
.ja-error.show { display: block; }

/* which color each tile is comes from the rules above; the look itself is the master's (rmq-components.css) */
.ja-btn-pipeline-confirm.gold { --a: var(--gold-rgb); }   /* Complete Job: the gold button */

/* ══════════════════════════════════════════════════════════════════════════
   Desktop: the Action panel as a PANE beside the job card (Robert, 2026-10-04,
   from proto_jobs_workspace.html). Nothing below 1100px changes: the phone keeps
   the full-screen sheet above. On a wide screen the overlay element is moved into
   jobs.html's #job-stage as its third column (list | the open job | tiles):
   - the tiles STAY open while actions run; the card's Action button opens and
     closes them
   - picking a tile moves that action's own panel into the detail column (the
     "work" slot) under a collapsed job strip; the card steps aside
   - the tiles never scroll: 2, 3 or 4 across, full → compact → rows, measured
   ══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1100px) {
    .ja-overlay.ja-pane { position: static; flex: 0 0 var(--ja-w, 450px); width: var(--ja-w, 450px); height: 100%; max-height: 100%;
                          background: transparent; z-index: auto; overflow: hidden;
                          opacity: 0; transform: translateX(32px); transition: opacity .2s ease-in, transform .2s ease-in, flex-basis .25s ease-out, width .25s ease-out; }
    .ja-overlay.ja-pane.active { display: block; opacity: 1; transform: none; transition: opacity .25s ease-out, transform .25s ease-out, flex-basis .25s ease-out, width .25s ease-out; }
    .ja-overlay.ja-pane .ja-inner { max-width: none; padding: 0; height: 100%; }
    .ja-overlay.ja-pane .ja-prospect { display: none; }        /* the card beside it already shows the job */
    /* The pane keeps its own way back, first in the grid (Robert, 2026-11-21: on desktop "there is no way to return to
       the card"): the card's Action button can be scrolled out of sight or hidden while an action runs */
    .ja-overlay.ja-pane .ja-back-row { order: -1; margin: 0 0 3px; padding: 9px; border-radius: 10px; }
    .ja-overlay.ja-pane .ja-grid { display: grid !important; grid-template-columns: repeat(var(--ja-cols, 2), 1fr); gap: 3px;
                                   padding: 4px; height: auto; max-height: 100%; align-content: start; overflow: hidden;
                                   background: var(--surface-03); border: 1px solid var(--line-20); border-radius: 14px; }
    .ja-overlay.ja-pane.ja-overflow .ja-grid { overflow-y: auto; }   /* the one case left: a very short window */
    .ja-overlay.ja-pane .ja-tile { padding: 10px 6px; border-radius: 10px; }
    .ja-overlay.ja-pane .ja-tile .ja-tile-icon { margin-bottom: 4px; }
    .ja-overlay.ja-pane.ja-compact .ja-tile { padding: 7px 6px; }
    .ja-overlay.ja-pane.ja-compact .ja-tile .ja-tile-sub { display: none; }
    .ja-overlay.ja-pane.ja-rows .ja-tile { display: flex; align-items: center; gap: 8px; text-align: left; padding: 5px 8px; }
    .ja-overlay.ja-pane.ja-rows .ja-tile .ja-tile-icon { margin: 0; width: 26px; height: 26px; flex-shrink: 0; }
    .ja-overlay.ja-pane.ja-rows .ja-tile .ja-tile-sub { display: none; }
    .ja-overlay.ja-pane.ja-rows .ja-tile .ja-tile-label { font-size: .76rem; }
    .ja-overlay.ja-pane .ja-tile.ja-on { border-color: rgb(var(--a) / 0.9); box-shadow: 0 0 0 1px rgb(var(--a) / 0.5); }
    /* sub-panels live in the work slot while the pane is open: none show inside the pane */
    .ja-overlay.ja-pane > .ja-inner > .rmq-card:not(.ja-prospect) { display: none; }

    /* the work slot: in the detail column where the card was, the action's panel under the job strip */
    .job-card.expanded.ja-hidden { display: none !important; }
    .ja-work { padding: 0 !important; background: transparent !important; border: 0 !important; box-shadow: none !important; overflow: visible !important; }
    .ja-work .ja-work-body > .rmq-card { margin-top: 0; }
    .ja-work .ja-work-body > .rmq-card.active { animation: ja-slide-in .25s ease-out; }
    @keyframes ja-slide-in { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
    .ja-strip { display: flex; align-items: center; gap: 12px; padding: 8px 12px; margin-bottom: 12px; }
    .ja-strip .ja-strip-wo { color: var(--teal); font-weight: 700; font-size: .82rem; }
    .ja-strip .ja-strip-who { font-weight: 700; flex: 1; }
    .ja-strip-toggle { padding: 2px 9px !important; font-size: 1rem !important; }
    .ja-strip.collapsed { display: inline-flex; padding: 3px 10px 3px 4px; gap: 8px; }
    .ja-strip.collapsed .ja-strip-who, .ja-strip.collapsed .ja-strip-badge { display: none; }   /* Back to job stays, collapsed or not */
}
@media (prefers-reduced-motion: reduce) {
    .ja-overlay.ja-pane, .ja-work .ja-work-body > .rmq-card.active { transition: none !important; animation: none !important; }
}
