/* Service Booking & Job Card — AutoCare. Namespaced .sv */
* { box-sizing: border-box; }
body { margin: 0; }
.sv {
    --bg: #eef2f6; --panel: #ffffff; --panel2: #f6f8fb; --line: #dfe6ee; --ink: #16202e; --muted: #64748b;
    --brand: #ef4444; --brand-ink: #dc2626; --accent: #0284c7;
    --ok: #16a34a; --warn: #d97706; --info: #2563eb;
    --shadow: 0 12px 32px -18px rgba(22,32,46,.32);
    min-height: calc(100vh - 44px);
    font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
    background: radial-gradient(1000px 420px at 90% -10%, rgba(239,68,68,.06), transparent), var(--bg);
    color: var(--ink);
}
.sv-btn { border: 0; cursor: pointer; border-radius: .6rem; padding: .6rem 1rem; font: 700 .86rem inherit; background: var(--brand); color: #fff; transition: transform .1s; white-space: nowrap; }
.sv-btn:hover { transform: translateY(-1px); }
.sv-btn.ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.sv-btn.ghost:hover { border-color: var(--brand); }
.sv-btn.sm { padding: .42rem .75rem; font-size: .8rem; }
.sv-btn.ok { background: var(--ok); }
.sv-btn:disabled { opacity: .4; cursor: not-allowed; }
.sv-h2 { margin: 0 0 1rem; font-size: 1.25rem; }
.sv-link { border: 0; background: transparent; color: var(--brand-ink); font: 600 .8rem inherit; cursor: pointer; }

.sv-topbar { display: flex; align-items: center; gap: 1rem; padding: .8rem 1.5rem; background: var(--panel); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; flex-wrap: wrap; }
.sv-brand { display: flex; align-items: center; gap: .6rem; }
.sv-logo { font-size: 1.6rem; }
.sv-brand b { display: block; font-size: 1.05rem; }
.sv-brand small { color: var(--muted); font-size: .72rem; }
.sv-nav { display: flex; gap: .25rem; margin: 0 auto; flex-wrap: wrap; }
.sv-navbtn { border: 0; background: transparent; color: var(--muted); padding: .5rem .8rem; border-radius: .6rem; font: 600 .85rem inherit; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; }
.sv-navbtn:hover { color: var(--ink); background: var(--panel2); }
.sv-navbtn.active { background: var(--brand); color: #fff; }
.sv-badge { background: rgba(0,0,0,.12); border-radius: 999px; padding: 0 .4rem; font-size: .7rem; min-width: 1.1rem; text-align: center; }
.sv-top-actions { display: flex; align-items: center; gap: .6rem; }
.sv-live-dot { color: var(--ok); font-size: .72rem; font-weight: 800; letter-spacing: .1em; display: inline-flex; align-items: center; gap: .4rem; }
.sv-live-dot::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--ok); animation: svpulse 1.3s infinite; }
@keyframes svpulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.sv-view { max-width: 1300px; margin: 0 auto; padding: 1.5rem; }
.sv-view[hidden] { display: none !important; }
.sv-card { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.3rem; box-shadow: var(--shadow); }
.sv-card h3 { margin: 0 0 1rem; font-size: .95rem; }

/* BOOK */
.sv-book-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 820px) { .sv-book-grid { grid-template-columns: 1fr; } }
.sv-form { display: flex; flex-direction: column; gap: .8rem; }
.sv-f { display: flex; flex-direction: column; gap: .3rem; font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.sv-f input, .sv-f select, .sv-f textarea { font: 400 .9rem inherit; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--panel2); color: var(--ink); text-transform: none; }
.sv-f-row { display: flex; gap: .6rem; }
.sv-f-row .sv-f { flex: 1; }
.sv-quote { background: var(--panel2); border: 1px solid var(--line); border-radius: .7rem; padding: 1rem; font-size: .86rem; }
.sv-quote .qr { display: flex; justify-content: space-between; padding: .2rem 0; color: var(--muted); }
.sv-quote .qr.tot { color: var(--ink); font-weight: 800; font-size: 1.05rem; border-top: 1px solid var(--line); padding-top: .5rem; margin-top: .3rem; }
.sv-vehicle { border: 1px solid var(--line); border-radius: .7rem; padding: .8rem 1rem; margin-bottom: .6rem; background: var(--panel2); font-size: .85rem; }
.sv-vehicle b { font-size: .92rem; }
.sv-vehicle .vm { color: var(--muted); font-size: .78rem; margin-top: .2rem; }
.sv-myjob { border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: .7rem; padding: .8rem 1rem; margin-bottom: .6rem; cursor: pointer; }
.sv-myjob:hover { border-color: var(--brand); }
.sv-myjob b { font-size: .9rem; }
.sv-myjob .mjm { color: var(--muted); font-size: .78rem; margin-top: .2rem; }
.sv-statustag { display: inline-block; font-size: .66rem; font-weight: 800; text-transform: uppercase; padding: .1rem .45rem; border-radius: 999px; background: rgba(2,132,199,.12); color: var(--accent); }

