/* Build a Trailer - Main Stylesheet */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.main-header {
    background: #1a1a2e;
    color: white;
    padding: 1rem 0;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    color: white;
    opacity: .92;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.main-nav a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

.main-nav a:hover {
    color: #16a34a;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: white;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    padding: 6rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.5rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    cursor: pointer;
}

.btn-primary {
    background: #16a34a;
    color: white;
    border: none;
}

.btn-primary:hover {
    background: #d63850;
}

.btn-outline {
    border: 2px solid #16a34a;
    color: #16a34a;
    background: transparent;
}

.btn-outline:hover {
    background: #16a34a;
    color: white;
}

/* Sections */
section {
    padding: 4rem 0;
}

.intro {
    text-align: center;
}

.intro h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.page-header {
    background: #f5f5f5;
    text-align: center;
}

.page-header h1 {
    font-size: 2.5rem;
}

.contact-section {
    text-align: center;
}

/* Footer */
.main-footer {
    background: #1a1a2e;
    color: white;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: #16a34a;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: #ccc;
    text-decoration: none;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #333;
    color: #888;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #1a1a2e;
        border-top: 1px solid rgba(255,255,255,0.1);
        z-index: 200;
        padding: 0.5rem 0;
    }

    .main-nav.active {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 0;
        padding: 0;
    }

    .main-nav a {
        display: block;
        padding: 0.75rem 1.5rem;
    }

    .main-header .container {
        position: relative;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }
}

/* =============================================================
   FORMS (shared)
   ============================================================= */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(245,158,11,0.12);
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.btn-lg {
    padding: 14px 36px;
    font-size: 1.1rem;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    color: #1d4ed8;
}

/* =============================================================
   LOGIN PAGE
   ============================================================= */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-icon-lg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #16a34a;
    color: white;
    padding: 16px 20px;
    border-radius: 14px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 14px rgba(245,158,11,0.4);
}

.login-logo h1 {
    font-size: 1.6rem;
    color: #1a1a2e;
    margin-bottom: 0.25rem;
}

.login-logo p {
    color: #888;
    font-size: 0.9rem;
}

/* =============================================================
   ADMIN LAYOUT  (sidebar + main)
   ============================================================= */
.admin-body {
    margin: 0;
    background: #f0f2f5;
    min-height: 100vh;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #1e2640 0%, #141926 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    background: rgba(245,158,11,0.12);
    color: #16a34a;
    border-left: 3px solid #16a34a;
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: 0.5rem;
}

.logout-link {
    color: #16a34a;
    text-decoration: none;
    font-size: 0.85rem;
}

.logout-link:hover {
    text-decoration: underline;
}

.admin-main {
    margin-left: 240px;
    flex: 1;
    min-height: 100vh;
}

.admin-content {
    padding: 2rem;
    max-width: 1200px;
}

