:root {
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-header: #0f172a;
    --bg-subtle: #f8fafc;
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: #e0f2fe;
    --accent: #0ea5e9;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --info: #2563eb;
    --info-bg: #dbeafe;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --radius: 10px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Top Navbar */
.navbar {
    background: var(--bg-header);
    color: #fff;
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none !important;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, #38bdf8, #0284c7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: #fff;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    color: #cbd5e1;
    padding: 0.5rem 0.85rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none !important;
    transition: all 0.15s ease;
}

.nav-link:hover, .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.875rem;
}

.role-pill {
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.role-admin {
    background: #38bdf8;
    color: #0f172a;
}

.role-fitment {
    background: #a855f7;
    color: #fff;
}

.role-broker {
    background: #22c55e;
    color: #052e16;
}

/* Main Container */
.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 1.75rem 1.5rem;
    flex: 1;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.15rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-decoration: none !important;
    color: inherit;
    transition: transform 0.12s ease, border-color 0.12s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.kpi-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.kpi-value {
    font-size: 1.85rem;
    font-weight: 800;
    margin-top: 0.35rem;
    color: var(--text-main);
}

.kpi-step-badge {
    font-size: 0.75rem;
    margin-top: 0.35rem;
    color: var(--primary);
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 1.1rem;
    border-radius: 7px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #15803d;
}

.btn-outline {
    background: #fff;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-subtle);
    border-color: #cbd5e1;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.35rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    font-size: 0.92rem;
    color: var(--text-main);
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.section-divider {
    margin: 1.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-light);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-hover);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

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

.table th {
    background: var(--bg-subtle);
    color: #475569;
    font-weight: 700;
    text-align: left;
    padding: 0.75rem 0.9rem;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 0.8rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tr:hover td {
    background: #f8fafc;
}

.text-right {
    text-align: right !important;
}

.text-center {
    text-align: center !important;
}

/* Quote Table Specifics */
.quote-table th {
    background: #0f172a;
    color: #fff;
}

.quote-summary-row td {
    font-weight: 700;
    background: #f8fafc;
    border-top: 1px solid #cbd5e1;
}

.quote-grand-row td {
    font-weight: 800;
    font-size: 1.05rem;
    background: var(--primary-light);
    color: #0c4a6e;
    border-top: 2px solid var(--primary);
}

/* Stepper & Progress Tracker */
.step-indicator-single {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #fff;
    padding: 1.1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.step-badge-large {
    background: #38bdf8;
    color: #0f172a;
    font-weight: 800;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stepper-horizontal {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.step-box {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    opacity: 0.65;
}

.step-box.completed {
    border-color: #86efac;
    background: #f0fdf4;
    opacity: 1;
}

.step-box.active {
    border: 2px solid var(--primary);
    background: var(--primary-light);
    opacity: 1;
    font-weight: 700;
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.step-box.completed .step-num {
    background: var(--success);
    color: #fff;
}

.step-box.active .step-num {
    background: var(--primary);
    color: #fff;
}

/* Mini progress dots on Dashboard */
.mini-progress {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.mini-dot {
    height: 6px;
    width: 24px;
    border-radius: 3px;
    background: #e2e8f0;
}

.mini-dot.done {
    background: var(--success);
}

.mini-dot.current {
    background: var(--primary);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
}

.badge-step-1 { background: #e0f2fe; color: #0369a1; }
.badge-step-2 { background: #fef3c7; color: #b45309; }
.badge-step-3 { background: #dbeafe; color: #1d4ed8; }
.badge-step-4 { background: #f3e8ff; color: #7e22ce; }
.badge-step-5 { background: #dcfce7; color: #15803d; }

/* Flash Alerts */
.alert {
    padding: 0.9rem 1.15rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-success { background: var(--success-bg); color: #14532d; border-color: #86efac; }
.alert-danger { background: var(--danger-bg); color: #7f1d1d; border-color: #fca5a5; }
.alert-warning { background: var(--warning-bg); color: #78350f; border-color: #fde68a; }
.alert-info { background: var(--info-bg); color: #1e3a8a; border-color: #93c5fd; }

/* Info Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    background: var(--bg-subtle);
    padding: 1.1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.detail-item-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
}

.detail-item-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 0.15rem;
}

/* Login Card */
.auth-wrapper {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    padding: 2.25rem 2rem;
}

.footer {
    text-align: center;
    padding: 1.25rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background: #fff;
    margin-top: auto;
}

@media (max-width: 768px) {
    .stepper-horizontal {
        grid-template-columns: 1fr;
    }
    .navbar {
        height: auto;
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}