/* WORKSHOP BOARD */
.sv-ws-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.sv-ws-head h2 { margin: 0; }
.sv-ws-stats { display: flex; gap: 1.5rem; }
.sv-ws-stats .s b { font-size: 1.3rem; font-weight: 800; display: block; }
.sv-ws-stats .s small { color: var(--muted); font-size: .72rem; }
.sv-ws-lanes { display: grid; grid-template-columns: repeat(6, 1fr); gap: .8rem; overflow-x: auto; }
@media (max-width: 1100px) { .sv-ws-lanes { grid-template-columns: repeat(3, minmax(160px,1fr)); } }
@media (max-width: 620px) { .sv-ws-lanes { grid-template-columns: repeat(2, minmax(150px,1fr)); } }
.sv-lane { background: var(--panel); border: 1px solid var(--line); border-radius: .9rem; padding: .7rem; min-height: 300px; box-shadow: var(--shadow); }
.sv-lane h3 { margin: 0 0 .7rem; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: flex; justify-content: space-between; }
.sv-lane-body { display: flex; flex-direction: column; gap: .5rem; }
.sv-jcard { background: var(--panel2); border: 1px solid var(--line); border-radius: .6rem; padding: .6rem .7rem; cursor: pointer; }
.sv-jcard:hover { border-color: var(--brand); }
.sv-jcard .jh { display: flex; justify-content: space-between; font-size: .74rem; color: var(--muted); }
.sv-jcard .jh b { color: var(--ink); }
.sv-jcard .jt { font-weight: 700; font-size: .82rem; margin: .15rem 0; }
.sv-jcard .jm { font-size: .72rem; color: var(--muted); }
.sv-jcard .jtech { display: inline-flex; align-items: center; gap: .3rem; margin-top: .35rem; font-size: .72rem; }
.sv-jcard .jtech .av { width: 1.4rem; height: 1.4rem; border-radius: 50%; background: #cbd5e1; display: grid; place-items: center; font-size: .58rem; font-weight: 700; }
.sv-jcard.attn { border-left: 3px solid var(--warn); }

/* JOB CARD */
.sv-jc-back { border: 0; background: transparent; color: var(--brand-ink); font: 600 .85rem inherit; cursor: pointer; margin-bottom: 1rem; }
.sv-jc-grid { display: grid; grid-template-columns: 1fr 340px; gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .sv-jc-grid { grid-template-columns: 1fr; } }
.sv-jc-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.sv-jc-head h2 { margin: 0; font-size: 1.4rem; }
.sv-jc-head .jc-sub { color: var(--muted); font-size: .85rem; }
.sv-jc-id { background: #fee2e2; color: var(--brand-ink); font-weight: 800; padding: .3rem .7rem; border-radius: .5rem; font-size: .85rem; }
.sv-rail { display: flex; margin: 1.5rem 0; overflow-x: auto; }
.sv-rail .rs { flex: 1; min-width: 76px; text-align: center; position: relative; }
.sv-rail .rs::before { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 3px; background: var(--line); }
.sv-rail .rs:first-child::before { display: none; }
.sv-rail .rs.done::before, .sv-rail .rs.current::before { background: var(--ok); }
.sv-rail .rs .n { width: 28px; height: 28px; border-radius: 50%; background: var(--line); color: var(--muted); display: grid; place-items: center; margin: 0 auto .4rem; position: relative; z-index: 1; font-size: .8rem; font-weight: 700; }
.sv-rail .rs.done .n { background: var(--ok); color: #fff; }
.sv-rail .rs.current .n { background: var(--brand); color: #fff; box-shadow: 0 0 0 4px rgba(239,68,68,.2); }
.sv-rail .rs span { font-size: .68rem; color: var(--muted); }
.sv-rail .rs.current span { color: var(--brand-ink); font-weight: 700; }
.sv-jc-sec { margin-top: 1.3rem; }
.sv-jc-sec h4 { margin: 0 0 .7rem; font-size: .92rem; }
.sv-checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: .35rem; }
.sv-chk-item { display: flex; align-items: center; gap: .5rem; font-size: .82rem; padding: .35rem .4rem; border-radius: .4rem; }
.sv-chk-item .dot { width: .7rem; height: .7rem; border-radius: 50%; flex: none; background: #cbd5e1; }
.sv-chk-item.ok .dot { background: var(--ok); }
.sv-chk-item.attention .dot { background: var(--warn); }
.sv-chk-item .lab { flex: 1; }
.sv-chk-item.attention .lab { color: var(--warn); font-weight: 600; }
.sv-lineitems .li { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px dashed var(--line); font-size: .85rem; }
.sv-lineitems .li:last-child { border-bottom: 0; }
.sv-lineitems .li .amt { font-weight: 600; white-space: nowrap; }
.sv-notes .note { background: var(--panel2); border-radius: .6rem; padding: .6rem .8rem; margin-bottom: .5rem; font-size: .84rem; }
.sv-notes .note .nb { color: var(--muted); font-size: .72rem; }
.sv-note-add { display: flex; gap: .5rem; margin-top: .5rem; }
.sv-note-add input { flex: 1; font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: .5rem; }
.sv-approval { display: flex; align-items: center; gap: .8rem; border: 1px solid var(--line); border-radius: .6rem; padding: .7rem .9rem; margin-bottom: .5rem; }
.sv-approval .ai { flex: 1; font-size: .85rem; }
.sv-approval .ai b { display: block; }
.sv-approval .ai small { color: var(--muted); }
.sv-approval .ap-status { font-size: .68rem; font-weight: 800; text-transform: uppercase; padding: .1rem .45rem; border-radius: 999px; }
.sv-approval .ap-status.pending { background: #fef9c3; color: var(--warn); }
.sv-approval .ap-status.approved { background: #dcfce7; color: var(--ok); }
.sv-approval .ap-status.declined { background: #fee2e2; color: var(--brand-ink); }
.sv-approval .ap-acts { display: flex; gap: .3rem; }
.sv-approval .ap-acts button { border: 1px solid var(--line); background: var(--panel); border-radius: .4rem; padding: .25rem .5rem; font: 700 .7rem inherit; cursor: pointer; }

.sv-jc-side { position: sticky; top: 76px; }
@media (max-width: 900px) { .sv-jc-side { position: static; } }
.sv-invoice { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.3rem; box-shadow: var(--shadow); }
.sv-invoice h3 { margin: 0 0 1rem; font-size: .95rem; }
.sv-invoice .ir { display: flex; justify-content: space-between; font-size: .84rem; color: var(--muted); padding: .2rem 0; }
.sv-invoice .ir b { color: var(--ink); }
.sv-invoice .ir.grand { color: var(--ink); font-weight: 800; font-size: 1.2rem; border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .4rem; }
.sv-invoice .iacts { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }

/* HISTORY */
.sv-hist-search { display: flex; gap: .5rem; max-width: 460px; margin: 0 auto 1.5rem; }
.sv-hist-search input { flex: 1; font: inherit; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--panel); letter-spacing: .05em; }
.sv-hist-search button { border: 0; background: var(--brand); color: #fff; border-radius: .6rem; padding: 0 1.4rem; font: 700 .9rem inherit; cursor: pointer; }
.sv-hist-vehicle { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.3rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.sv-hist-vehicle h3 { margin: 0 0 .3rem; }
.sv-hist-vehicle .hm { color: var(--muted); font-size: .85rem; }
.sv-hrow { display: grid; grid-template-columns: 7rem 1fr 1fr auto auto; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); font-size: .85rem; align-items: center; }
.sv-hrow:last-child { border-bottom: 0; }
.sv-hrow.head { font-size: .72rem; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.sv-hrow .cost { font-weight: 700; color: var(--brand-ink); }
.sv-hrow button { border: 1px solid var(--line); background: var(--panel); border-radius: .4rem; padding: .25rem .55rem; font: 600 .72rem inherit; cursor: pointer; }

/* ANALYTICS */
.sv-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.sv-kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.2rem; box-shadow: var(--shadow); }
.sv-kpi b { font-size: 1.7rem; font-weight: 800; display: block; }
.sv-kpi small { color: var(--muted); font-size: .78rem; }
.sv-kpi .delta { color: var(--ok); font-size: .74rem; font-weight: 600; }
.sv-analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) { .sv-analytics-grid { grid-template-columns: 1fr; } }
.sv-card-wide { grid-column: 1 / -1; }
#sv-revchart { width: 100%; height: 200px; }
#sv-mixdonut { width: 130px; height: 130px; display: block; margin: 0 auto; }
.sv-donut-legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; justify-content: center; font-size: .76rem; color: var(--muted); margin-top: .6rem; }
.sv-donut-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.sv-donut-legend i { width: .7rem; height: .7rem; border-radius: 3px; }
.sv-bay-row { display: flex; align-items: center; gap: .8rem; padding: .45rem 0; font-size: .83rem; }
.sv-bay-row .n { width: 5rem; color: var(--muted); flex: none; }
.sv-bay-row .b { flex: 1; height: 14px; background: var(--line); border-radius: 4px; overflow: hidden; }
.sv-bay-row .b i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #f87171); }
.sv-bay-row .v { width: 3rem; text-align: right; font-weight: 700; }

.sv-toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: #16202e; color: #fff; padding: .7rem 1.1rem; border-radius: .7rem; font: 700 .88rem inherit; z-index: 200; box-shadow: 0 15px 40px -12px rgba(0,0,0,.4); max-width: 90vw; }
.sv-toast[hidden] { display: none; }
@media print { .demo-chrome, .sv-topbar, .sv-nav, .sv-jc-side .iacts { display: none !important; } }