/* Admin page header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    color: #1a1a2e;
    margin-bottom: 0.25rem;
}

.page-header p {
    color: #666;
}

/* Dashboard cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}

.dash-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    text-decoration: none;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    transition: box-shadow 0.2s, transform 0.2s;
    border: 1px solid #eee;
}

.dash-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.dash-card-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.dash-card-label {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.3rem;
}

.dash-card-desc {
    font-size: 0.8rem;
    color: #888;
}

/* ── Stat tiles ────────────────────────────────────────────── */
.stat-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-tile {
    border-radius: 10px;
    padding: 1.25rem 1.25rem 1rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.stat-tile__value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: .3rem;
    letter-spacing: -.02em;
}
.stat-tile__label {
    font-size: .78rem;
    opacity: .85;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
}
.stat-tile__link {
    display: inline-block;
    margin-top: .6rem;
    font-size: .78rem;
    color: rgba(255,255,255,.75);
    text-decoration: none;
}
.stat-tile__link:hover { color: #fff; text-decoration: underline; }

.stat-tile--amber  { background: linear-gradient(135deg, #15803d, #16a34a); }
.stat-tile--blue   { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.stat-tile--green  { background: linear-gradient(135deg, #15803d, #22c55e); }
.stat-tile--dark   { background: linear-gradient(135deg, #1e2640, #2d3a5c); }
.stat-tile--neutral {
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #1f2937;
}
.stat-tile--neutral .stat-tile__value { color: #1e2640; }
.stat-tile--neutral .stat-tile__label { color: #6b7280; }
.stat-tile--neutral .stat-tile__link  { color: #16a34a; }

/* ── Dashboard sections ─────────────────────────────────────── */
.dash-section {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
    margin-bottom: 1.75rem;
}
.dash-section h2 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e2640;
}
.dash-section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.dash-section__all {
    font-size: .82rem;
    color: #16a34a;
    text-decoration: none;
    font-weight: 600;
}
.dash-section__all:hover { text-decoration: underline; }
.dash-section .dashboard-cards {
    box-shadow: none;
    border: none;
}

/* ── Recent quotes table ────────────────────────────────────── */
.dash-recent-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.dash-recent-table th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #9ca3af;
    font-weight: 600;
    padding: 6px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}
.dash-recent-table td {
    padding: 10px 10px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.dash-recent-table tbody tr:last-child td { border-bottom: none; }
.dash-recent-table tbody tr:hover td { background: #fafafa; }
.table-link {
    color: #16a34a;
    font-weight: 600;
    font-size: .82rem;
    text-decoration: none;
}
.table-link:hover { text-decoration: underline; }

/* =============================================================
   DEALER LAYOUT
   ============================================================= */
.dealer-body {
    background: #f9f9f9;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dealer-header {
    background: #1a1a2e;
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.dealer-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.dealer-nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

.dealer-nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.dealer-nav a:hover,
.dealer-nav a.active {
    color: white;
    border-bottom-color: #16a34a;
}

.dealer-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.dealer-company {
    color: rgba(255,255,255,0.7);
}

.dealer-main {
    flex: 1;
}

.dealer-section {
    padding: 3rem 0;
}

.dealer-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.dealer-footer {
    background: #1a1a2e;
    color: rgba(255,255,255,0.5);
    text-align: center;
    padding: 1rem 0;
    font-size: 0.85rem;
}

/* =============================================================
   ADMIN UI COMPONENTS  (tables, badges, filters, pagination, forms)
   ============================================================= */

/* Page header with flex layout (title left, action button right) */
.page-header--flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.back-link {
    display: inline-block;
    color: #888;
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.back-link:hover {
    color: #16a34a;
}

/* Filter / search bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.filter-search {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.filter-search:focus {
    outline: none;
    border-color: #16a34a;
    box-shadow: 0 0 0 2px rgba(245,158,11,0.12);
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
}

.filter-count {
    color: #888;
    font-size: 0.85rem;
    white-space: nowrap;
    margin-left: auto;
}

/* Data table */
.table-wrapper {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    background: #f7f8fa;
    padding: 10px 14px;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #666;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: #fafafa;
}

.row--inactive td {
    opacity: 0.55;
}

/* Text utilities */
.text-right  { text-align: right; }
.text-muted  { color: #999; }
.mono        { font-family: 'Courier New', Courier, monospace; font-size: 0.88em; }
.input-mono  { font-family: 'Courier New', Courier, monospace; }
.input-uppercase { text-transform: uppercase; }

/* Status badges */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge--active {
    background: #dcfce7;
    color: #166534;
}

.badge--inactive {
    background: #f1f5f9;
    color: #64748b;
}

.badge--default {
    background: #fef3c7;
    color: #92400e;
}

.badge--draft       { background: #fef9c3; color: #854d0e; }
.badge--submitted   { background: #dbeafe; color: #1e40af; }
.badge--acknowledged { background: #e0e7ff; color: #3730a3; }
.badge--ordered     { background: #dcfce7; color: #166534; }
.badge--cancelled   { background: #fee2e2; color: #991b1b; }

/* Action buttons in table cells */
.actions-cell {
    white-space: nowrap;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

.btn-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.btn-danger:hover {
    background: #fca5a5;
    color: #7f1d1d;
}

.btn-ghost {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
}

.btn-ghost:hover {
    background: #f5f5f5;
    color: #333;
}

/* Inline form (for delete buttons in table rows) */
.inline-form {
    display: inline-block;
    margin: 0;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.pagination-btn {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: #555;
    font-size: 0.85rem;
    background: white;
    transition: all 0.15s;
}

.pagination-btn:hover {
    border-color: #16a34a;
    color: #16a34a;
}

.pagination-btn--active {
    background: #16a34a;
    border-color: #16a34a;
    color: white;
}

.pagination-info {
    margin-left: auto;
    color: #888;
    font-size: 0.8rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    color: #888;
}

.empty-state p {
    margin-bottom: 1.25rem;
    font-size: 1rem;
}

/* Form card (wraps create/edit forms) */
.form-card {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    max-width: 820px;
}

/* Two-column form grid; full-width items span both columns */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-group--full {
    grid-column: 1 / -1;
}

.form-group--error input,
.form-group--error select,
.form-group--error textarea {
    border-color: #fca5a5;
    background: #fff5f5;
}

.field-error {
    display: block;
    color: #b91c1c;
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

.field-hint {
    display: block;
    color: #9ca3af;
    font-size: 0.78rem;
    margin-top: 0.25rem;
}

.field-optional {
    color: #aaa;
    font-weight: 400;
    font-size: 0.8rem;
}

.required {
    color: #16a34a;
}

/* Checkbox label */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    font-weight: 600;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-top: 3px;
    flex-shrink: 0;
}

.checkbox-label .field-hint {
    display: block;
    font-weight: 400;
    margin-top: 0;
}

/* Form action bar */
.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
}

.form-meta {
    margin-left: auto;
    font-size: 0.78rem;
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* =============================================================
   ASSEMBLY BUILDER — BOM-specific UI
   ============================================================= */

.section-heading {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.bom-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Part picker row */
.part-picker {
    background: #f7f8fa;
    border: 1px dashed #ddd;
    border-radius: 8px;
    padding: 1rem;
}

.part-picker-fields {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 0.35rem;
}

.picker-select {
    flex: 1;
    min-width: 260px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
}

.picker-qty {
    width: 90px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Inline qty/notes inputs inside the BOM table */
.qty-input {
    width: 80px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: right;
}

.notes-input {
    width: 100%;
    min-width: 120px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.qty-input:focus,
.notes-input:focus {
    outline: none;
    border-color: #16a34a;
}

/* BOM total footer row */
.bom-total-row td {
    background: #f7f8fa;
    font-size: 0.9rem;
    border-top: 2px solid #eee;
    padding: 10px 14px;
}

/* =========================
   TRAILER OPTIONS — choice form assembly checkboxes
   ========================= */

.section-desc {
    margin: -0.5rem 0 1rem;
    color: #666;
    font-size: 0.88rem;
    line-height: 1.5;
}

/* Scrollable list of assemblies to pick from */
.assembly-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 380px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px;
    background: #fafafa;
}

.assembly-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 5px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.assembly-checkbox-item:hover {
    background: #f0f4ff;
    border-color: #c5d3f7;
}

.assembly-checkbox-item--checked {
    background: #edf2ff;
    border-color: #4a6cf7;
}

.assembly-checkbox-item input[type="checkbox"] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: #4a6cf7;
    cursor: pointer;
}

.assembly-checkbox-name {
    flex: 1;
    font-size: 0.9rem;
    color: #222;
}

.assembly-checkbox-cost {
    flex-shrink: 0;
    font-size: 0.88rem;
    color: #555;
    font-feature-settings: "tnum";
}

/* Running cost total below the list */
.choice-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 10px 12px;
    background: #f7f8fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

.choice-total-value {
    font-size: 1rem;
    color: #4a6cf7;
}

/* =========================
   OPTIONS LIST — assembly tags on choices row
   ========================= */

.asm-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.asm-tag {
    display: inline-block;
    background: #edf2ff;
    color: #3a5bd9;
    border: 1px solid #c5d3f7;
    border-radius: 4px;
    padding: 1px 7px;
    font-size: 0.78rem;
    white-space: nowrap;
}

.text-warning {
    color: #15803d;
    font-size: 0.85rem;
}

/* =========================
   FORM — checkbox group helper
   ========================= */

.form-group--checkboxes {
    display: flex;
    flex-direction: column;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #4a6cf7;
    cursor: pointer;
}

.field-hint {
    color: #888;
    font-size: 0.82rem;
    font-style: italic;
    margin-left: 4px;
}

/* Hint text above tables */
.hint-text {
    font-size: 0.87rem;
    color: #666;
}

/* ==========================================================================
   DEALER BUILDER — step wizard
   ========================================================================== */

.builder-wrapper {
    padding: 2rem 0 4rem;
    background: #f5f6fa;
    min-height: calc(100vh - 64px);
}

/* ---- Progress bar ---- */
.builder-progress {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 4px;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.progress-step-bubble {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #dde0e8;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    transition: background 0.2s, color 0.2s;
}

.progress-step--done .progress-step-bubble {
    background: #4a6cf7;
    color: #fff;
}

.progress-step--current .progress-step-bubble {
    background: #4a6cf7;
    color: #fff;
    box-shadow: 0 0 0 4px rgba(74,108,247,.2);
}

.progress-check {
    font-size: 1rem;
    line-height: 1;
}

.progress-step-label {
    font-size: 0.72rem;
    color: #888;
    text-align: center;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-step--current .progress-step-label {
    color: #4a6cf7;
    font-weight: 600;
}

.progress-connector {
    flex: 1;
    height: 2px;
    background: #dde0e8;
    min-width: 20px;
    margin-bottom: 18px;   /* align with bubble centre */
    transition: background 0.2s;
}

.progress-connector--done {
    background: #4a6cf7;
}

/* ---- Running total banner ---- */
.builder-total-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 18px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.builder-total-label {
    color: #555;
    font-weight: 600;
}

.builder-total-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #222;
    font-feature-settings: "tnum";
}

.builder-total-note {
    color: #999;
    font-size: 0.8rem;
}

/* ---- Step card ---- */
.builder-step-card {
    background: #fff;
    border: 1px solid #e0e4ef;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.builder-step-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #f0f0f0;
}

.step-counter {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #4a6cf7;
}

.step-title {
    margin: 6px 0 4px;
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a1a2e;
}

.step-desc {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.step-optional-note {
    margin: 6px 0 0;
    color: #15803d;
    font-size: 0.85rem;
    font-style: italic;
}

/* ---- Choice radio cards ---- */
.choice-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 1.75rem;
}

.choice-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 2px solid #e0e4ef;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    background: #fff;
}

.choice-card:hover {
    border-color: #a0b0f7;
    background: #f7f9ff;
}

.choice-card--selected {
    border-color: #4a6cf7;
    background: #edf2ff;
    box-shadow: 0 0 0 3px rgba(74,108,247,.12);
}

.choice-card input[type="radio"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: #4a6cf7;
    cursor: pointer;
}

.choice-card-body {
    flex: 1;
}

.choice-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1a1a2e;
}

.choice-card-desc {
    margin-top: 2px;
    font-size: 0.83rem;
    color: #666;
}

.choice-card-cost {
    flex-shrink: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    font-feature-settings: "tnum";
}

/* ---- Step nav ---- */
.builder-step-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

/* ==========================================================================
   DEALER QUOTES — list & detail
   ========================================================================== */

.quote-section-card {
    background: #fff;
    border: 1px solid #e0e4ef;
    border-radius: 10px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.25rem;
}

.quote-options-table tfoot tr td {
    background: #f7f8fa;
    border-top: 2px solid #dde0e8;
    padding: 10px 14px;
}

.quote-total-row td {
    font-size: 1rem;
}

.quote-submit-panel {
    background: #fff;
    border: 1px solid #e0e4ef;
    border-radius: 10px;
    padding: 1.5rem 2rem;
    text-align: center;
}

.submit-hint {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: #888;
}

.submit-blocked {
    opacity: 0.7;
}

/* Draft / submitted / acknowledged / ordered badge colours */
.badge--draft        { background: #f0f1f3; color: #555; border: 1px solid #d0d2d8; }
.badge--submitted    { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge--acknowledged { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge--ordered      { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* Warning row highlight for missing required option */
tr.row--warning td {
    background: #fffbeb;
}

.back-link {
    display: inline-block;
    color: #4a6cf7;
    font-size: 0.85rem;
    margin-bottom: 6px;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

/* ================================================================
   Admin — Order detail (two-column layout)
   ================================================================ */
.order-detail-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .order-detail-grid {
        grid-template-columns: 1fr;
    }
}

.order-sidebar { }

.order-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 18px 20px;
    margin-bottom: 16px;
}

.order-card h3 {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #888;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}

/* Definition list used in sidebar cards */
.info-list {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 10px;
    row-gap: 4px;
    font-size: .85rem;
}

.info-list dt {
    color: #888;
    white-space: nowrap;
}

.info-list dd {
    font-weight: 500;
    word-break: break-word;
}

/* Bullet list of selected options in sidebar */
.selection-summary-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: .85rem;
}

.selection-summary-list li {
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.selection-summary-list li:last-child { border-bottom: none; }

.selection-summary-list .cat-name { color: #888; font-size: .8rem; }
.selection-summary-list .choice-name { font-weight: 500; }

/* Status update buttons in sidebar */
.status-actions { display: flex; flex-direction: column; gap: 8px; }

.btn-status {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
    transition: opacity .15s;
}

.btn-status:hover { opacity: .85; }
.btn-status--acknowledge { background: #2563eb; color: #fff; }
.btn-status--order       { background: #16a34a; color: #fff; }
.btn-status--cancel      { background: #dc2626; color: #fff; }

/* Parts groups in the main column */
.parts-group {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 20px;
    overflow: hidden;
}

.parts-group-header {
    background: #f5f5f5;
    padding: 10px 16px;
    font-weight: 700;
    font-size: .9rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.parts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.parts-table th {
    background: #1a1a2e;
    color: #fff;
    padding: 8px 12px;
    text-align: left;
    font-size: .8rem;
}

.parts-table th.r { text-align: right; }

.parts-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.parts-table td.r {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.parts-table tbody tr:hover td { background: #f9fafb; }

.parts-subtotal-row td {
    background: #f0f4ff;
    font-weight: 600;
    border-top: 1px solid #c7d2fe;
}

.order-grand-total {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 32px;
    background: #1a1a2e;
    color: #fff;
    padding: 14px 20px;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 4px;
}

/* Status badges extra colours used in orders */
.badge--submitted   { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge--acknowledged { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.badge--ordered     { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.badge--cancelled   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ================================================================
   Print helpers (screen + print media)
   ================================================================ */
@media print {
    .site-header,
    .site-nav,
    .sidebar,
    .no-print,
    .btn-status,
    .status-actions { display: none !important; }

    .order-detail-grid {
        grid-template-columns: 1fr;
    }

    .order-sidebar { display: none !important; }

    body { background: #fff; }
}

/* ================================================================
   Admin — Users page additions
   ================================================================ */

/* Extra-small button variant (for table rows with multiple actions) */
.btn-xs {
    padding: 6px 9px;
    font-size: 0.75rem;
    min-height: 30px; /* adequate touch target in dense admin tables */
}

/* Semantic colour variants */
.btn-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}
.btn-warning:hover {
    background: #fcd34d;
    color: #78350f;
}

.btn-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}
.btn-success:hover {
    background: #6ee7b7;
    color: #064e3b;
}

/* Role badges */
.badge--admin {
    background: #ede9fe;
    color: #5b21b6;
}

.badge--dealer {
    background: #e0f2fe;
    color: #075985;
}

/* Pagination (link variant used on users list) */
.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    color: #333;
    text-decoration: none;
    transition: background .12s;
}

.pagination-link:hover {
    background: #f5f5f5;
}

.pagination-link--active {
    background: var(--primary, #1a1a2e);
    color: #fff;
    border-color: var(--primary, #1a1a2e);
    font-weight: 600;
}

/* Table summary line */
.table-summary {
    font-size: 0.8rem;
    color: #888;
    margin-top: 8px;
}

/* ---- Compatibility Rules page ---- */
.compat-explainer {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 12px 16px;
    font-size: .875rem;
    margin-bottom: 1.5rem;
    color: #0369a1;
}
.compat-form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.compat-arrow {
    color: #888;
    font-size: 1.1rem;
    padding-bottom: 8px;
    white-space: nowrap;
}
.rule-group-first td {
    border-top: 2px solid #e5e7eb;
}
.rule-group-cont td {
    border-top: 1px dotted #e5e7eb;
}

/* ---- Compatibility Matrix ---- */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.compat-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.compat-matrix th {
    background: #f8f9fa;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #555;
    border-bottom: 2px solid #e5e7eb;
    white-space: normal;
    word-break: break-word;
}
.compat-matrix__option-col  { width: 40%; min-width: 180px; }
.compat-matrix__toggle-col  { width: 120px; text-align: center; }
.compat-matrix__status-col  { min-width: 180px; }
.compat-matrix__cb-cell     { text-align: center; }   /* legacy */
.compat-type-heading        { font-weight: 700; color: #1d4ed8; text-transform: none;
                               font-size: .85rem; letter-spacing: 0; }

/* Trailer type selector bar */
.compat-type-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8faff;
    border: 1px solid #c7d7f9;
    border-radius: 8px;
    padding: 12px 18px;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.compat-type-bar__label {
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    font-size: .9rem;
}
.compat-type-bar__select {
    font-size: .95rem;
    padding: 6px 32px 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #1f2937;
    cursor: pointer;
    min-width: 200px;
}
.compat-type-bar__select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.compat-type-bar__hint {
    font-size: .8rem;
    color: #9ca3af;
    margin-left: auto;
}

/* Category divider rows */
.compat-matrix__cat-row td {
    background: #f0f4f8;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #6b7280;
    padding: 6px 14px;
    border-top: 1px solid #e5e7eb;
}

/* Data rows */
.compat-matrix__row td {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.compat-matrix__row:hover td { background: #fafafa; }

.compat-matrix__option-name { color: #1f2937; }
.compat-matrix__cb-cell     { text-align: center; }

/* ---- Toggle Switch ---- */
.compat-switch {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}
.compat-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.compat-switch__track {
    display: block;
    width: 40px;
    height: 22px;
    background: #d1d5db;
    border-radius: 11px;
    position: relative;
    transition: background .18s;
}
.compat-switch__track::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform .18s;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.compat-switch input:checked + .compat-switch__track {
    background: #2563eb;
}
.compat-switch input:checked + .compat-switch__track::after {
    transform: translateX(18px);
}
.compat-switch input:disabled + .compat-switch__track {
    opacity: .5;
    cursor: not-allowed;
}

/* ---- Visibility badges ---- */
.compat-badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    margin: 1px 2px;
    white-space: nowrap;
}
.compat-badge--always {
    background: #dcfce7;
    color: #166534;
}
.compat-badge--type {
    background: #dbeafe;
    color: #1e40af;
}

/* ---- Compatibility toast notification ---- */
.compat-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e293b;
    color: #f1f5f9;
    font-size: .875rem;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    pointer-events: none;
    opacity: 0;
    transition: opacity .18s ease, transform .18s ease;
    z-index: 9999;
    max-width: 480px;
    text-align: center;
    white-space: normal;
}
.compat-toast--show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.compat-toast--error {
    background: #7f1d1d;
    color: #fecaca;
}

/* =============================================================
   SETTINGS
   ============================================================= */

.settings-hub {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}
.settings-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    text-decoration: none;
    color: #1f2937;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    transition: box-shadow .15s, border-color .15s;
}
.settings-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.1);
    border-color: #16a34a;
}
.settings-card-icon { font-size: 2rem; flex-shrink: 0; }
.settings-card-body { flex: 1; }
.settings-card-title { font-weight: 700; font-size: 1rem; margin-bottom: .2rem; }
.settings-card-desc { font-size: .83rem; color: #6b7280; line-height: 1.4; }
.settings-card-arrow { font-size: 1.5rem; color: #d1d5db; flex-shrink: 0; }

.settings-two-col {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    align-items: start;
}
.settings-section-title {
    font-size: .875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6b7280;
    margin-bottom: 1rem;
}

/* =============================================================
   MOBILE RESPONSIVE  (≤ 768px)
   ============================================================= */

/* ---- Hamburgers: hidden on desktop, shown on mobile ---- */
.admin-menu-toggle,
.admin-topbar,
.dealer-menu-toggle {
    display: none;
}

/* ---- Admin overlay backdrop ---- */
.admin-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}
.admin-overlay--show {
    display: block;
}

/* Prevent body scroll when sidebar open */
body.admin-sidebar-active {
    overflow: hidden;
}

@media (max-width: 768px) {

    /* ---- Admin sidebar ---- */
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        height: 100%;
        width: 240px;
        z-index: 1000;
        transition: left 0.25s ease;
        overflow-y: auto;
    }
    .admin-sidebar--open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
    }
    .admin-main {
        margin-left: 0;
    }

    /* ---- Admin topbar (mobile only) ---- */
    .admin-topbar {
        display: flex;
        align-items: center;
        gap: 0.875rem;
        background: #1a1a2e;
        padding: 0.7rem 1rem;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    .admin-topbar-title {
        font-size: 1rem;
        font-weight: 600;
        color: white;
    }
    .admin-menu-toggle {
        display: flex;
        flex-direction: column;
        gap: 5px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 4px;
        flex-shrink: 0;
    }
    .admin-menu-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        background: white;
        border-radius: 2px;
    }

    /* ---- Admin content ---- */
    .admin-content {
        padding: 1rem;
    }
    .page-header h1 {
        font-size: 1.3rem;
    }
    .page-header--flex {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    .form-card {
        padding: 1.25rem;
    }
    .form-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .form-actions .btn {
        text-align: center;
    }
    .form-meta {
        margin-left: 0;
    }

    /* ---- Stat tiles: 2 columns on mobile ---- */
    .stat-tiles {
        grid-template-columns: repeat(2, 1fr);
    }
    .stat-tile {
        min-width: 0;
        word-break: break-word;
    }

    /* ---- Page header wrapping ---- */
    .page-header h1 {
        overflow-wrap: break-word;
        word-break: break-word;
    }

    /* ---- Dashboard recent quotes: card layout ---- */
    .dash-section {
        overflow-x: visible;
    }
    .dash-recent-table thead {
        display: none;
    }
    .dash-recent-table tbody tr {
        display: block;
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        margin-bottom: 0.75rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        padding: 4px 0;
    }
    .dash-recent-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 7px 12px;
        border-bottom: 1px solid #f3f4f6;
        font-size: 0.87rem;
        text-align: left !important;
    }
    .dash-recent-table td:last-child {
        border-bottom: none;
    }
    .dash-recent-table td[data-label]::before {
        content: attr(data-label);
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #9ca3af;
        margin-right: 0.75rem;
        flex-shrink: 0;
        white-space: nowrap;
    }
    .dash-recent-table td.actions-cell {
        justify-content: flex-end;
        gap: 0.4rem;
    }

    /* ---- Dealer header ---- */
    .dealer-header {
        position: relative;
    }
    .dealer-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #16213e;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 200;
        padding: 0.5rem 0;
    }
    .dealer-nav--open {
        display: block;
    }
    .dealer-nav ul {
        flex-direction: column;
        gap: 0;
    }
    .dealer-nav a {
        display: block;
        padding: 0.75rem 1.25rem;
        border-bottom: none !important;
    }
    .dealer-nav a:hover,
    .dealer-nav a.active {
        background: rgba(245, 158, 11, 0.12);
        padding-left: 1.5rem;
    }
    .dealer-user-info {
        gap: 0.5rem;
    }
    .dealer-company {
        display: none;
    }

    /* ---- Dealer hamburger ---- */
    .dealer-menu-toggle {
        display: flex;
        flex-direction: column;
        gap: 5px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 4px;
        flex-shrink: 0;
        margin-left: 0.5rem;
    }
    .dealer-menu-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        background: white;
        border-radius: 2px;
    }

    /* ---- Builder wizard ---- */
    .builder-step-card {
        padding: 1.25rem;
    }
    .step-title {
        font-size: 1.3rem;
    }
    .builder-total-banner {
        flex-wrap: wrap;
        gap: 4px 12px;
        padding: 8px 14px;
    }
    .builder-total-note {
        width: 100%;
    }
    .choice-card {
        padding: 10px 12px;
        gap: 10px;
    }

    /* ---- Quote detail cards ---- */
    .quote-section-card {
        padding: 1rem 1.1rem;
    }
    .quote-submit-panel {
        padding: 1rem 1.1rem;
    }

    /* ---- Order detail sidebar stacks above main ---- */
    .order-detail-grid {
        grid-template-columns: 1fr;
    }

    /* ---- Filter bar ---- */
    .filter-bar {
        padding: 0.75rem;
    }
    .filter-search {
        min-width: 0;
        width: 100%;
    }
    .filter-count {
        margin-left: 0;
        width: 100%;
    }

    /* ---- Action buttons in tables don't wrap oddly ---- */
    .actions-cell {
        white-space: normal;
    }
    .actions-cell .btn {
        margin-bottom: 2px;
    }

    /* ---- Settings ---- */
    .settings-two-col {
        grid-template-columns: 1fr;
    }
    .settings-hub {
        grid-template-columns: 1fr;
    }

    /* ---- Card layout for data tables on mobile ---- */
    /* Any table that has data-label attributes on its <td>s becomes card-based */
    .data-table thead {
        display: none;
    }
    .data-table tbody tr {
        display: block;
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        margin-bottom: 0.75rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        padding: 4px 0;
    }
    .data-table tbody tr.row--inactive {
        opacity: 0.6;
    }
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 7px 12px;
        border-bottom: 1px solid #f3f4f6;
        font-size: 0.87rem;
        text-align: left !important;
    }
    .data-table td:last-child {
        border-bottom: none;
    }
    .data-table td[data-label]::before {
        content: attr(data-label);
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #9ca3af;
        margin-right: 0.75rem;
        flex-shrink: 0;
        white-space: nowrap;
    }
    .data-table td.actions-cell {
        justify-content: flex-end;
        gap: 0.4rem;
        flex-wrap: wrap;
    }
    /* Keep the table-wrapper from adding unnecessary scroll */
    .table-wrapper {
        overflow-x: visible;
        background: transparent;
        box-shadow: none;
        border-radius: 0;
    }
}

/* ── Phone portrait — single-column stat tiles ─────────────── */
@media (max-width: 480px) {
    .stat-tiles {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   DEALER REDESIGN v2
   Overrides the baseline dealer styles above with a premium industrial look.
   ========================================================================== */

:root {
    --d-navy:   #0f1923;
    --d-navy2:  #1a2740;
    --d-green:  #16a34a;
    --d-green2: #15803d;
    --d-amber:  #d97706;
    --d-blue:   #2563eb;
    --d-bg:     #f4f5f7;
    --d-card:   #ffffff;
    --d-border: #e2e4ea;
    --d-text:   #1e2433;
    --d-muted:  #6b7280;

    /* Legacy aliases — used by order-detail, media-preview, and modal components */
    --border:    #e2e4ea;
    --text:      #1e2433;
    --text-muted:#6b7280;
    --primary:   #1a1a2e;
    --danger:    #dc2626;
    --font-mono: 'Courier New', Courier, monospace;
}

/* ── Body + layout ────────────────────────────────────────── */
.dealer-body {
    background: var(--d-bg);
}

/* ── Header ─────────────────────────────────────────────────── */
.dealer-header {
    background: var(--d-navy);
    border-bottom: 1px solid rgba(255,255,255,.06);
    padding: .875rem 0;
}

.logo a {
    font-size: 1.15rem;
    letter-spacing: -.01em;
}

.dealer-nav a {
    font-size: .9rem;
    letter-spacing: .015em;
    padding: 6px 2px;
}

.dealer-menu-toggle {
    /* Hidden by default (desktop); shown via @media (max-width: 768px) below */
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.dealer-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: rgba(255,255,255,.8);
    border-radius: 2px;
    transition: background .2s;
}

/* ── Common page structure ───────────────────────────────────── */
.dealer-page-wrap {
    padding: 2.5rem 0 4rem;
}

.dealer-page-hdr {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.dealer-page-hdr__title {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--d-text);
    letter-spacing: -.02em;
    margin-bottom: .15rem;
}

.dealer-page-hdr__sub {
    color: var(--d-muted);
    font-size: .9rem;
}

.dealer-section-gap {
    margin-top: 2rem;
}

/* ── DASHBOARD HERO ─────────────────────────────────────────── */
.dash-hero {
    position: relative;
    background: linear-gradient(135deg, var(--d-navy) 0%, var(--d-navy2) 60%, #1e3a5f 100%);
    color: #fff;
    padding: 3.5rem 0;
    overflow: hidden;
}

.dash-hero__bg-pattern {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

.dash-hero__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.dash-hero__eyebrow {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--d-green);
    margin-bottom: .6rem;
}

.dash-hero__title {
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -.025em;
    line-height: 1.15;
    margin-bottom: .5rem;
}

.dash-hero__sub {
    font-size: .95rem;
    color: rgba(255,255,255,.65);
    max-width: 480px;
}

.dash-hero__cta {
    background: var(--d-green);
    color: #fff;
    border: none;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(22,163,74,.4);
    transition: background .2s, transform .15s, box-shadow .2s;
}

.dash-hero__cta:hover {
    background: var(--d-green2);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(22,163,74,.5);
}

/* ── Dealer stat tiles ───────────────────────────────────────── */
.dealer-stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.dealer-stat {
    border-radius: 10px;
    padding: 1.4rem 1.5rem 1.2rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.dealer-stat::after {
    content: '';
    position: absolute;
    bottom: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,.07);
    pointer-events: none;
}

.dealer-stat__val {
    font-size: 2.4rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -.03em;
    margin-bottom: .35rem;
}

.dealer-stat__lbl {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .8;
}

.dealer-stat__link {
    display: inline-block;
    margin-top: .65rem;
    font-size: .78rem;
    color: rgba(255,255,255,.7);
    text-decoration: none;
    font-weight: 600;
}

.dealer-stat__link:hover { color: #fff; }

.dealer-stat--green { background: linear-gradient(135deg, #15803d, #16a34a); }
.dealer-stat--amber { background: linear-gradient(135deg, #b45309, #d97706); }
.dealer-stat--blue  { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.dealer-stat--dark  { background: linear-gradient(135deg, #1e2640, #374163); }

/* ── Quick action cards ──────────────────────────────────────── */
.dealer-quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.dealer-action-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--d-card);
    border: 1px solid var(--d-border);
    border-radius: 10px;
    padding: 1.4rem 1.5rem;
    text-decoration: none;
    color: var(--d-text);
    transition: border-color .2s, box-shadow .2s, transform .15s;
}

.dealer-action-card:hover {
    border-color: var(--d-green);
    box-shadow: 0 4px 16px rgba(22,163,74,.1);
    transform: translateY(-2px);
}

.dealer-action-card__icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #bbf7d0;
    color: var(--d-green);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dealer-action-card__title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--d-text);
    margin-bottom: .2rem;
}

.dealer-action-card__desc {
    font-size: .83rem;
    color: var(--d-muted);
}

/* ── Dashboard panel (recent quotes) ────────────────────────── */
.dealer-panel {
    background: var(--d-card);
    border: 1px solid var(--d-border);
    border-radius: 12px;
    overflow: hidden;
}

.dealer-panel__hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--d-border);
}

.dealer-panel__title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--d-text);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.dealer-panel__all {
    font-size: .82rem;
    color: var(--d-green);
    text-decoration: none;
    font-weight: 600;
}

.dealer-panel__all:hover { text-decoration: underline; }

.dealer-recent-list { }

.dealer-recent-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr auto 100px 90px 24px;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1.5rem;
    text-decoration: none;
    color: var(--d-text);
    border-bottom: 1px solid var(--d-border);
    transition: background .15s;
    font-size: .88rem;
}

.dealer-recent-row:last-child { border-bottom: none; }
.dealer-recent-row:hover { background: #f9fafb; }

.dealer-recent-row__num   { font-weight: 700; font-family: monospace; font-size: .85rem; }
.dealer-recent-row__cust  { color: var(--d-muted); }
.dealer-recent-row__price { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.dealer-recent-row__date  { text-align: right; color: var(--d-muted); font-size: .82rem; }
.dealer-recent-row__arrow { text-align: right; color: #ccc; font-size: 1.2rem; }

/* ── Dealer empty state ──────────────────────────────────────── */
.dealer-empty-state {
    text-align: center;
    padding: 5rem 2rem;
    background: var(--d-card);
    border: 1px solid var(--d-border);
    border-radius: 12px;
    color: var(--d-muted);
}

.dealer-empty-state__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: #f3f4f6;
    border-radius: 50%;
    margin-bottom: 1.25rem;
    color: #9ca3af;
}

.dealer-empty-state h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--d-text);
    margin-bottom: .4rem;
}

/* ── Quote card grid ─────────────────────────────────────────── */
.quote-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.1rem;
}

.quote-card {
    background: var(--d-card);
    border: 1px solid var(--d-border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s, transform .15s;
}

.quote-card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,.09);
    transform: translateY(-2px);
}

.quote-card__accent-bar {
    height: 4px;
    background: var(--qc-accent, #94a3b8);
}

.quote-card__body {
    padding: 1.1rem 1.25rem;
    flex: 1;
}

.quote-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .5rem;
}

.quote-card__num {
    font-family: monospace;
    font-size: .9rem;
    font-weight: 700;
    color: var(--d-text);
}

.quote-card__customer {
    font-size: .9rem;
    color: var(--d-text);
    margin-bottom: .75rem;
    min-height: 1.2em;
}

.quote-card__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .83rem;
}

.quote-card__date  { color: var(--d-muted); }
.quote-card__price { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--d-text); }

.quote-card__actions {
    display: flex;
    gap: .5rem;
    padding: .75rem 1.25rem;
    border-top: 1px solid var(--d-border);
    background: #fafbfc;
}

/* ── CONFIGURATOR (Builder) ──────────────────────────────────── */
.configurator-wrap {
    background: var(--d-bg);
    min-height: calc(100vh - 60px);
}

/* Progress strip */
.cfg-progress-strip {
    background: var(--d-navy);
    border-bottom: 1px solid rgba(255,255,255,.08);
    padding: 0;
}

.cfg-progress-inner {
    display: flex;
    align-items: center;
    overflow-x: auto;
    padding: .75rem 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.cfg-progress-inner::-webkit-scrollbar { display: none; }

.cfg-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    min-width: 60px;
}

.cfg-step__bubble {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    color: rgba(255,255,255,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 700;
    transition: background .2s, color .2s;
}

.cfg-step--done .cfg-step__bubble {
    background: var(--d-green);
    color: #fff;
}

.cfg-step--active .cfg-step__bubble {
    background: #fff;
    color: var(--d-navy);
    box-shadow: 0 0 0 3px rgba(255,255,255,.2);
}

.cfg-step__label {
    font-size: .65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(255,255,255,.4);
    text-align: center;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cfg-step--done  .cfg-step__label  { color: var(--d-green); }
.cfg-step--active .cfg-step__label { color: #fff; }

.cfg-step-line {
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,.12);
    min-width: 16px;
    margin-bottom: 16px;
    transition: background .2s;
}

.cfg-step-line--done { background: var(--d-green); }

/* Two-column layout */
.cfg-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    padding: 1.75rem 0 3rem;
    align-items: start;
}

/* Main (left) */
.cfg-main { }

.cfg-card {
    background: var(--d-card);
    border: 1px solid var(--d-border);
    border-radius: 12px;
    overflow: hidden;
}

.cfg-card__hdr {
    padding: 1.5rem 1.75rem 1.25rem;
    border-bottom: 1px solid var(--d-border);
    background: #fafbfc;
}

.cfg-card__counter {
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--d-green);
}

.cfg-card__title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--d-text);
    letter-spacing: -.02em;
    margin: .35rem 0 .3rem;
}

.cfg-card__desc {
    font-size: .88rem;
    color: var(--d-muted);
}

.cfg-card__optional {
    font-size: .82rem;
    color: var(--d-green);
    font-style: italic;
    margin-top: .3rem;
}

/* Choice list inside the card */
.cfg-choice-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 1rem 1.75rem;
}

.cfg-choice {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem .25rem;
    border-bottom: 1px solid var(--d-border);
    cursor: pointer;
    transition: background .12s;
    border-radius: 0;
}

.cfg-choice:last-child { border-bottom: none; }

.cfg-choice:hover { background: #f9fafb; }

.cfg-choice input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cfg-choice__radio-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    flex-shrink: 0;
    position: relative;
    transition: border-color .15s;
}

.cfg-choice__radio-dot::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--d-green);
    opacity: 0;
    transition: opacity .15s;
}

.cfg-choice--selected .cfg-choice__radio-dot {
    border-color: var(--d-green);
}

.cfg-choice--selected .cfg-choice__radio-dot::after {
    opacity: 1;
}

.cfg-choice--selected {
    background: #f0fdf4;
}

.cfg-choice__body { flex: 1; }

.cfg-choice__thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--d-border);
    flex-shrink: 0;
    margin-right: .25rem;
}

/* Wrapper for clickable thumbnails in the builder */
.cfg-choice__thumb-wrap {
    flex-shrink: 0;
    margin-right: .25rem;
    border-radius: 6px;
}
.cfg-choice__thumb-wrap .cfg-choice__thumb {
    margin-right: 0;  /* margin now on the wrapper */
}

.cfg-choice__thumb--stl-only {
    width: 52px;
    height: 52px;
    background: #16a34a;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
}


.cfg-choice__name {
    font-weight: 600;
    font-size: .95rem;
    color: var(--d-text);
}

.cfg-choice__desc {
    font-size: .82rem;
    color: var(--d-muted);
    margin-top: 2px;
}

.cfg-choice__price {
    font-weight: 700;
    font-size: 1rem;
    color: var(--d-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Nav buttons at bottom of card */
.cfg-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.75rem;
    border-top: 1px solid var(--d-border);
    background: #fafbfc;
}

.cfg-nav__next {
    padding: 11px 28px;
    font-size: 1rem;
}

/* Right sidebar summary */
.cfg-sidebar {
    position: sticky;
    top: 80px;
}

.cfg-summary {
    background: var(--d-navy);
    border-radius: 12px;
    overflow: hidden;
    color: #fff;
}

.cfg-summary__hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 1rem 1.25rem;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.5);
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.cfg-summary__items {
    padding: .5rem 0;
}

.cfg-summary__item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: .65rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.05);
}

.cfg-summary__item:last-child { border-bottom: none; }

.cfg-summary__item-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(255,255,255,.4);
    font-weight: 600;
}

.cfg-summary__item-val {
    font-size: .88rem;
    font-weight: 500;
    color: rgba(255,255,255,.85);
}

.cfg-summary__item-val--selecting {
    color: var(--d-green);
    font-style: italic;
}

.cfg-summary__item-val--future {
    color: rgba(255,255,255,.25);
}

.cfg-summary__item--done .cfg-summary__item-label  { color: rgba(255,255,255,.5); }
.cfg-summary__item--active .cfg-summary__item-label { color: var(--d-green); }
.cfg-summary__item--future { opacity: .5; }

.cfg-summary__total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.1);
    background: rgba(255,255,255,.04);
}

.cfg-summary__total-lbl {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
    color: rgba(255,255,255,.5);
}

.cfg-summary__total-val {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -.02em;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.cfg-summary__note {
    padding: .6rem 1.25rem .9rem;
    font-size: .72rem;
    color: rgba(255,255,255,.3);
    line-height: 1.5;
}

/* ── QUOTE DETAIL ────────────────────────────────────────────── */
.qd-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.qd-header__qnum {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--d-text);
    font-family: monospace;
    margin: .3rem 0 .4rem;
}

.qd-header__meta {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.qd-header__created {
    font-size: .83rem;
    color: var(--d-muted);
}

.qd-header__actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* Status timeline */
.qd-timeline {
    display: flex;
    align-items: center;
    background: var(--d-card);
    border: 1px solid var(--d-border);
    border-radius: 10px;
    padding: .9rem 2rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.qd-tl-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.qd-tl-step__dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 700;
}

.qd-tl-step span {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
    color: var(--d-muted);
}

.qd-tl-step--done .qd-tl-step__dot  { background: var(--d-green); color: #fff; }
.qd-tl-step--active .qd-tl-step__dot { background: var(--d-navy); color: #fff; box-shadow: 0 0 0 3px rgba(30,36,64,.2); }
.qd-tl-step--active span              { color: var(--d-navy); font-weight: 700; }

.qd-tl-line {
    flex: 1;
    height: 2px;
    background: #e5e7eb;
    min-width: 40px;
    margin-bottom: 18px;
}

.qd-tl-line--done { background: var(--d-green); }

/* Two-column detail layout */
.qd-layout {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 1.25rem;
    align-items: start;
}

/* Cards in main column */
.qd-card {
    background: var(--d-card);
    border: 1px solid var(--d-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.1rem;
}

.qd-card__title {
    font-size: .8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--d-muted);
    margin-bottom: 1.1rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid var(--d-border);
}

/* Options list */
.qd-options-list { }

.qd-opt-row {
    display: grid;
    grid-template-columns: 1.2fr 1.5fr auto;
    align-items: center;
    gap: .5rem;
    padding: .7rem 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: .9rem;
}

.qd-opt-row:last-child { border-bottom: none; }
.qd-opt-row--warn { background: #fffbeb; margin: 0 -1.5rem; padding: .7rem 1.5rem; }

.qd-opt-row__step {
    color: var(--d-muted);
    font-size: .85rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.qd-opt-optional {
    font-size: .72rem;
    background: #f3f4f6;
    color: #9ca3af;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.qd-opt-row__val     { font-weight: 500; color: var(--d-text); }
.qd-opt-row__cost    { font-weight: 600; color: var(--d-text); text-align: right; font-variant-numeric: tabular-nums; font-size: .88rem; }
.qd-opt-required     { color: #d97706; font-size: .85rem; }

.qd-total-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--d-navy);
    color: #fff;
    border-radius: 8px;
    padding: .9rem 1.25rem;
    margin-top: 1rem;
    font-size: .85rem;
    font-weight: 600;
}

.qd-total-bar strong {
    font-size: 1.2rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

/* Aside cards */
.qd-submit-card {
    background: var(--d-card);
    border: 1px solid var(--d-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.qd-submit-card--blocked { opacity: .85; }

.qd-submit-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #bbf7d0;
    color: var(--d-green);
    margin-bottom: .75rem;
}

.qd-submit-card__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--d-text);
    margin-bottom: .6rem;
}

.qd-submit-card__warn {
    font-size: .83rem;
    color: #d97706;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: .6rem .75rem;
    margin-bottom: .75rem;
    text-align: left;
}

.qd-submit-card__note {
    font-size: .83rem;
    color: var(--d-muted);
    margin-bottom: 1rem;
}

.qd-submit-card__hint {
    font-size: .75rem;
    color: #9ca3af;
    margin-top: .5rem;
}

.qd-status-card {
    background: var(--d-card);
    border: 1px solid var(--d-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.qd-status-card__badge  { margin-bottom: .75rem; }
.qd-status-card__date   { font-size: .82rem; color: var(--d-muted); line-height: 1.6; }
.qd-status-card__ordered { font-size: .88rem; font-weight: 600; color: var(--d-green); margin-top: .5rem; }

.qd-aside-links {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.qd-aside-link {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .7rem 1rem;
    background: var(--d-card);
    border: 1px solid var(--d-border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--d-text);
    font-size: .85rem;
    font-weight: 500;
    transition: border-color .15s, background .15s;
}

.qd-aside-link:hover {
    border-color: var(--d-green);
    background: #f0fdf4;
    color: var(--d-green);
}

/* ── Responsive breakpoints ──────────────────────────────────── */
@media (max-width: 900px) {
    .cfg-layout    { grid-template-columns: 1fr; }
    .cfg-sidebar   { position: static; }
    .qd-layout     { grid-template-columns: 1fr; }
    .dealer-stat-row { grid-template-columns: repeat(2, 1fr); }
    .dealer-recent-row { grid-template-columns: 1fr auto auto; }
    .dealer-recent-row__cust,
    .dealer-recent-row__date,
    .dealer-recent-row__arrow { display: none; }
}

@media (max-width: 640px) {
    .dealer-quick-actions { grid-template-columns: 1fr; }
    .quote-card-grid      { grid-template-columns: 1fr; }
    .dash-hero__inner     { flex-direction: column; text-align: center; }
    .dealer-stat-row      { grid-template-columns: repeat(2, 1fr); }
    .cfg-progress-inner   { gap: 0; }
    .dealer-menu-toggle   { display: flex; }
    .dealer-nav           { display: none; position: absolute; top: 100%; left: 0; right: 0;
                            background: var(--d-navy); border-top: 1px solid rgba(255,255,255,.08);
                            padding: .5rem 0; z-index: 200; }
    .dealer-nav.dealer-nav--open { display: block; }
    .dealer-nav ul         { flex-direction: column; gap: 0; padding: 0; }
    .dealer-nav ul li a    { display: block; padding: .75rem 1.5rem; border-bottom: none; }
    .dealer-header-inner   { position: relative; }
}

@media (max-width: 400px) {
    .dealer-stat-row { grid-template-columns: 1fr; }
}

/* ==========================================================================
   ADMIN REDESIGN v2
   Brings the admin portal in line with the dealer portal's premium look.
   Uses the same --d-* design tokens defined in DEALER REDESIGN v2 above.
   ========================================================================== */

/* ── Body + layout ───────────────────────────────────────────────────────── */
.admin-body { background: var(--d-bg); }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.admin-sidebar {
    width: 260px;
    background: var(--d-navy);
    border-right: none;
    box-shadow: 2px 0 16px rgba(0,0,0,.18);
}
.admin-main { margin-left: 260px; }

.sidebar-logo {
    padding: 1.3rem 1.25rem 1.15rem;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-logo a {
    gap: 11px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -.01em;
}
.sidebar-logo .logo-icon {
    background: rgba(22,163,74,.18);
    border-radius: 8px;
    padding: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-brand { display: flex; flex-direction: column; gap: 1px; }
.sidebar-brand__name {
    font-size: .92rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.sidebar-brand__role {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--d-green);
    line-height: 1;
}

/* Section labels in sidebar */
.sidebar-section-label {
    font-size: .67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255,255,255,.25);
    padding: 1rem 1.5rem .3rem;
}

.sidebar-nav { flex: 1; padding: .75rem 0 .5rem; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li { padding: 0 .6rem; margin-bottom: 1px; }

/* Override the old plain-link style with icon-aware pill */
.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: .6rem .875rem;
    border-radius: 7px;
    color: rgba(255,255,255,.62);
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, color .15s;
    border-left: none;   /* remove old indicator */
}
.sidebar-nav li a:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
    border-left: none;
}
.sidebar-nav li a.active {
    background: rgba(22,163,74,.15);
    color: #4ade80;
    font-weight: 600;
    border-left: none;
}
.nav-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    opacity: .7;
}
.sidebar-nav li a:hover .nav-icon,
.sidebar-nav li a.active .nav-icon { opacity: 1; }

/* Sidebar footer + avatar */
.sidebar-footer {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-user { display: flex; flex-direction: column; gap: 2px; }
.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(22,163,74,.2);
    color: #4ade80;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .82rem;
    margin-bottom: .45rem;
    flex-shrink: 0;
}

/* ── Mobile topbar ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .admin-sidebar { left: -280px; width: 260px; }
    .admin-sidebar--open { left: 0; }
    .admin-main    { margin-left: 0; }
    .admin-topbar  { background: var(--d-navy); }
}

/* ── Admin hero banner ───────────────────────────────────────────────────── */
.admin-hero {
    background: linear-gradient(135deg, var(--d-navy) 0%, var(--d-navy2) 100%);
    position: relative;
    overflow: hidden;
    padding: 2.5rem 2rem 2rem;
    margin: -2rem -2rem 2rem;  /* bleed to admin-content edges */
}
.admin-hero__bg-pattern {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}
.admin-hero__inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.admin-hero__eyebrow {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--d-green);
    margin-bottom: .4rem;
}
.admin-hero__title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.02em;
    margin-bottom: .3rem;
    line-height: 1.15;
}
.admin-hero__sub {
    font-size: .87rem;
    color: rgba(255,255,255,.5);
}
.admin-hero__stats {
    display: flex;
    gap: 2.5rem;
    flex-shrink: 0;
}
.admin-hero__stat { text-align: center; }
.admin-hero__stat-val {
    display: block;
    font-size: 1.65rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.02em;
    line-height: 1;
}
.admin-hero__stat-lbl {
    font-size: .67rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.42);
    margin-top: 3px;
    white-space: nowrap;
}

/* ── Admin stat row ──────────────────────────────────────────────────────── */
.admin-stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}
.admin-stat {
    background: var(--d-card);
    border-radius: 12px;
    padding: 1.3rem 1.4rem 1.1rem;
    border: 1px solid var(--d-border);
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    display: flex;
    flex-direction: column;
    gap: .15rem;
    position: relative;
    overflow: hidden;
    min-width: 0;
}
.admin-stat::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    border-radius: 12px 12px 0 0;
}
.admin-stat--amber::before  { background: var(--d-amber); }
.admin-stat--blue::before   { background: var(--d-blue); }
.admin-stat--green::before  { background: var(--d-green); }
.admin-stat--dark::before   { background: var(--d-navy2); }
.admin-stat--neutral::before { background: var(--d-border); }

.admin-stat__val {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.03em;
    color: var(--d-text);
    margin-top: .25rem;
    word-break: break-all;
}
.admin-stat--amber .admin-stat__val { color: var(--d-amber); }
.admin-stat--blue  .admin-stat__val { color: var(--d-blue); }
.admin-stat--green .admin-stat__val { color: var(--d-green); }
.admin-stat__lbl {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--d-muted);
    margin-top: .2rem;
}
.admin-stat__link {
    display: inline-block;
    margin-top: .65rem;
    font-size: .78rem;
    color: var(--d-green);
    text-decoration: none;
    font-weight: 600;
}
.admin-stat__link:hover { text-decoration: underline; }

/* ── Admin action cards ──────────────────────────────────────────────────── */
/* ── Cost catalog filter bar + scrollable table ──────────────────────────── */
.ci-filter-bar {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    margin-bottom: .65rem;
}
.ci-filter-bar__search {
    position: relative;
    flex: 1 1 200px;
    min-width: 160px;
}
.ci-filter-bar__icon {
    position: absolute;
    left: .6rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}
.ci-filter-bar__search input {
    width: 100%;
    padding: .45rem .75rem .45rem 2rem;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    font-size: .88rem;
    background: #fff;
    color: #1e293b;
    box-sizing: border-box;
    transition: border-color .15s;
}
.ci-filter-bar__search input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.ci-filter-bar select {
    padding: .45rem .65rem;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    font-size: .88rem;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    flex-shrink: 0;
}
.ci-filter-bar select:focus {
    outline: none;
    border-color: #3b82f6;
}
.ci-filter-bar__count {
    margin-left: auto;
    font-size: .78rem;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}
.ci-table-scroll {
    max-height: 520px;
    overflow-y: auto;
    overflow-x: auto;
}
.ci-table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f7f8fa;
    box-shadow: 0 1px 0 #e2e8f0;
}
.ci-pagination {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-top: .75rem;
    flex-wrap: wrap;
}
.ci-page-btn {
    display: inline-block;
    padding: .35rem .7rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: .82rem;
    color: #334155;
    background: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
.ci-page-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.ci-page-btn--disabled { color: #cbd5e1; cursor: default; }
.ci-page-btn--disabled:hover { background: #fff; border-color: #e2e8f0; }
.ci-page-info {
    margin: 0 .4rem;
    font-size: .82rem;
    color: #64748b;
    white-space: nowrap;
}

.admin-catalog-hdr {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--d-muted);
    margin-bottom: .6rem;
    margin-top: -.5rem;
    padding-left: .1rem;
}
.admin-stat-row--catalog .admin-stat {
    padding: 1rem 1.15rem .85rem;
}
.admin-stat-row--catalog .admin-stat__val {
    font-size: 1.55rem;
}

.admin-action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1rem;
}
.admin-action-card {
    background: var(--d-card);
    border: 1px solid var(--d-border);
    border-radius: 12px;
    padding: 1.1rem 1.2rem 1rem;
    text-decoration: none;
    color: var(--d-text);
    display: flex;
    align-items: flex-start;
    gap: .875rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    transition: box-shadow .18s, transform .18s, border-color .18s;
}
.admin-action-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.1);
    transform: translateY(-2px);
    border-color: var(--d-green);
}
.admin-action-card__icon {
    width: 40px;
    height: 40px;
    background: rgba(22,163,74,.1);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--d-green);
    flex-shrink: 0;
}
.admin-action-card__title {
    font-weight: 700;
    font-size: .875rem;
    color: var(--d-text);
    margin-bottom: .2rem;
}
.admin-action-card__desc {
    font-size: .77rem;
    color: var(--d-muted);
    line-height: 1.4;
}

/* ── Admin panel (card with header + body) ───────────────────────────────── */
.admin-panel {
    background: var(--d-card);
    border: 1px solid var(--d-border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.admin-panel__hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--d-border);
    background: #fafbfc;
}
.admin-panel__title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--d-text);
    letter-spacing: -.01em;
}
.admin-panel__link {
    font-size: .8rem;
    color: var(--d-green);
    text-decoration: none;
    font-weight: 600;
}
.admin-panel__link:hover { text-decoration: underline; }
.admin-panel__body { padding: 0; }

/* Adjust dash-recent-table inside admin-panel */
.admin-panel__body .dash-recent-table th,
.admin-panel__body .dash-recent-table td { padding-left: 1.5rem; padding-right: 1.5rem; }
.admin-panel__body .dash-recent-table tbody tr:last-child td { border-bottom: none; }

/* ── Page header polish (all inner admin pages) ──────────────────────────── */
.page-header {
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--d-border);
}
.page-header h1 {
    font-size: 1.5rem;
    color: var(--d-text);
    position: relative;
    padding-left: .875rem;
    letter-spacing: -.02em;
}
.page-header h1::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    height: 70%;
    width: 3px;
    background: var(--d-green);
    border-radius: 2px;
}
.page-header p {
    color: var(--d-muted);
    font-size: .875rem;
    margin-top: .25rem;
    padding-left: .875rem;
}

/* ── Table polish ────────────────────────────────────────────────────────── */
.table-wrapper {
    border-radius: 12px;
    border: 1px solid var(--d-border);
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    overflow-x: auto; /* allows horizontal scroll; border-radius still clips children */
}
.data-table thead tr {
    border-bottom: 2px solid var(--d-border);
}
.data-table thead th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--d-muted);
    font-weight: 700;
    padding: 10px 14px;
    background: #f8f9fb;
}
.data-table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: var(--d-text);
}
.data-table tbody tr:hover td { background: #f8fdf9; }

/* ── Filter bar polish ───────────────────────────────────────────────────── */
.filter-bar {
    border: 1px solid var(--d-border);
    box-shadow: none;
    background: var(--d-card);
    border-radius: 10px;
}
.filter-search:focus,
.filter-select:focus {
    border-color: var(--d-green);
    box-shadow: 0 0 0 3px rgba(22,163,74,.12);
    outline: none;
}

/* ── Form card polish ────────────────────────────────────────────────────── */
.form-card {
    background: var(--d-card);
    border: 1px solid var(--d-border);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

/* ── Order detail grid ───────────────────────────────────────────────────── */
.order-card {
    background: var(--d-card);
    border: 1px solid var(--d-border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

/* ── Responsive overrides ────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .admin-hero {
        margin: -1rem -1rem 1.5rem;
        padding: 1.75rem 1rem 1.5rem;
    }
    .admin-hero__stats { gap: 1.5rem; }
    .admin-stat-row { grid-template-columns: repeat(2, 1fr); }
    .admin-action-cards { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .admin-stat-row { grid-template-columns: 1fr; }
    .admin-hero__stats { display: none; }
}

/* ── Part media upload fields ──────────────────────────────────────────── */
.input-file {
    display: block;
    width: 100%;
    padding: .45rem .6rem;
    font-size: .9rem;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}
.input-file:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Current-file preview row (edit mode) */
.media-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .6rem .75rem;
    margin-bottom: .6rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 6px;
}
.media-preview__thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.media-preview--file {
    gap: .75rem;
}
.media-preview__icon {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.media-preview__filename {
    font-size: .85rem;
    color: var(--text-muted);
    word-break: break-all;
    flex: 1;
}
.media-preview__remove {
    margin-left: auto;
    flex-shrink: 0;
    font-size: .85rem;
    color: var(--danger, #dc2626);
}

/* ── Parts list thumbnail column ───────────────────────────────────────── */
.col-thumb {
    width: 52px;
    padding: .35rem .5rem !important;
}
.part-thumb {
    display: block;
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
}
.part-thumb--empty {
    background: #f1f5f9;
}

/* ── Thumb-wrap (clickable wrapper for list thumbnails) ─────────────────── */
.thumb-wrap {
    position: relative;
    display: inline-block;
    cursor: pointer;
    border-radius: 4px;
}
.thumb-wrap:hover .part-thumb { opacity: .85; }
.thumb-wrap--stl-only { cursor: pointer; }

.stl-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: #16a34a;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.4;
    pointer-events: none;
}

.part-thumb--stl-only {
    width: 40px;
    height: 40px;
    background: #16a34a;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
}

.dxf-badge {
    position: absolute;
    bottom: 2px;
    left: 2px;
    background: #2563eb;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.4;
    pointer-events: none;
}

.thumb-wrap--dxf-only { cursor: pointer; }
.part-thumb--dxf-only {
    width: 40px;
    height: 40px;
    background: #2563eb;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
}

/* ── Part details modal ─────────────────────────────────────────────────── */
.part-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}
.part-modal--open { display: flex; }

.part-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.6);
}

.part-modal__box {
    position: relative;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 16px 48px rgba(0,0,0,.28);
    padding: 1.25rem;
    max-width: min(760px, 96vw);
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    z-index: 1;
}

.part-modal__close {
    position: absolute;
    top: .65rem;
    right: .75rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: .2rem .4rem;
    border-radius: 4px;
}
.part-modal__close:hover { background: #f1f5f9; color: var(--text); }

.part-modal__title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 2rem .9rem 0;
    font-family: var(--font-mono, monospace);
    color: var(--text);
}

.part-modal__img-wrap {
    text-align: center;
    margin-bottom: .75rem;
}
.part-modal__img-wrap img {
    max-width: 100%;
    max-height: 340px;
    border-radius: 6px;
    border: 1px solid var(--border);
    object-fit: contain;
}

.part-modal__viewer {
    width: 100%;
    height: 460px;
    border-radius: 6px;
    border: 1px solid var(--border);
    overflow: hidden;
    background: #f1f5f9;
    margin-bottom: .5rem;
    cursor: grab;
    display: none;
}
.part-modal__viewer--active { display: block; }
.part-modal__viewer:active  { cursor: grabbing; }
.part-modal__viewer canvas  { display: block; max-width: 100%; }
@media (max-width: 600px) {
    .part-modal__viewer { height: 280px; }
}

.part-modal__actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: .5rem;
}

.part-modal__dxf-wrap {
    display: none;
    width: 100%;
    min-height: 400px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: auto;
    margin-bottom: .5rem;
}
.part-modal__dxf-wrap svg {
    width: 100%;
    height: auto;
    display: block;
}



/* ── Thumbnail hover-zoom overlay ──────────────────────────────────────── */
#thumb-zoom-overlay {
    display: none;
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    padding: 4px;
    max-width: 300px;
    max-height: 300px;
    overflow: hidden;
}
#thumb-zoom-overlay.thumb-zoom-overlay--visible { display: block; }
#thumb-zoom-overlay img {
    display: block;
    max-width: 292px;
    max-height: 292px;
    width: auto;
    height: auto;
    border-radius: 5px;
}

/* ── STL viewer (three.js canvas wrapper) ──────────────────────────────── */
.stl-viewer {
    width: 100%;
    height: 380px;
    border-radius: 6px;
    border: 1px solid var(--border);
    overflow: hidden;
    background: #f1f5f9;
    margin-bottom: .25rem;
    cursor: grab;
}
.stl-viewer:active { cursor: grabbing; }
.stl-viewer canvas  { display: block; width: 100% !important; }
.stl-viewer__hint {
    font-size: .78rem;
    color: var(--text-muted);
    margin: 0 0 .75rem;
    text-align: center;
}

/* ── Confirm / delete dialog ─────────────────────────────────────────────── */
.confirm-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.confirm-modal--open { display: flex; }

.confirm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .55);
}

.confirm-modal__box {
    position: relative;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0,0,0,.2), 0 4px 16px rgba(0,0,0,.1);
    padding: 2rem 1.75rem 1.5rem;
    max-width: 400px;
    width: 100%;
    z-index: 1;
    animation: cmSlideIn .18s cubic-bezier(.34,1.56,.64,1);
}
@keyframes cmSlideIn {
    from { opacity: 0; transform: translateY(-10px) scale(.96); }
    to   { opacity: 1; transform: none; }
}

.confirm-modal__icon {
    width: 48px;
    height: 48px;
    background: #fef2f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.1rem;
}
.confirm-modal__icon svg {
    width: 22px;
    height: 22px;
    stroke: #ef4444;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.confirm-modal__title {
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    color: #0f172a;
    margin-bottom: .45rem;
}

.confirm-modal__message {
    font-size: .875rem;
    color: #64748b;
    text-align: center;
    line-height: 1.55;
    margin-bottom: 1.75rem;
}

.confirm-modal__actions {
    display: flex;
    gap: .75rem;
}

.confirm-modal__btn-cancel {
    flex: 1;
    padding: .65rem 1rem;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.confirm-modal__btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.confirm-modal__btn-ok {
    flex: 1;
    padding: .65rem 1rem;
    border: none;
    background: #ef4444;
    color: #fff;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.confirm-modal__btn-ok:hover { background: #dc2626; }
.confirm-modal__btn-ok:focus { outline: 2px solid #fca5a5; outline-offset: 2px; }


/* ================================================================
   INVENTORY BROWSER  (.inv-grid / .inv-card)
   ================================================================ */
.tab-bar {
    display: flex;
    gap: .25rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: .5rem;
}
.tab-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .85rem;
    border-radius: 6px 6px 0 0;
    font-size: .85rem;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.tab-link:hover { background: #f1f5f9; color: #1e293b; }
.tab-link.active { background: #1e293b; color: #fff; }
.tab-count {
    background: rgba(255,255,255,.25);
    border-radius: 999px;
    padding: .05rem .45rem;
    font-size: .78rem;
}
.tab-link:not(.active) .tab-count { background: #e2e8f0; color: #475569; }

.inv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}
.inv-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s;
}
.inv-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.inv-card__img-wrap {
    position: relative;
    background: #f1f5f9;
    aspect-ratio: 16/9;
    overflow: hidden;
}
.inv-card__img-wrap img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.inv-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%; height: 100%;
    color: #cbd5e1;
}
.inv-card__badge {
    position: absolute;
    top: .5rem; right: .5rem;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.badge--available { background: #dcfce7; color: #166534; }
.badge--reserved  { background: #fef9c3; color: #854d0e; }
.badge--sold      { background: #fee2e2; color: #991b1b; }

.inv-card__body {
    padding: .9rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.inv-card__title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}
.inv-card__meta {
    font-size: .8rem;
    color: #64748b;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}
.inv-card__desc {
    font-size: .85rem;
    color: #475569;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.inv-card__price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: auto;
    padding-top: .5rem;
}
.inv-card__footer {
    padding: .65rem 1rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
}

/* ================================================================
   MESSAGE THREADS  (.msg-thread / .msg-bubble)
   ================================================================ */
.msg-thread {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    max-height: 520px;
    overflow-y: auto;
    padding: .25rem .1rem;
}
.msg-bubble {
    max-width: 75%;
    padding: .6rem .85rem;
    border-radius: 12px;
    font-size: .875rem;
    line-height: 1.5;
    position: relative;
}
.msg-bubble--theirs {
    align-self: flex-start;
    background: #f1f5f9;
    color: #1e293b;
    border-bottom-left-radius: 3px;
}
.msg-bubble--mine {
    align-self: flex-end;
    background: #1e293b;
    color: #f8fafc;
    border-bottom-right-radius: 3px;
}
.msg-bubble__meta {
    display: flex;
    gap: .5rem;
    align-items: baseline;
    margin-bottom: .3rem;
    font-size: .75rem;
    opacity: .7;
}
.msg-bubble__from { font-weight: 600; }
.msg-bubble__body { white-space: pre-wrap; word-break: break-word; }

/* Message thread list (overview page) */
.msg-thread-list { list-style: none; margin: 0; padding: 0; }
.msg-thread-item {
    display: block;
    padding: .9rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: inherit;
    transition: background .12s;
}
.msg-thread-item:hover { background: #f8fafc; }
.msg-thread-item .thread-meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    font-size: .85rem;
    color: #64748b;
    margin-top: .2rem;
}
.msg-thread-item .thread-title {
    font-weight: 600;
    color: #1e293b;
    font-size: .95rem;
}
.msg-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 .35rem;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
}
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 .3rem;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    vertical-align: middle;
    margin-left: .2rem;
}
.tr--highlight td { background: #fffbeb !important; }


/* ================================================================
   COMPOSE PANEL  (.compose-panel)
   ================================================================ */
.compose-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: .5rem;
    overflow: hidden;
}
.compose-panel__summary {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .85rem 1.1rem;
    cursor: pointer;
    font-size: .9rem;
    color: #1e293b;
    user-select: none;
    list-style: none;
}
.compose-panel__summary::-webkit-details-marker { display: none; }
.compose-panel__summary:hover { background: #f8fafc; }
.compose-panel__hint {
    font-size: .8rem;
    color: #94a3b8;
    font-weight: 400;
    margin-left: .25rem;
}
.compose-panel[open] .compose-panel__summary {
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}
.compose-panel__body { padding: 1rem 1.1rem 1.1rem; }

.compose-form__row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1rem;
    align-items: start;
}
@media (max-width: 640px) {
    .compose-form__row { grid-template-columns: 1fr; }
}
.compose-form__field--quote label,
.compose-form__field--body label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: .3rem;
}
.compose-form__field--quote select,
.compose-form__field--body textarea {
    width: 100%;
    box-sizing: border-box;
    padding: .5rem .75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: .875rem;
    color: #1e293b;
    background: #fff;
    font-family: inherit;
}
.compose-form__field--quote select:focus,
.compose-form__field--body textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.compose-form__footer { margin-top: .75rem; }

/* ================================================================
   MESSAGE INBOX  (.msg-inbox / .msg-inbox-item)
   ================================================================ */
.msg-inbox {
    display: flex;
    flex-direction: column;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}
.msg-inbox-item {
    padding: .9rem 1.1rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: flex-start;
    transition: background .1s;
}
.msg-inbox-item:last-child { border-bottom: none; }
.msg-inbox-item:hover { background: #fafbfc; }
.msg-inbox-item--unread { background: #fffbeb; }
.msg-inbox-item--unread:hover { background: #fef9c3; }

.msg-inbox-item__main { flex: 1; min-width: 0; }
.msg-inbox-item__header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .2rem;
}
.msg-inbox-item__qnum {
    font-weight: 700;
    font-size: .9rem;
    color: #1e293b;
    text-decoration: none;
}
.msg-inbox-item__qnum:hover { text-decoration: underline; }
.msg-inbox-item__time {
    font-size: .75rem;
    color: #94a3b8;
    margin-left: auto;
    white-space: nowrap;
}
.msg-inbox-item__dealer {
    font-size: .85rem;
    color: #374151;
    margin-bottom: .2rem;
}
.msg-inbox-item__preview {
    font-size: .82rem;
    color: #64748b;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 100%;
}
.msg-inbox-item__from-label {
    font-weight: 600;
    color: #475569;
    margin-right: .2rem;
}
.msg-inbox-item__actions {
    display: flex;
    gap: .4rem;
    align-items: flex-start;
    flex-shrink: 0;
}
.msg-inbox-item__reply {
    width: 100%;
    margin-top: .35rem;
    padding-top: .75rem;
    border-top: 1px solid #f1f5f9;
}
.msg-inbox-item__reply textarea {
    width: 100%;
    box-sizing: border-box;
    padding: .5rem .75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: .875rem;
    font-family: inherit;
    resize: vertical;
}
.msg-inbox-item__reply textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.msg-inbox-item__reply-btns {
    display: flex;
    gap: .4rem;
    margin-top: .4rem;
}
.btn-ghost {
    background: transparent;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: .35rem .75rem;
    border-radius: 6px;
    font-size: .82rem;
    cursor: pointer;
    transition: background .12s;
}
.btn-ghost:hover { background: #f1f5f9; }

/* ── Inline category quick-add ──────────────────────────────────── */
.cat-inline-add {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 6px;
}
.cat-inline-add .cat-inline-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: .875rem;
    background: #fff;
    color: #1e293b;
}
.cat-inline-add .cat-inline-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99,102,241,.15);
}

/* ── Parts index quick-add category ─────────────────────────────── */
.filter-cat-add-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}
