/* desk.css — see components.css for the shared system; this file is owned by one module. */

/* ---- Customer header: phone / email / address as one clickable line ------ */
.custcontact { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.custcontact a { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); text-decoration: none; min-width: 0; }
.custcontact a:hover { color: var(--accent); }
.custcontact a svg { flex: 0 0 auto; color: var(--muted); }

/* ---- Aging strip (customer detail) ---------------------------------------- */
.agingbox { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.agingbox__cell { background: var(--surface); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.agingbox__l { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agingbox__v { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.agingbox__cell[data-tone="warning"] .agingbox__v { color: var(--warning-ink); }
.agingbox__cell[data-tone="danger"] .agingbox__v { color: var(--danger-ink); }
.agingbox__cell[data-tone="accent"] .agingbox__v { color: var(--accent-ink-on-soft); }
.agingbox__cell--total { background: var(--surface-2); }
@media (max-width: 900px) { .agingbox { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---- Contact cards and the contact editor -------------------------------- */
.contactcards { display: flex; flex-direction: column; }
.contactcard { padding: 10px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; }
.contactcard:last-child { border-bottom: 0; }
.contactlist { display: flex; flex-direction: column; gap: 8px; }
.contactrow { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.3fr auto auto; gap: 6px; align-items: center; }
.contactrow__primary { white-space: nowrap; font-size: var(--fs-sm); }
@media (max-width: 900px) {
  .contactrow { grid-template-columns: 1fr 1fr; padding: 8px; border: 1px solid var(--border); border-radius: var(--r-md); }
  .contactrow__primary { grid-column: 1; }
}

/* ---- Customer picker (vehicle form) --------------------------------------- */
.cpick { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 6px; align-items: center; }
.cpick__new span { white-space: nowrap; }
@media (max-width: 620px) { .cpick { grid-template-columns: minmax(0, 1fr); } }

/* Sections that only apply to one kind of vehicle. */
.only-wrap { display: contents; }
[data-only][hidden] { display: none !important; }
.field.is-lead .input { font-family: var(--font-mono, ui-monospace, monospace); font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }

/* ---- Owner and PEP cards (vehicle detail) --------------------------------- */
.pepcard__due { display: flex; align-items: baseline; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); margin-bottom: 10px; }
.pepcard__due[data-tone="danger"] { background: var(--danger-soft); color: var(--danger-ink); }
.pepcard__due[data-tone="warning"] { background: var(--warning-soft); color: var(--warning-ink); }
.pepcard__due[data-tone="success"] { background: var(--success-soft); color: var(--success-ink); }
.pepcard__date { font-size: var(--fs-xl, 20px); font-weight: 700; letter-spacing: -.01em; }
.pepcard__when { font-size: var(--fs-sm); opacity: .85; }

/* ---- PEP list ------------------------------------------------------------- */
.pepgroup .table td { vertical-align: middle; }
.pepgroup .td-actions { white-space: nowrap; }
@media (max-width: 720px) { .pepgroup .td-actions .btn span { display: none; } }

/* ---- Payment dialog ------------------------------------------------------- */
.paytable td, .paytable th { vertical-align: middle; }
.paytable tfoot td { border-top: 1px solid var(--border); }

/* ---- Statement (relevé de compte) ----------------------------------------- */
.stmt .stmt__table { width: 100%; margin: .1in 0 0; }
.stmt .stmt__table th:first-child, .stmt .stmt__table td:first-child { white-space: nowrap; }
.stmt__open td, .stmt__close td { background: #f3f4f6; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.stmt__aging { width: 100%; border-collapse: collapse; font-size: 9pt; margin-top: 4px; }
.stmt__aging th { text-align: right; font-size: 7.5pt; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b7280; padding: 3px 6px; border-bottom: 1px solid #d1d5db; }
.stmt__aging td { text-align: right; padding: 5px 6px; font-variant-numeric: tabular-nums; }
.stmt .invdoc__notes { min-width: 0; }
.stmt .invdoc__bottom { grid-template-columns: minmax(0, 1fr) 2.6in; }
.stmt .invdoc__facts dd.t-danger { color: #b91c1c; }
@media (max-width: 900px) { .stmt .invdoc__bottom { grid-template-columns: minmax(0, 1fr); } }

/* Invoice: payments received, balance stamp. */
.invpay em { font-style: normal; font-size: 7.5pt; color: #9ca3af; margin-left: 4px; }
.invdoc__due--paid b { color: #16a34a; }
.invdoc__due--open b { color: #b91c1c; }
.pepactions { justify-content: flex-end; flex-wrap: nowrap; }
.pepgroup .td-actions { width: 1%; }
.invpay span { font-size: 8.5pt; }
.invpay b { white-space: nowrap; }

/* ---- Messages (the desk) ---- */
.msgdir { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; }
.msgdir[data-dir="in"] { background: color-mix(in srgb, var(--warning, #d97706) 16%, transparent); color: var(--warning, #d97706); }
.msgdir[data-dir="out"] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.msgbody { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 420px; font-size: var(--fs-sm); color: var(--ink-2); }
.msgbody.is-unread { color: var(--ink); font-weight: 600; }
.msgpreview { border: 1px dashed var(--border); border-radius: var(--r-md); padding: var(--s-3); background: var(--surface-2, transparent); }
.msgpreview__body { margin: 4px 0 0; white-space: pre-wrap; font: inherit; font-size: var(--fs-sm); color: var(--ink-2); max-height: 180px; overflow: auto; }

/* ---- Opening a work order at the counter (the intake wizard) ------------------- */
.wiz { max-width: 980px; display: grid; gap: var(--s-4); }
.wiz__steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-2); }
.wiz__steps li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-weight: 600; cursor: default; }
.wiz__steps li i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 700; background: var(--surface); border: 1px solid var(--border); }
.wiz__steps li.is-now { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: var(--accent); color: var(--ink); } .wiz__steps li.is-now i { background: var(--accent); color: #fff; border-color: transparent; }
.wiz__steps li.is-done { cursor: pointer; color: var(--ink-2); } .wiz__steps li.is-done i { background: var(--success); color: #fff; border-color: transparent; }
.wiz__body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: var(--s-5); min-height: 360px; }
.wiz__pane { display: grid; gap: var(--s-4); }
.wiz__title { margin: 0; font-size: 24px; letter-spacing: -.02em; } .wiz__h { margin: var(--s-2) 0 0; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.wiz__kicker { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.wiz__picked { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; } .wiz__picked h2 { margin: 2px 0; font-size: 22px; }
.wiz__search .input--lg { font-size: 18px; padding: 14px 16px; }
.wiz__results { display: grid; gap: 6px; max-height: 420px; overflow: auto; }
.wiz__result { all: unset; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); }
.wiz__result:hover, .wiz__result:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.wiz__result-main { display: grid; gap: 2px; min-width: 0; } .wiz__result-main b { font-size: var(--fs-md); } .wiz__result-main span { font-size: var(--fs-sm); color: var(--muted); }
.wiz__result-side { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; } .wiz__result-side em { font-style: normal; font-family: var(--font-mono); font-size: var(--fs-xs); padding: 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.wiz__none { color: var(--muted); padding: var(--s-3); text-align: center; border: 1px dashed var(--border); border-radius: var(--r-md); margin: 0; }
.wiz__units { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--s-3); }
.wiz__unit { all: unset; cursor: pointer; box-sizing: border-box; display: grid; gap: 3px; padding: 14px 16px; border-radius: var(--r-lg); border: 2px solid var(--border); background: var(--surface); min-height: 96px; }
.wiz__unit b { font-family: var(--font-mono); font-size: 22px; letter-spacing: -.01em; } .wiz__unit span { font-size: var(--fs-sm); color: var(--ink-2); } .wiz__unit small { font-size: var(--fs-xs); color: var(--muted); }
.wiz__unit:hover { border-color: var(--accent); } .wiz__unit.is-on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.wiz__unit--new { align-content: center; justify-items: center; color: var(--muted); border-style: dashed; }
.wiz__repairs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: rep; }
.wiz__repairs li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s-3); padding: 10px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); counter-increment: rep; }
.wiz__repairs li::before { content: counter(rep); grid-column: 1; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); font-size: 12px; font-weight: 700; color: var(--muted); }
.wiz__repairs li .wiz__cat { grid-column: 2; grid-row: 1; } .wiz__repairs li .wiz__reptext { grid-column: 2; grid-row: 2; } .wiz__repairs li .row-tight { grid-column: 3; grid-row: 1 / span 2; }
.wiz__cat { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.wiz__reptext { color: var(--ink); }
.wiz__adder { display: grid; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-lg); border: 1px dashed var(--border); background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.wiz__cats { display: flex; flex-wrap: wrap; gap: 8px; }
.wiz__catbtn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface); font-weight: 600; font-size: var(--fs-sm); color: var(--ink-2); }
.wiz__catbtn:hover { border-color: var(--accent); color: var(--ink); } .wiz__catbtn.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.wiz__summary { padding: var(--s-4); border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); }
.wiz__dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; margin: 0; } .wiz__dl dt { color: var(--muted); font-size: var(--fs-sm); } .wiz__dl dd { margin: 0; }
.wiz__sumlist { margin: 0; padding-left: 18px; }
.wiz__nav { display: flex; align-items: center; gap: var(--s-3); }
@media (max-width: 640px) { .wiz__steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } .wiz__steps li span { font-size: var(--fs-xs); } .wiz__body { padding: var(--s-4); } }
