/* ============================================
   DanSys - Controle de Frota
   Design System & Global Styles
   Paleta inspirada no dansys.pro
   ============================================ */

:root {
    /* Primary Colors - DanSys brand */
    --primary: #00d4ff;
    --primary-dark: #00a8cc;
    --primary-light: #33ddff;
    --primary-glow: rgba(0, 212, 255, 0.15);
    --primary-glow-strong: rgba(0, 212, 255, 0.3);

    /* Dark Theme - Background tones */
    --bg-darkest: #050d1a;
    --bg-dark: #0a1628;
    --bg-card: #0f1f38;
    --bg-card-hover: #142848;
    --bg-input: #0c1a30;
    --bg-sidebar: #081222;

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #8899aa;
    --text-muted: #556677;
    --text-accent: #00d4ff;

    /* Semantic Colors */
    --success: #00e676;
    --success-bg: rgba(0, 230, 118, 0.12);
    --warning: #ffab40;
    --warning-bg: rgba(255, 171, 64, 0.12);
    --danger: #ff5252;
    --danger-bg: rgba(255, 82, 82, 0.12);
    --info: #448aff;
    --info-bg: rgba(68, 138, 255, 0.12);

    /* KPI Colors */
    --kpi-blue: #448aff;
    --kpi-green: #00e676;
    --kpi-orange: #ffab40;
    --kpi-purple: #b388ff;

    /* Borders */
    --border-color: rgba(0, 212, 255, 0.1);
    --border-color-hover: rgba(0, 212, 255, 0.25);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.15);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-darkest);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
}

input, select, textarea {
    font-family: inherit;
    outline: none;
}

table {
    border-collapse: collapse;
    width: 100%;
}

.hidden {
    display: none !important;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-dark);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ---- Login Screen ---- */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darkest);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(0, 212, 255, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 212, 255, 0.04) 0%, transparent 50%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.logo-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
    color: var(--bg-darkest);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
}

.login-logo h1 {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.login-logo h1 span {
    color: var(--primary);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
    font-weight: 400;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    transition: var(--transition);
}

.input-group input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-group input:focus + i,
.input-group input:focus ~ i {
    color: var(--primary);
}

.input-group:has(input:focus) i {
    color: var(--primary);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--bg-darkest);
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    transition: var(--transition);
    box-shadow: 0 2px 12px rgba(0, 212, 255, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.35);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.btn-secondary:hover {
    border-color: var(--primary);
    background: var(--primary-glow);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--danger);
    color: white;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    transition: var(--transition);
}

.btn-danger:hover {
    background: #ff1744;
    box-shadow: 0 4px 16px rgba(255, 82, 82, 0.3);
}

.btn-login {
    width: 100%;
    margin-top: 8px;
}

.login-error {
    text-align: center;
    color: var(--danger);
    font-size: 13px;
    padding: 8px;
    background: var(--danger-bg);
    border-radius: var(--radius-sm);
}

/* ---- App Layout ---- */
.app-screen {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon-sm {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--bg-darkest);
}

.sidebar-logo h2 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.sidebar-logo h2 span {
    color: var(--primary);
}

.btn-close-sidebar {
    display: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    transition: var(--transition);
}

.btn-close-sidebar:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--primary-glow);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(0, 212, 255, 0.05));
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active i {
    color: var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.user-avatar i {
    font-size: 32px;
    color: var(--text-muted);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--danger);
    color: white;
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
}

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Top Bar ---- */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-menu {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    transition: var(--transition);
}

.btn-menu:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-user {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.topbar-avatar i {
    font-size: 28px;
    color: var(--text-muted);
}

/* ---- Page Content ---- */
.page-content {
    padding: 24px;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 700;
}

/* ---- Data Table ---- */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg-dark);
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-top: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: var(--primary-glow);
}

.table-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* Table action buttons */
.btn-action {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: var(--transition);
    background: transparent;
}

.btn-action.edit {
    color: var(--info);
}

.btn-action.edit:hover {
    background: var(--info-bg);
}

.btn-action.delete {
    color: var(--danger);
}

.btn-action.delete:hover {
    background: var(--danger-bg);
}

.actions-cell {
    display: flex;
    gap: 4px;
}

/* ---- Cards Grid ---- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.vehicle-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: var(--transition);
}

.vehicle-card:hover {
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-glow);
}

.vehicle-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.vehicle-card-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.vehicle-plate {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--bg-darkest);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
}

.vehicle-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vehicle-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.vehicle-info-row i {
    width: 16px;
    color: var(--text-muted);
}

.vehicle-card-footer {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.vehicle-card-footer .btn-action {
    flex: 1;
    width: auto;
    height: 36px;
    font-size: 12px;
    gap: 6px;
}

.vehicle-card-footer .btn-action span {
    font-size: 12px;
}

/* ---- Status Badge ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge.active {
    background: var(--success-bg);
    color: var(--success);
}

.badge.inactive {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge.admin {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge.user {
    background: var(--info-bg);
    color: var(--info);
}

/* ---- Empty State ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 15px;
}

/* ---- Input Field ---- */
.input-field {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
    min-width: 0;
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-field::placeholder {
    color: var(--text-muted);
}

/* Color scheme for date/month inputs */
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

select.input-field {
    cursor: pointer;
    appearance: auto;
}

/* ---- Modal ---- */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.btn-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    transition: var(--transition);
}

.btn-modal-close:hover {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 3000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: slideInRight 0.3s ease;
    min-width: 280px;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    background: var(--bg-card);
    border: 1px solid var(--success);
    color: var(--success);
}

