/* ==========================================================================
   Taha Auto admin: job timing, the "should be done by now" and review cards,
   Mark paid, and the summary a paid, voided or finalized job opens as
   (js/admin.js, 27 Sep batch, finalized 29 Sep; rules in js/job-timing.js). Tokens only (admin.css, and
   admin-navy.css for the navy look); phone rules ≤ 720px like the job page.
   Colour is never alone: "Overdue", "Paid in full", "Void" are words too.
   ========================================================================== */

/* ---------- the planned finish on the job card (phone) and the invoice row (desktop) ---------- */
.jcard__due, .invrow__due { display: inline-flex; align-items: center; gap: 5px; min-width: 0; font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jcard__due svg, .invrow__due svg { flex: none; width: 14px; height: 14px; }
/* a flex line can't ellipsize itself: its words can, so a line that's still too long ends in "…" rather than mid-word */
.jcard__due .due__t, .invrow__due .due__t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jcard__due.is-late, .invrow__due.is-late { color: var(--warn-text); font-weight: 700; }
.invrow__due { display: flex; margin-top: 5px; font-size: 12px; }

/* ---------- Timing: a row under the job's controls on the desktop, its own folding section on a phone ---------- */
.ed__timing { align-items: end; }
.ed__timing-h { flex: 1 0 100%; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.ed__timing-h small { margin-left: 6px; font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.tlate { color: var(--warn-text); font-weight: 700; }
.tnone { color: var(--text-3); }

/* ---------- the cards over a job ---------- */
.jtop { grid-column: 1 / -1; display: grid; gap: 12px; min-width: 0; }
.jtop:empty { display: none; }
.jcheck { display: grid; gap: 12px; min-width: 0; padding: 14px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--warn-text) 45%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--warn-text) 12%, var(--card)), var(--card) 70%); }
.jcheck__head { display: grid; grid-template-columns: 40px minmax(0, 1fr) 44px; gap: 12px; align-items: start; }
.jcheck__ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--warn-text); background: color-mix(in srgb, var(--warn-text) 16%, transparent); }
.jcheck__ic svg { width: 22px; height: 22px; }
.jcheck__txt { min-width: 0; padding-top: 1px; }
.jcheck__txt h3 { margin: 0; font-size: 16px; font-weight: 750; letter-spacing: -.01em; line-height: 1.25; color: var(--text); text-transform: none; }
.jcheck__txt p { margin: 3px 0 0; font-size: 14px; line-height: 1.4; color: var(--text-2); overflow-wrap: anywhere; }
.jcheck__txt b { color: var(--text); font-weight: 650; }
.jcheck .jcheck__x { width: 44px; height: 44px; margin: -6px -6px 0 0; }
.jcheck__acts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.jcheck__acts > :first-child { grid-column: 1 / -1; }
.jcheck__acts .btn { min-height: 44px; padding: 0 8px; font-size: 15px; font-weight: 650; }
.jcheck__acts .btn--ok, .jcheck__acts .btn--primary { min-height: 48px; font-size: 16px; font-weight: 700; }
.jcheck__acts .btn svg { width: 18px; height: 18px; }
.jcheck__acts--one { grid-template-columns: minmax(0, 1fr); }
.jcheck .ctl { min-width: 0; }
.jcheck__pick[hidden] { display: none; }   /* .ctl is a grid: the attribute alone doesn't hide it */
.jcheck--review { border-color: rgba(var(--accent-rgb), .5); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--card)), var(--card) 70%); }
.jcheck--review .jcheck__ic { color: var(--accent-text); background: var(--accent-soft); }
.jcheck__msg { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 14px; line-height: 1.45; color: var(--text-2); overflow-wrap: anywhere; }
.jcheck .btn[aria-disabled="true"], .jsum .btn[aria-disabled="true"] { opacity: .5; }
@media (min-width: 721px) {
  .jtop { max-width: 760px; }
  .jcheck__acts { display: flex; flex-wrap: wrap; }
  .jcheck__acts .btn { padding: 0 16px; }
  .jcheck .ctl { max-width: 340px; }
}

