/* Customer portal — builds on styles.css (same colors, type and cards). */
.portal-page .wrap { max-width: 980px; }
.btn-link { font-weight: 700; color: var(--accent); text-decoration: none; padding: 6px 4px; }
.btn-link:hover, .btn-link:focus-visible { text-decoration: underline; }
.stats.card { border-top: 1px solid var(--line); }
.stats:empty { display: none; }
.app-tabs { margin-top: 0; }
.app-tabs .count { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 6px; }

.jobs { display: flex; flex-direction: column; gap: 12px; }
.empty { background: var(--sheet); border: 1px dashed var(--line); border-radius: 6px; padding: 28px; text-align: center; color: var(--muted); }

.job { background: var(--sheet); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 14px; padding: 12px 14px 4px; }
.job-head h2 { margin: 0; font-family: var(--display); font-stretch: 85%; font-weight: 700; font-size: 18px; color: var(--ink); }
.job-ref { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.job-sub { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 0 14px 10px; font-size: 13px; color: var(--muted); }
.job-sub b { color: var(--ink); font-weight: 600; }
.job-sub .late { color: var(--danger); }
.parts-wrap { overflow-x: auto; }
.parts td { font-family: var(--body); }
@media (max-width: 620px) { .app-tabs { overflow-x: auto; } .app-tabs a { white-space: nowrap; padding: 8px 10px; } }

/* Stage tracker: one step per shop stage, current step filled */
.track { list-style: none; margin: 0; padding: 12px 14px 14px; display: grid; grid-template-columns: repeat(var(--steps), minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.track li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
.track li::before { content: ""; position: absolute; top: 9px; left: -50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.track li:first-child::before { display: none; }
.track .dot { position: relative; z-index: 1; width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); background: var(--sheet); }
.track li.done { color: var(--ink); }
.track li.done::before, .track li.now::before { background: var(--accent); }
.track li.done .dot { background: var(--accent); border-color: var(--accent); }
.track li.now { color: var(--accent); }
.track li.now .dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--sheet); }
.track li.now .dot::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); }
.track li.skip { opacity: .45; text-decoration: line-through; }
.track .when { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--muted); }
@media (max-width: 620px) {
  .track { grid-template-columns: 1fr; gap: 10px; }
  .track li { flex-direction: row; text-align: left; gap: 10px; }
  .track li::before { display: none; }
  .track .when { margin-left: auto; }
}

.job details { border-top: 1px solid var(--line); }
.job summary { cursor: pointer; padding: 9px 14px; font-size: 13px; font-weight: 700; color: var(--accent); }
.job summary:hover { background: var(--accent-soft); }
.parts { width: 100%; border-collapse: collapse; font-size: 13px; }
.parts th, .parts td { text-align: left; padding: 7px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.parts th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: var(--field); }
.parts td.n { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.parts th.n { text-align: right; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,.2); vertical-align: -1px; margin-right: 6px; }