.toast.error {
    background: var(--bg-card);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.toast.warning {
    background: var(--bg-card);
    border: 1px solid var(--warning);
    color: var(--warning);
}

/* ---- Confirm Dialog ---- */
.confirm-dialog {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 20px;
}

.confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.confirm-box {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.3s ease;
}

.confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--warning-bg);
    color: var(--warning);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 16px;
}

.confirm-box h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.confirm-box p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-actions button {
    min-width: 120px;
}

/* ---- Print Styles ---- */
@media print {
    .sidebar, .topbar, .page-header, .report-filters,
    .btn-primary, .btn-secondary, #noReport {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .page-content {
        padding: 0 !important;
    }

    .report-content {
        display: block !important;
    }

    .report-header-print {
        display: flex !important;
    }

    body {
        background: white !important;
        color: #333 !important;
    }

    .data-table th {
        color: #333 !important;
        background: #f0f0f0 !important;
    }

    .data-table td {
        color: #333 !important;
        border-color: #ddd !important;
    }

    .report-summary {
        border-color: #ddd !important;
    }

    .kpi-card, .chart-card, .report-content {
        background: white !important;
        border-color: #ddd !important;
        color: #333 !important;
    }

    .report-kpi-value {
        color: #333 !important;
    }

    .report-kpi-label {
        color: #666 !important;
    }
}

.report-header-print {
    display: none;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--primary);
}

.report-header-print h2 {
    font-size: 20px;
}

.report-header-print h2 span {
    color: var(--primary);
}

.report-period {
    color: var(--text-secondary);
    font-size: 14px;
    margin-left: auto;
}

/* ---- Vehicle Type Toggle ---- */
.vehicle-toggle {
    display: flex;
    gap: 8px;
}

.vtoggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.vtoggle-btn:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.vtoggle-btn.active {
    background: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* ---- Small Badges ---- */
.badge-sm {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-sm.primary-v {
    background: rgba(0, 212, 255, 0.12);
    color: var(--primary);
}

.badge-sm.secondary {
    background: var(--warning-bg);
    color: var(--warning);
}

/* ---- Form Warning ---- */
.form-warning {
    background: var(--warning-bg);
    color: var(--warning);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

/* ---- Franchise Bar ---- */
.franchise-bar-container {
    width: 100%;
    height: 10px;
    background: var(--bg-dark);
    border-radius: 5px;
    overflow: hidden;
    margin: 8px 0;
}

.franchise-bar-container.small {
    height: 6px;
    margin: 4px 0;
}

.franchise-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease;
}

.franchise-bar.bar-normal {
    background: linear-gradient(90deg, var(--success), #69f0ae);
}

.franchise-bar.bar-warning {
    background: linear-gradient(90deg, var(--warning), #ffd740);
}

.franchise-bar.bar-exceeded {
    background: linear-gradient(90deg, var(--danger), #ff1744);
}

.franchise-bar.bar-no-franchise {
    background: var(--text-muted);
    width: 0 !important;
}

/* ---- Franchise Cards ---- */
.franchise-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: var(--transition);
}

.franchise-card:hover {
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-glow);
}

.franchise-card.status-exceeded {
    border-color: rgba(255, 82, 82, 0.3);
}

.franchise-card.status-warning {
    border-color: rgba(255, 171, 64, 0.3);
}

.franchise-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
}

.franchise-card-header h4 {
    font-size: 15px;
    font-weight: 600;
    margin-top: 6px;
}

.franchise-status-icon {
    font-size: 20px;
}

.status-normal .franchise-status-icon,
.status-normal { color: var(--success); }
.status-warning .franchise-status-icon,
.status-warning { color: var(--warning); }
.status-exceeded .franchise-status-icon,
.status-exceeded { color: var(--danger); }
.status-no-franchise .franchise-status-icon,
.status-no-franchise { color: var(--text-muted); }

.franchise-user {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.franchise-numbers {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

.franchise-detail {
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}

.franchise-metrics {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-muted);
}

.fm-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ---- Vehicle Franchise Mini (in cards) ---- */
.vehicle-franchise-mini {
    margin-top: 4px;
}

/* ---- Ranking ---- */
.franchise-ranking {
    margin-top: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ranking-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.ranking-section.suggestions {
    grid-column: 1 / -1;
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.ranking-item.rank-exceeded {
    border-left: 3px solid var(--danger);
}

.ranking-item.rank-idle {
    opacity: 0.6;
}

.rank-pos {
    font-weight: 700;
    color: var(--primary);
    min-width: 24px;
}

.rank-plate {
    font-weight: 700;
    color: var(--text-primary);
    min-width: 70px;
}

.rank-model {
    color: var(--text-secondary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-user {
    color: var(--text-muted);
    min-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-km {
    color: var(--text-primary);
    min-width: 80px;
    text-align: right;
}

.rank-pct {
    min-width: 40px;
    text-align: right;
    font-weight: 600;
}

.suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: var(--warning-bg);
    border-radius: var(--radius-sm);
    color: var(--warning);
    font-size: 13px;
    margin-top: 8px;
}

.suggestion-item i {
    margin-top: 2px;
    flex-shrink: 0;
}

/* ---- Dashboard Franchise Overview ---- */
.dash-franchise-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.dash-franchise-item {
    padding: 10px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
}

.dfr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.dfr-km {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ---- Sidebar user vehicle ---- */
.user-vehicle {
    font-size: 10px;
    color: var(--primary);
    margin-top: 1px;
}
