/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0f172a;
    --surface:   #1e293b;
    --surface2:  #263348;
    --border:    #334155;
    --text:      #e2e8f0;
    --muted:     #64748b;
    --primary:   #f97316;
    --primary-h: #ea580c;
    --green:     #22c55e;
    --blue:      #38bdf8;
    --purple:    #a78bfa;
    --orange:    #f97316;
    --red:       #f87171;
    --sidebar-w: 230px;
    --topbar-h:  60px;
    --radius:    10px;
    --shadow:    0 1px 4px rgba(0,0,0,.3);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a    { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout shell ─────────────────────────────────────────── */
.shell   { display: flex; min-height: 100vh; }
.main    { flex: 1; display: flex; flex-direction: column;
           margin-left: var(--sidebar-w); min-width: 0; }
.content { padding: 24px; flex: 1; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: #0b1120;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
    border-right: 1px solid #1e293b;
}
.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 20px 16px;
    font-size: 18px; font-weight: 700;
    color: #fff; border-bottom: 1px solid #1e293b;
}
.sidebar-logo .logo-accent { color: var(--primary); }
.logo-icon { font-size: 22px; }

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px;
    color: #64748b;
    font-size: 14px; font-weight: 500;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: #1e293b; color: #e2e8f0; text-decoration: none; }
.nav-item.active { background: rgba(249,115,22,.12); color: #fff;
                   border-left-color: var(--primary); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid #1e293b;
    font-size: 12px; color: #475569;
    display: flex; justify-content: space-between; align-items: center;
}
.logout-link { color: #64748b; font-size: 12px; }
.logout-link:hover { color: var(--primary); text-decoration: none; }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 50;
}
.page-title { font-size: 18px; font-weight: 600; color: var(--text); }
.topbar-user { font-size: 13px; color: var(--muted); }
.topbar-date { font-size: 12px; color: var(--muted); margin-right: 16px; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert { padding: 12px 20px; margin: 12px 24px 0;
         border-radius: var(--radius); font-size: 14px; }
.alert-success { background: rgba(34,197,94,.15); color: #86efac; border: 1px solid rgba(34,197,94,.3); }
.alert-error   { background: rgba(248,113,113,.15); color: #fca5a5; border: 1px solid rgba(248,113,113,.3); }

/* ── KPI cards ────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary);
    display: flex; flex-direction: column; gap: 6px;
    border: 1px solid var(--border);
    border-top-width: 4px;
}
.kpi-card.kpi-blue   { border-top-color: var(--blue); }
.kpi-card.kpi-purple { border-top-color: var(--purple); }
.kpi-card.kpi-orange { border-top-color: var(--orange); }
.kpi-card.kpi-green  { border-top-color: var(--green); }

.kpi-label { font-size: 12px; font-weight: 600; color: var(--muted);
             text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { font-size: 32px; font-weight: 700; color: var(--text); line-height: 1; }
.kpi-link  { font-size: 12px; color: var(--primary); margin-top: 4px; }

/* ── Panel grid ───────────────────────────────────────────── */
.panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.panel       { background: var(--surface); border-radius: var(--radius);
               box-shadow: var(--shadow); overflow: hidden;
               border: 1px solid var(--border); }
.panel-wide  { grid-column: span 2; }

.panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.panel-header h2 { font-size: 15px; font-weight: 600; }
.panel-link { font-size: 12px; color: var(--primary); }

.empty-state { padding: 24px 20px; color: var(--muted); font-size: 14px; }

/* ── Tables ───────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th,
.data-table td {
    padding: 10px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.data-table th { color: var(--muted); font-weight: 600;
                 font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.data-table tbody tr:hover { background: var(--surface2); }
.data-table tbody tr:last-child td { border-bottom: none; }

.text-right  { text-align: right; }
.text-muted  { color: var(--muted); }
.text-danger { color: var(--red); }
.text-success { color: var(--green); }
.fw-bold     { font-weight: 700; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px; font-weight: 600;
    text-transform: capitalize;
}
.badge-scheduled  { background: rgba(56,189,248,.2); color: #7dd3fc; }
.badge-confirmed  { background: rgba(34,197,94,.2);  color: #86efac; }
.badge-checked_in { background: rgba(167,139,250,.2); color: #c4b5fd; }
.badge-no_show    { background: rgba(248,113,113,.2); color: #fca5a5; }
.badge-cancelled  { background: rgba(100,116,139,.2); color: #94a3b8; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px; font-weight: 500;
    cursor: pointer; border: none; text-decoration: none;
    transition: background .15s;
}
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); text-decoration: none; color: #fff; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: 13px; font-weight: 600; color: #94a3b8; }
.form-group input, .form-group select, .form-group textarea {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color .15s;
    width: 100%;
    background: var(--bg);
    color: var(--text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249,115,22,.2);
}
.form-group select option { background: var(--surface); color: var(--text); }

/* ── Auth layout ──────────────────────────────────────────── */
.auth-body { background: var(--bg); }
.auth-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%; max-width: 400px;
    box-shadow: 0 4px 24px rgba(0,0,0,.4);
}
.auth-logo {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    font-size: 24px; font-weight: 700; margin-bottom: 28px;
    color: var(--primary);
}
.auth-title { font-size: 20px; font-weight: 600; margin-bottom: 20px; text-align: center; color: var(--text); }
.auth-form  { display: flex; flex-direction: column; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .kpi-grid   { grid-template-columns: repeat(2, 1fr); }
    .panel-grid { grid-template-columns: 1fr; }
    .panel-wide { grid-column: span 1; }
}
@media (max-width: 600px) {
    .sidebar { transform: translateX(-100%); }
    .main    { margin-left: 0; }
    .kpi-grid { grid-template-columns: 1fr; }
}
/* ── Page actions bar ─────────────────────────────────── */
.page-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

/* ── Search form ──────────────────────────────────────── */
.search-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.search-form input[type=text],
.search-form select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
}
.search-form input[type=text] { min-width: 240px; }

/* ── Form page wrapper ────────────────────────────────── */
.form-page { max-width: 900px; }
.form-body  { padding: 20px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 0 12px; }
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea { border-color: var(--red); }
.error-msg { color: var(--red); font-size: 12px; margin-top: 4px; }

/* ── Show layout (detail pages) ───────────────────────── */
.show-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    align-items: start;
}
.show-main {}
.show-side {}