/* Accept a quote */
.accept { border-top: 1px solid var(--line); padding: 12px 14px; }
.panel-form { display: grid; gap: 10px; }
.panel-form textarea { font: 500 15px var(--body); color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; width: 100%; resize: vertical; }
.panel-form .opt, .opt { text-transform: none; letter-spacing: 0; font-weight: 400; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.panel-actions .btn-ghost:hover { color: var(--ink); }
.panel-msg { color: var(--danger); font-size: 13px; margin: 0; min-height: 1em; }
.panel-msg:empty { display: none; }
.flash { background: #e9f5ec; color: var(--good); border: 1px solid currentColor; border-radius: 6px; padding: 10px 14px; margin: 0; font-weight: 600; }

/* Summary strip links */
a.stat { color: inherit; text-decoration: none; }
a.stat:hover, a.stat:focus-visible { background: var(--accent-soft); }
.stat .s { font-size: 12px; color: var(--muted); }
.stat .v small { font-size: 13px; color: var(--muted); }
.stat.is-bad .v { color: var(--danger); }
.app-tabs .count.due { color: var(--danger); }

/* Reorder */
.reorder-parts { display: grid; gap: 8px; }
.reorder-part { display: grid; grid-template-columns: minmax(0, 1fr) 110px; align-items: center; gap: 4px 12px; text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.reorder-part .opt { grid-column: 1; font-size: 12px; color: var(--muted); font-weight: 400; }
.reorder-part input { grid-column: 2; grid-row: 1 / span 2; }

/* Invoices */
.inv td { font-family: var(--body); vertical-align: middle; }
.inv td.n { font-family: var(--mono); }
.inv .sub { display: block; font-size: 12px; color: var(--muted); }
.inv td.late { color: var(--danger); font-weight: 600; }
.inv td.act { text-align: right; white-space: nowrap; }
.inv .pay { padding: 6px 12px; font-size: 13px; }

/* Stats */
.chart-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.chart { position: relative; min-height: 240px; }
.chart svg { display: block; overflow: visible; max-width: 100%; height: auto; }
.chart .grid { stroke: #e6e6e8; stroke-width: 1; }
.chart .base { stroke: var(--muted); stroke-width: 1; }
.chart .axis { font: 500 13px var(--mono); fill: var(--muted); }
.chart .val { font: 700 14px var(--mono); fill: var(--ink); }
.chart .mark { fill: var(--accent); }
.chart .hit:hover .mark { fill: #6b3c69; }
.chart .avg { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .dotm { fill: var(--accent); stroke: var(--sheet); stroke-width: 2; }
.chart .dotm.late { fill: var(--sheet); stroke: var(--danger); stroke-width: 2.5; }
.chart .hit:hover .dotm { r: 8.5; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 14px; line-height: 1.4; padding: 8px 11px; border-radius: 4px; white-space: nowrap; z-index: 2; }
.as-table summary { font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.as-table table { margin-top: 6px; }
.legend-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); vertical-align: -1px; margin: 0 4px 0 0; }
.legend-dot.late { background: var(--sheet); border: 2px solid var(--danger); margin-left: 12px; }
.hbars { display: grid; gap: 14px; }
.hbar { display: grid; grid-template-columns: minmax(180px, 1fr) 2.2fr auto; align-items: center; gap: 14px; font-size: 15px; font-weight: 600; }
.hb-name .opt { font-weight: 400; color: var(--muted); }
.hb-track { height: 22px; }
.hb-fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.hb-val { font-family: var(--mono); font-size: 14px; color: var(--ink); white-space: nowrap; }
@media (max-width: 520px) { .hbar { grid-template-columns: 1fr auto; } .hb-track { grid-column: 1 / -1; grid-row: 2; } }
.chart .halo { paint-order: stroke; stroke: var(--sheet); stroke-width: 4px; stroke-linejoin: round; }
.legend-line { display: inline-block; width: 18px; height: 0; border-top: 2px dashed var(--ink); vertical-align: 3px; margin: 0 4px 0 12px; }
.job-sub .ready { color: var(--good); }
.btn-like { display: inline-block; font: 600 14px var(--body); border-radius: 4px; padding: 9px 14px; border: 1px solid var(--line); background: var(--sheet); color: var(--ink); text-decoration: none; }
.btn-like:hover { border-color: var(--muted); }
.app-tabs .tab-new { margin-left: auto; align-self: center; background: var(--accent); color: var(--accent-ink) !important; border-radius: 999px; padding: 9px 20px !important; font-size: 16px; font-weight: 800; border-bottom: 0 !important; box-shadow: 0 3px 10px rgba(132, 76, 130, .3); }
.app-tabs .tab-new:hover { background: #6b3c69; }
/* Portal header + tabs on the New quote page (portal-quote.html, built from index.html) */
.portal-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
html[data-portal] .app-tabs.portal-tabs { display: flex; }
html[data-portal] .app-tabs .tab-new[aria-current] { color: var(--accent-ink); }
html.no-price .ticket-top .total, html.no-price #t-lines dd, html.no-price #breaks, html.no-price #breaks-meta { visibility: hidden; }
html.no-price .ticket-top .total { height: 0; }

/* Admin view: Lux staff switch between clients */
.adminbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 14px; padding: 10px 14px; border: 2px dashed var(--accent, #c8102e); }
.adminbar label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.adminbar select { min-width: 260px; max-width: 100%; }
.adminbar input[type=search] { min-width: 200px; flex: 1 1 200px; max-width: 320px; }
.adminbar .hint { flex-basis: 100%; margin: 0; }
.chart-grid .hint { font-size: 14px; }
.chart-grid .as-table summary { font-size: 13px; }

.parts-box > summary { cursor: pointer; }

/* Settings tab */
.settings { display: grid; gap: 14px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.set-grid .wide { grid-column: 1 / -1; }
.settings label .help { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 12px; color: var(--muted); }
.settings textarea { font-size: 15px; }
.settings input[readonly] { background: var(--sheet); color: var(--muted); }
.settings input:disabled { background: var(--sheet); color: var(--muted); }
.settings .check { flex-direction: row; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); font-weight: 500; }
.settings .check input { width: auto; }
.acct-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 0; }
.acct-info dt { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.acct-info dd { margin: 4px 0 0; font-weight: 700; font-size: 16px; }
.save-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: var(--sheet);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 -4px 16px rgba(40, 20, 40, .08); }
.save-bar .btn-primary { padding: 10px 22px; font-size: 15px; }
.save-msg { font-size: 14px; color: var(--danger); }
.save-msg.ok { color: var(--good); font-weight: 600; }
/* Phones: the tab row scrolls sideways instead of hiding tabs off the edge */
@media (max-width: 760px) {
  .portal-page .app-tabs, html[data-portal] .app-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .portal-page .app-tabs::-webkit-scrollbar, html[data-portal] .app-tabs::-webkit-scrollbar { display: none; }
  .portal-page .app-tabs a, html[data-portal] .app-tabs a { white-space: nowrap; flex: none; }
  .app-tabs .tab-new { margin-left: 8px; }
}
.settings label .current { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; color: var(--ink); }
.settings label .current b { color: var(--accent); }

/* Logins: team card (Settings) and admin All users */
.team td.act { text-align: right; white-space: nowrap; }
.team td.act button + button { margin-left: 6px; }
.btn-ghost.small { padding: 5px 10px; font-size: 13px; }
.btn-ghost.danger { color: var(--danger); }
.tag.bad { background: #fde8e8; color: var(--danger); }
.invite-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) auto; gap: 10px 14px; align-items: end; }
.invite-form .wide { grid-column: 1 / -1; }
.sub-h { margin: 8px 0 0; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.login-msg { margin: 0; font-size: 14px; min-height: 1em; }
.login-msg:empty { display: none; }
.login-msg.ok { color: var(--good); font-weight: 600; }
.login-msg.bad { color: var(--danger); }
#users-filter { margin-bottom: 10px; max-width: 420px; }
.app-tabs .tab-admin { color: var(--accent); }
.team td.act { white-space: normal; }
.team .acts { display: flex; flex-wrap: wrap; gap: 4px 6px; justify-content: flex-end; }
.team td.act button + button { margin-left: 0; }
.invite-form { max-width: 760px; grid-template-columns: 1fr 1fr auto; }
.invite-form .btn-primary { padding: 9px 18px; }
@media (max-width: 640px) { .invite-form { grid-template-columns: 1fr; } }

#view-client.nudge { outline: 3px solid var(--brand, #864e83); outline-offset: 2px; }

/* Long lists: search, sort, group */
.list-tools { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 12px 14px; margin-bottom: 14px; }
.list-tools input[type=search] { flex: 1 1 260px; min-width: 0; }
.list-tools label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted, #666); margin: 0; }
.list-tools select { width: auto; }
.list-tools .seg { display: inline-flex; border: 1px solid var(--line, #ccc); border-radius: 8px; overflow: hidden; }
.list-tools .seg button { border: 0; border-radius: 0; background: transparent; padding: 7px 14px; font-weight: 600; cursor: pointer; color: inherit; }
.list-tools .seg button[aria-pressed=true] { background: var(--brand, #864e83); color: #fff; }
.list-note { font-size: 12px; color: var(--muted, #666); flex-basis: 100%; }
.list-note:empty { display: none; }
.month-head { display: flex; align-items: baseline; gap: 10px; margin: 22px 2px 10px; font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--brand, #864e83); }
.month-head span { font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--muted, #666); font-weight: 500; }
.month-head:first-child { margin-top: 4px; }
.part-hit { padding: 0 16px 6px; font-size: 13px; color: var(--muted, #555); }
.plist th.sortable button { all: unset; cursor: pointer; font: inherit; color: inherit; }
.plist th.sortable button:focus-visible { outline: 2px solid var(--brand, #864e83); }
.inv-group.bad .card-head h2 { color: #b42318; }
.inv-group { margin-bottom: 14px; }
@media (max-width: 640px) { .list-tools label { flex: 1 1 100%; } .list-tools select { flex: 1; } }

/* Average turnaround: the headline number on Stats */
.stats .stat.feature { background: color-mix(in srgb, var(--brand, #864e83) 9%, #fff); box-shadow: inset 0 3px 0 var(--brand, #864e83); }
.stats .stat.feature .k { color: var(--brand, #864e83); font-weight: 700; }
.stats .stat.feature .v { color: var(--brand, #864e83); font-size: 1.35em; font-weight: 800; }
.list-tools label { display: flex !important; flex-direction: row !important; align-items: center; text-transform: none; letter-spacing: 0; font-weight: 600; }
.list-tools label select { margin: 0; }