/* ---------- Mark paid under Finalized for a $0 job on the desktop (a balance has the payment form's; narrower screens have the action bar's) ---------- */
.jfinish-paid { width: 100%; margin-top: 10px; }
@media (max-width: 1099px) { .jfinish-paid { display: none; } }

/* ---------- the paid (or voided) job's summary ---------- */
.inv.ed.ed--sum { max-width: 680px; grid-template-columns: minmax(0, 1fr); }
.jsum { display: grid; gap: 4px; min-width: 0; }
.jsum__title { margin: 0; font-size: 26px; font-weight: 800; line-height: 1.12; letter-spacing: -.03em; overflow-wrap: anywhere; }
.jsum__veh { margin: 6px 0 0; font-size: 16px; font-weight: 650; color: var(--text); }
.jsum__who { margin: 0; font-size: 14px; color: var(--text-2); }
.jsum__card { margin-top: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); overflow: hidden; }
.jsum__total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px; background: var(--ok-soft); border-bottom: 1px solid var(--line); }
.jsum__total span { font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--ok-text); }
.jsum__total b { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ed--void .jsum__total { background: var(--panel-2); }
.ed--void .jsum__total span { color: var(--text-3); }
.ed--void .jsum__total b { color: var(--text-2); text-decoration: line-through; text-decoration-thickness: 2px; }
.jsum__facts { margin: 0; padding: 0 16px; }
.jsum__facts > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 8px 0; border-top: 1px solid var(--line); }
.jsum__facts > div:first-child { border-top: 0; }
.jsum__facts dt { flex: none; font-size: 14px; color: var(--text-2); }
.jsum__facts dd { margin: 0; min-width: 0; font-size: 15px; font-weight: 600; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.jsum__spent dd { flex: 0 1 210px; }
.jsum__spent select.og-input { width: 100%; min-height: 44px; }
.jsum__acts { display: grid; gap: 10px; margin-top: 14px; }
.jsum__acts .btn { min-height: 52px; border-radius: 14px; font-size: 16px; font-weight: 700; }
.jsum__acts .btn svg { width: 20px; height: 20px; }
.jsum__lock { margin: 10px 0 0; font-size: 13px; line-height: 1.45; color: var(--text-3); }
.jsum__lock svg { width: 14px; height: 14px; vertical-align: -2px; }
@media (min-width: 721px) {
  .jsum__acts { grid-template-columns: 1fr 1fr; }
}

/* ---------- a finalized job with money still owed: the same summary, plus the balance, the payments and its link (29 Sep) ---------- */
.jsum__total--due { background: var(--accent-soft); }
.jsum__total--due span { color: var(--accent-text); }
/* Take payment + Mark paid share a row, whatever the width (one fills it when there's nothing owed) */
.jsum__acts--pay { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-columns: none; }
.jsum__sec { display: grid; gap: 8px; min-width: 0; margin-top: 18px; }
.jsum__sec .hint { margin: 0; }
.jsum__h { margin: 0; font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.jsum__sec .pay__row { min-height: 44px; font-size: 14.5px; }
.jsum__sec .pay__row .x { width: 44px; height: 44px; }
.jsum__sec .share__row .btn { min-height: 48px; border-radius: 12px; font-size: 15px; font-weight: 650; }
.jsum__sec .share__row .btn svg { width: 18px; height: 18px; }
.jsum__payform { margin: 10px 0 0; padding: 14px; gap: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.jsum__payform[hidden] { display: none; }   /* .payform is a grid: the attribute alone doesn't hide it */
.jsum__payform .ctl { min-width: 0; }
.jsum__payform .btn { min-height: 48px; border-radius: 12px; font-size: 15px; font-weight: 700; }
.ed--due .jsum__lock { margin-top: 14px; }
/* focus lands on these after a payment redraws the summary (sumFocus): a ring only for the keyboard */
.jsum__h[tabindex="-1"]:focus:not(:focus-visible), .jsum__total[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }
/* belt and braces: an editor left on screen for a job that just became final fades while the summary takes over */
.ed.is-stale > :not(.ed__top) { opacity: .55; }

/* ---------- phone ---------- */
@media (max-width: 720px) {
  .sec--timing .ed__ctl { padding: 0; background: none; border: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .sec--timing .ed__timing-h { display: none; }
  .sec--timing .ctl { min-width: 0; }
  .jcard__due { margin-top: 2px; }
  /* the summary has no action bar: the page ends where it does */
  body.ed-open .inv.ed.ed--sum { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
  .ed--sum .ed__hero-top { margin: 12px 0 4px; }
}

/* navy (the phone look): the amber and the paid green in the Figma's shades */
body.theme-navy .jcheck { border-color: #705725; background: linear-gradient(135deg, #2A2316, #111E2A 70%); }
body.theme-navy .jcheck__ic { color: #F5BD51; background: #392E18; }
body.theme-navy .jcheck--review { border-color: color-mix(in srgb, var(--accent) 55%, #213446); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, #111E2A), #111E2A 70%); }
body.theme-navy .jcheck--review .jcheck__ic { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 24%, #111E2A); }
body.theme-navy .jcheck__msg { background: #0C1721; border-color: #213446; }
body.theme-navy .jsum__card { background: #111E2A; border-color: #213446; }
body.theme-navy .jsum__total { background: #14241D; border-bottom-color: #213446; }
body.theme-navy .jsum__total span { color: #8CC7A5; }
body.theme-navy .ed--void .jsum__total { background: #0E1A25; }
body.theme-navy .ed--void .jsum__total span { color: var(--text-3); }
body.theme-navy .jsum__facts > div { border-top-color: #1D2C39; }
body.theme-navy .jsum__total--due { background: color-mix(in srgb, var(--accent) 14%, #111E2A); }
body.theme-navy .jsum__total--due span { color: var(--accent-text); }
body.theme-navy .jsum__payform { background: #111E2A; border-color: #213446; }
/* glass: the section labels in its mono, like its other small caps (its h3s are the tight display face) */
body.theme-glass .jsum__h { font-family: var(--mono); font-weight: 600; letter-spacing: .14em; }
/* the smallest phones: the card's three time buttons still fit their words */
@media (max-width: 359px) {
  .jcheck { padding: 12px; }
  .jcheck__acts .btn:not(:first-child) { padding: 0 4px; font-size: 14px; }
  .jsum__acts--pay .btn { padding: 0 8px; gap: 6px; font-size: 15px; }
  /* Amount and Method get a row each: "$12,951.34 due" fits */
  .jsum__payform .ctl { grid-column: 1 / -1; }
}

/* ---------- Awaiting payment (js/pay-wait.js, 1 Oct): the pill, the card's timer, Active's and Home's row, the block on the job ----------
   The timer's colour follows how long it's waited since it was sent: neutral, amber from 3 days, red after 7. Always next to its words. */
.st--await { border-color: var(--st-sent); color: var(--st-sent-text); }
body.theme-navy .st--await { color: #B4C1CD; border-color: #44515D; background: #232C34; }
.jwait.is-wait-warn { color: var(--warn-text); font-weight: 700; }
.jwait.is-wait-late { color: var(--danger-text); font-weight: 700; }
@media (max-width: 720px) {
  .jcard--await { --jt: var(--st-sent-text); --jt-bg: rgba(var(--st-sent-rgb), .14); }
  body.theme-navy .jcard--await { --jt: #9EACB9; --jt-bg: #17212B; }
}
/* the row that opens Awaiting payment: "Awaiting payment · 3 · $1,240.00" (Active on the phone board, and Home) */
.jowed { width: 100%; min-width: 0; display: grid; grid-template-columns: 36px minmax(0, 1fr) 16px; align-items: center; gap: 10px; min-height: 52px; margin-top: 10px; padding: 8px 12px 8px 8px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.jowed:active { transform: scale(var(--press-scale, .985)); }
.jowed:focus-visible, .bcard--await:focus-visible { outline: 2px solid var(--accent-ui); outline-offset: 2px; }
.jowed__ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--accent-text); background: var(--accent-soft); }
.jowed__ic svg { width: 20px; height: 20px; }
.jowed__t { min-width: 0; font-size: 14.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.jowed__t b { color: var(--text); font-weight: 700; }
.jowed__t i { font-style: normal; color: var(--text-3); }
.jowed__chev { width: 16px; height: 16px; color: var(--text-3); }
body.theme-navy .jowed { background: linear-gradient(135deg, #132230, #0F1B27); border-color: #203346; }
/* Home: the same row as a quiet bento card, under Today */
.bcard.bcard--await { display: grid; grid-template-columns: 36px minmax(0, 1fr) 16px; align-items: center; gap: 12px; min-height: 0; padding: 12px 16px 12px 12px; border-radius: 18px; }
.bcard--await .jowed__t { font-size: 15px; }
body:not(.theme-glass) .bcard--await { background: var(--card); color: var(--text); }
body.theme-glass .bcard--await .jowed__t { color: rgba(255, 255, 255, .78); }
body.theme-glass .bcard--await .jowed__t b { color: #fff; }
@media (max-width: 999px) { .bcard--await { order: 1; } }   /* the bento's phone order: right under Today */

/* the "Waiting on payment" block: on a completed job's summary */
.jwaitb { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; margin-top: 14px; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); }   /* one column the block's width: a long button can't widen it past the card */
.jwaitb__head { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: center; }
.jwaitb__ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--text-2); background: var(--panel-2); }
.jwaitb__ic svg { width: 22px; height: 22px; }
.jwaitb__txt { min-width: 0; }
.jwaitb__txt h3 { margin: 0; font-size: 16px; font-weight: 750; letter-spacing: -.01em; line-height: 1.25; color: var(--text); text-transform: none; }
.jwaitb__txt p { margin: 2px 0 0; font-size: 14px; line-height: 1.4; color: var(--text-2); }
.jwaitb__txt b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.jwaitb__facts { margin: 0; }
.jwaitb__facts > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 6px 0; border-top: 1px solid var(--line); }
.jwaitb__facts dt { flex: none; font-size: 14px; color: var(--text-2); }
.jwaitb__facts dd { margin: 0; min-width: 0; font-size: 14.5px; font-weight: 600; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.jwaitb__acts { display: grid; gap: 6px; }
.jwaitb__acts .btn { min-height: 48px; border-radius: 12px; font-size: 16px; font-weight: 700; white-space: normal; line-height: 1.2; text-align: center; }   /* "Add their phone number first" wraps on a 320pt phone */
.jwaitb__acts .btn svg { width: 18px; height: 18px; }
.jwaitb__acts .btn[aria-disabled="true"] { opacity: .55; }
.jwaitb__hint { margin: 0; font-size: 13px; line-height: 1.4; color: var(--text-3); }
.jwaitb.is-wait-warn { border-color: color-mix(in srgb, var(--warn-text) 45%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--warn-text) 10%, var(--card)), var(--card) 70%); }
.jwaitb.is-wait-warn .jwaitb__ic { color: var(--warn-text); background: color-mix(in srgb, var(--warn-text) 16%, transparent); }
.jwaitb.is-wait-warn .jwaitb__txt b { color: var(--warn-text); }
.jwaitb.is-wait-late { border-color: color-mix(in srgb, var(--danger-text) 50%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--danger-text) 10%, var(--card)), var(--card) 70%); }
.jwaitb.is-wait-late .jwaitb__ic { color: var(--danger-text); background: color-mix(in srgb, var(--danger-text) 15%, transparent); }
.jwaitb.is-wait-late .jwaitb__txt b { color: var(--danger-text); }
body.theme-navy .jwaitb { border-color: #213446; }
body.theme-navy .jwaitb__ic { background: #172838; }
body.theme-navy .jwaitb__facts > div { border-top-color: #1D2C39; }
body.theme-navy .jwaitb.is-wait-warn { border-color: #705725; background: linear-gradient(135deg, #2A2316, #111E2A 70%); }
body.theme-navy .jwaitb.is-wait-warn .jwaitb__ic { color: #F5BD51; background: #392E18; }
body.theme-navy .jwaitb.is-wait-late { border-color: rgba(229, 72, 77, .55); background: linear-gradient(135deg, #2C1719, #111E2A 70%); }
@media (min-width: 721px) { .jwaitb__acts { grid-template-columns: minmax(0, 320px); } }