/* ── Detail grid ──────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 4px 0;
}
.detail-item {
    display: flex;
    flex-direction: column;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
}
.detail-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    margin-bottom: 3px;
}
.detail-list { padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }

/* ── Vehicle card ─────────────────────────────────────── */
.vehicle-card {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}
.vehicle-title { font-weight: 600; }
.vehicle-meta  { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── RO layout ────────────────────────────────────────── */
.ro-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}
.ro-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 16px;
    align-items: start;
}
.ro-main {}
.ro-side {}

/* ── Service blocks ───────────────────────────────────── */
.service-block {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.service-block:last-of-type { border-bottom: none; }
.service-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.service-desc { font-size: 13px; color: var(--muted); margin: 4px 0 0; }

/* ── Service status controls ──────────────────────────── */
.svc-status-group {
    display: flex;
    align-items: center;
    gap: 5px;
}
.svc-status-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: .3px;
    white-space: nowrap;
}
.svc-status-pending     { background: rgba(251,191,36,.2); color: #fcd34d; }
.svc-status-inprogress  { background: rgba(56,189,248,.2); color: #7dd3fc; }
.svc-status-completed   { background: rgba(34,197,94,.2);  color: #86efac; }
.svc-status-declined    { background: rgba(248,113,113,.2); color: #fca5a5; }
.svc-status-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background .12s;
}
.svc-status-btn:hover { background: #334155; }
.svc-status-btn-decline {
    background: transparent;
    border: 1px solid rgba(248,113,113,.4);
    color: #f87171;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background .12s;
}
.svc-status-btn-decline:hover { background: rgba(248,113,113,.15); }
.add-part-form { margin-top: 10px; font-size: 13px; cursor: pointer; }
.add-part-form summary { color: var(--primary); list-style: none; }
.add-service-form { padding: 16px 20px; }

/* ── Totals table ─────────────────────────────────────── */
.totals-table { width: 100%; border-collapse: collapse; }
.totals-table td { padding: 8px 20px; font-size: 14px; }
.totals-table .total-row td {
    border-top: 2px solid var(--border);
    font-size: 16px;
    padding-top: 12px;
}

/* ── Invoice layout ───────────────────────────────────── */
.invoice-meta {
    display: flex;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.7;
}

/* ── Settings tabs ────────────────────────────────────── */
.settings-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}
.tab {
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    border-radius: 6px 6px 0 0;
    text-decoration: none;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -2px;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab-active {
    color: var(--primary);
    background: var(--surface);
    border-color: var(--border);
    border-bottom-color: var(--surface);
}

/* ── Badge additions ──────────────────────────────────── */
.badge-estimate        { background: rgba(100,116,139,.2); color: #94a3b8; }
.badge-pending_approval{ background: rgba(251,191,36,.2);  color: #fcd34d; }
.badge-approved        { background: rgba(56,189,248,.2);  color: #7dd3fc; }
.badge-in_progress     { background: rgba(167,139,250,.2); color: #c4b5fd; }
.badge-completed       { background: rgba(34,197,94,.2);   color: #86efac; }
.badge-invoiced        { background: rgba(34,197,94,.2);   color: #86efac; }
.badge-void            { background: rgba(248,113,113,.2); color: #fca5a5; }
.badge-success         { background: rgba(34,197,94,.2);   color: #86efac; }
.badge-neutral         { background: rgba(100,116,139,.2); color: #94a3b8; }
.badge-inv-draft       { background: rgba(100,116,139,.2); color: #94a3b8; }
.badge-inv-sent        { background: rgba(56,189,248,.2);  color: #7dd3fc; }
.badge-inv-partial     { background: rgba(251,191,36,.2);  color: #fcd34d; }
.badge-inv-paid        { background: rgba(34,197,94,.2);   color: #86efac; }
.badge-inv-void        { background: rgba(248,113,113,.2); color: #fca5a5; }
.badge-priority-low    { background: rgba(100,116,139,.2); color: #94a3b8; }
.badge-priority-normal { background: rgba(56,189,248,.2);  color: #7dd3fc; }
.badge-priority-high   { background: rgba(251,191,36,.2);  color: #fcd34d; }
.badge-priority-urgent { background: rgba(248,113,113,.2); color: #fca5a5; }

/* ── Utility classes ──────────────────────────────────── */
.tac         { text-align: center; }
.tar         { text-align: right; }
.danger      { color: var(--red); }
.success     { color: var(--green); }
.bold        { font-weight: 700; }
.link-strong { font-weight: 600; color: var(--primary); }
.low-stock-tag {
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 99px;
    margin-left: 6px;
    vertical-align: middle;
}
.row-warning { background: rgba(251,191,36,.08); }
.table-footer {
    padding: 10px 20px;
    font-size: 12px;
    color: var(--muted);
    border-top: 1px solid var(--border);
}
.select-inline {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--bg);
    color: var(--text);
}
.date-jump {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
}
.btn-sm     { padding: 4px 10px; font-size: 12px; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #334155; text-decoration: none; }
.btn-ghost  { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); text-decoration: none; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #ef4444; text-decoration: none; }

/* ── Responsive additions ─────────────────────────────── */
@media (max-width: 900px) {
    .show-layout  { grid-template-columns: 1fr; }
    .ro-layout    { grid-template-columns: 1fr; }
    .form-grid-2  { grid-template-columns: 1fr; }
    .form-grid-4  { grid-template-columns: 1fr 1fr; }
    .detail-grid  { grid-template-columns: 1fr; }
}
/* ── VIN input ────────────────────────────────────────── */
.vin-section    { margin-bottom: 4px; }
.vin-row        { display: flex; gap: 0; }
.vin-input-wrap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vin-input-wrap input { flex: 1; min-width: 200px; }
.vin-scan-btn   { white-space: nowrap; }

.vin-status {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
}
.vin-status-loading { background: rgba(56,189,248,.15); color: #7dd3fc; border: 1px solid rgba(56,189,248,.3); }
.vin-status-success { background: rgba(34,197,94,.15);  color: #86efac; border: 1px solid rgba(34,197,94,.3); }
.vin-status-error   { background: rgba(248,113,113,.15); color: #fca5a5; border: 1px solid rgba(248,113,113,.3); }

.vin-display {
    font-family: monospace;
    font-size: 13px;
    letter-spacing: 1px;
    background: var(--surface2);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ── VIN Scanner overlay ──────────────────────────────── */
.scanner-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.8);
    z-index: 200;
}

.scanner-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 201;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: min(480px, 95vw);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

#vin-scanner-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 199;
    align-items: center;
    justify-content: center;
}

.scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.scanner-header h3 { margin: 0; font-size: 16px; }
.scanner-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--muted);
    line-height: 1;
    padding: 0 4px;
}
.scanner-close:hover { color: var(--red); }

.scanner-body {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16/9;
}

#scanner-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.scanner-reticle {
    position: absolute;
    inset: 20% 10%;
    border: 2px solid rgba(255,255,255,.5);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reticle-line {
    width: 80%;
    height: 2px;
    background: #f97316;
    box-shadow: 0 0 8px #f97316;
    animation: scan-line 2s ease-in-out infinite;
}

@keyframes scan-line {
    0%, 100% { transform: translateY(-20px); opacity: .8; }
    50%       { transform: translateY(20px);  opacity: 1;  }
}

.scanner-hint {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    margin: 0;
}

.scanner-result-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(34,197,94,.15);
    border: 1px solid rgba(34,197,94,.3);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: monospace;
    font-size: 14px;
    color: #86efac;
    letter-spacing: 1px;
}

/* ── Vehicle stats sidebar ────────────────────────────── */
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.stat-row:last-child { border-bottom: none; }

/* ── Job Board ────────────────────────────────────────────────── */
.jb-totals-strip {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.jb-total-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    border: 2px solid;
    border-radius: 99px;
    padding: 4px 14px;
    font-size: 13px;
    font-weight: 600;
}
.jb-total-count { font-size: 18px; font-weight: 800; }
.jb-total-label { font-size: 12px; }

.jb-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    align-items: flex-start;
    padding-bottom: 16px;
    min-height: 70vh;
}

.jb-column {
    flex: 0 0 280px;
    min-width: 240px;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
}

.jb-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-top: 4px solid;
    border-radius: 10px 10px 0 0;
    background: var(--surface);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 2;
}
.jb-col-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.jb-col-count {
    color: #fff;
    border-radius: 99px;
    padding: 1px 8px;
    font-size: 12px;
    font-weight: 700;
    min-width: 22px;
    text-align: center;
}

.jb-cards {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.jb-empty {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    padding: 20px 0;
}

.jb-card {
    background: var(--surface);
    border-radius: 8px;
    padding: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--border);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    cursor: grab;
    transition: transform .15s, box-shadow .15s, opacity .18s;
    user-select: none;
}
.jb-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.jb-card.jb-dragging {
    opacity: .45;
    transform: scale(.97) rotate(1deg);
    cursor: grabbing;
}

/* Status left-border colors */
.jb-status-estimate         { border-left-color: #64748b; }
.jb-status-pending_approval { border-left-color: #d97706; }
.jb-status-approved         { border-left-color: #38bdf8; }
.jb-status-in_progress      { border-left-color: #a78bfa; }
.jb-status-completed        { border-left-color: #22c55e; }
.jb-status-invoiced         { border-left-color: #06b6d4; }
.jb-status-void             { border-left-color: #475569; }

.jb-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.jb-ro-number {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
}

.jb-priority-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.jb-dot-urgent { background: #f87171; }
.jb-dot-high   { background: #f97316; }
.jb-dot-normal { background: #38bdf8; }
.jb-dot-low    { background: #475569; }

.jb-card-vehicle  { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.jb-vehicle-color { font-size: 11px; color: var(--muted); font-weight: 400; }
.jb-card-customer { font-size: 12px; color: var(--text); margin-bottom: 2px; }
.jb-card-phone    { font-size: 11px; color: var(--muted); }
.jb-card-concern  {
    font-size: 11px; color: var(--muted);
    margin-top: 5px;
    background: var(--bg);
    border-radius: 4px;
    padding: 4px 6px;
    line-height: 1.4;
}
.jb-card-techs {
    font-size: 11px;
    color: var(--muted);
    margin-top: 5px;
}

.jb-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 11px;
}
.jb-promised { color: var(--muted); }
.jb-overdue  { color: var(--red); font-weight: 600; }
.jb-card-total { font-weight: 700; font-size: 13px; color: var(--text); }

.jb-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.jb-action-btn {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg);
    cursor: pointer;
    font-weight: 600;
    color: var(--muted);
    transition: background .12s, color .12s;
}
.jb-action-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.jb-action-next { color: var(--primary); border-color: var(--primary); }
.jb-action-next:hover { background: var(--primary); color: #fff; }

/* Toast */
.jb-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 999;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
    transition: opacity .3s;
    pointer-events: none;
}

/* Board responsive */
@media (max-width: 768px) {
    .jb-board { flex-direction: column; }
    .jb-column { flex: none; width: 100%; max-height: none; }
}

/* ── Invoice sections ─────────────────────────────────── */
.inv-section {
    padding: 20px;
    border-top: 1px solid var(--border);
}

.inv-section-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text);
}

.inv-pay-section {
    background: var(--surface2);
    border-top: 2px solid var(--border);
}

.inv-pay-form {
    max-width: 680px;
}

/* ── Invoice tfoot ────────────────────────────────────── */
.data-table tfoot td {
    padding: 8px 20px;
    font-size: 14px;
    border-bottom: none;
    border-top: 1px solid var(--border);
}

.data-table tfoot .total-row td {
    border-top: 2px solid var(--border);
    font-size: 16px;
    padding-top: 12px;
    padding-bottom: 12px;
}

/* ── Service status select ────────────────────────────── */
.svc-status-select {
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}
.svc-status-pending     { background: rgba(251,191,36,.2);  color: #fcd34d; }
.svc-status-in_progress { background: rgba(167,139,250,.2); color: #c4b5fd; }
.svc-status-completed   { background: rgba(34,197,94,.2);   color: #86efac; }
.svc-status-declined    { background: rgba(248,113,113,.2); color: #fca5a5; }

.badge-svc-pending     { background: rgba(251,191,36,.2);  color: #fcd34d; }
.badge-svc-in_progress { background: rgba(167,139,250,.2); color: #c4b5fd; }
.badge-svc-completed   { background: rgba(34,197,94,.2);   color: #86efac; }
.badge-svc-declined    { background: rgba(248,113,113,.2); color: #fca5a5; }

/* ── Appointment slot grid ────────────────────────────── */
.appt-slot-grid {
    display: flex;
    flex-direction: column;
}

.appt-slot {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 0;
    min-height: 64px;
    border-bottom: 1px solid var(--border);
}
.appt-slot:last-child { border-bottom: none; }

.appt-slot-time {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    border-right: 2px solid var(--border);
    background: rgba(255,255,255,.02);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.appt-slot-badge {
    background: var(--primary);
    color: #fff;
    border-radius: 99px;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 700;
}

.appt-slot-cards {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.appt-slot-open {
    font-size: 12px;
    color: #334155;
    padding: 4px 0;
    align-self: center;
}

.appt-slot-has-appts { background: rgba(249,115,22,.04); }

/* Appointment card inside slot */
.appt-card {
    background: var(--surface);
    border-radius: 8px;
    padding: 10px 12px;
    border-left: 4px solid var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    font-size: 13px;
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.appt-card-scheduled  { border-left-color: #38bdf8; }
.appt-card-confirmed  { border-left-color: #22c55e; }
.appt-card-checked_in { border-left-color: #a78bfa; }
.appt-card-no_show    { border-left-color: #f87171; }
.appt-card-cancelled  { border-left-color: #475569; opacity: .6; }

.appt-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}
.appt-card-customer,
.appt-card-vehicle,
.appt-card-tech {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}
.appt-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* Status select color coding */
.appt-status-scheduled  { background: rgba(56,189,248,.2);  color: #7dd3fc; border-color: rgba(56,189,248,.3); }
.appt-status-confirmed  { background: rgba(34,197,94,.2);   color: #86efac; border-color: rgba(34,197,94,.3); }
.appt-status-checked_in { background: rgba(167,139,250,.2); color: #c4b5fd; border-color: rgba(167,139,250,.3); }
.appt-status-no_show    { background: rgba(248,113,113,.2); color: #fca5a5; border-color: rgba(248,113,113,.3); }
.appt-status-cancelled  { background: rgba(100,116,139,.2); color: #94a3b8; border-color: rgba(100,116,139,.3); }

.btn-full { width: 100%; justify-content: center; text-align: center; }
