/* ============================================================
   PLATFORM — Stripe-Inspired Design System
   ============================================================ */

/* --- CSS Variables --- */
:root {
    /* Primary palette */
    --primary: #635BFF;
    --primary-dark: #5046E5;
    --primary-light: #7A73FF;
    --primary-ghost: rgba(99, 91, 255, 0.08);

    /* Neutrals */
    --gray-50: #F7F8FA;
    --gray-100: #F0F2F5;
    --gray-200: #E3E8EF;
    --gray-300: #CDD5E0;
    --gray-400: #9AA4B2;
    --gray-500: #697586;
    --gray-600: #4B5565;
    --gray-700: #364152;
    --gray-800: #202939;
    --gray-900: #121926;

    /* Accent colors */
    --green: #30B876;
    --green-bg: rgba(48, 184, 118, 0.1);
    --blue: #3B82F6;
    --blue-bg: rgba(59, 130, 246, 0.1);
    --purple: #8B5CF6;
    --purple-bg: rgba(139, 92, 246, 0.1);
    --orange: #F59E0B;
    --orange-bg: rgba(245, 158, 11, 0.1);
    --red: #EF4444;
    --red-bg: rgba(239, 68, 68, 0.08);

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Typography */
    --font-display: 'Source Serif 4', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(18, 25, 38, 0.04);
    --shadow-sm: 0 1px 3px rgba(18, 25, 38, 0.06), 0 1px 2px rgba(18, 25, 38, 0.04);
    --shadow-md: 0 4px 12px rgba(18, 25, 38, 0.06), 0 1px 3px rgba(18, 25, 38, 0.04);
    --shadow-lg: 0 12px 40px rgba(18, 25, 38, 0.08), 0 4px 12px rgba(18, 25, 38, 0.04);
    --shadow-card: 0 0 0 1px rgba(18, 25, 38, 0.06), 0 1px 3px rgba(18, 25, 38, 0.06);
}

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

html { font-size: 15px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: var(--font-body);
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary-dark); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.page-login {
    background: var(--gray-900);
    min-height: 100vh;
}

.lang-bar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 100;
    padding: 16px 24px;
}

.lang-switcher {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 3px;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.lang-switcher a {
    padding: 5px 12px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.45);
    border-radius: 6px;
    transition: all 0.2s;
    font-weight: 500;
}

.lang-switcher a:hover { color: rgba(255, 255, 255, 0.8); }
.lang-switcher a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.login-container {
    display: flex;
    min-height: 100vh;
}

.login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2;
}

.brand-icon { flex-shrink: 0; }

.brand-name {
    font-family: var(--font-body);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}
.login-brand .brand-name { color: #fff; }

/* Auth language dropdown */
.auth-lang-wrap { position: absolute; top: 16px; right: 16px; z-index: 10; }
.auth-lang-btn {
    display: flex; align-items: center; gap: 6px;
    background: #ffffff; border: 1px solid #e5e7eb; border-radius: 8px;
    padding: 6px 14px; font-size: 13px; font-weight: 500;
    color: #374151; cursor: pointer; transition: all 0.15s;
}
.auth-lang-btn:hover { border-color: #d1d5db; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.auth-lang-btn svg { color: #9ca3af; }
.auth-lang-dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 4px);
    background: #ffffff; border: 1px solid #e5e7eb; border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15); z-index: 200;
    width: 180px; max-height: 300px; overflow-y: auto; padding: 6px;
}
.auth-lang-dropdown.open { display: block; }
.auth-lang-item {
    display: block; padding: 8px 12px; font-size: 13px; color: #374151;
    text-decoration: none; border-radius: 6px; transition: background 0.1s;
}
.auth-lang-item:hover { background: #f3f4f6; }
.auth-lang-item.active { background: #635bff; color: #fff; font-weight: 600; }

/* Animated background — logistics routes */
.login-hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hero-pattern {
    position: relative;
    width: 400px;
    height: 400px;
}

/* Route lines — simulating delivery paths */
.route-line {
    position: absolute;
    background: rgba(99, 91, 255, 0.15);
    border-radius: 2px;
}
.rl-1 { width: 2px; height: 70%; left: 30%; top: 10%; animation: routePulse 4s ease-in-out infinite; }
.rl-2 { width: 65%; height: 2px; top: 40%; left: 20%; animation: routePulse 4s ease-in-out 1s infinite; }
.rl-3 { width: 2px; height: 50%; left: 70%; top: 25%; animation: routePulse 4s ease-in-out 2s infinite; }

/* Route waypoint dots */
.route-dot {
    position: absolute;
    width: 8px; height: 8px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(99, 91, 255, 0.5);
}
.rd-1 { left: 28%; top: 10%; animation: dotGlow 3s ease-in-out infinite; }
.rd-2 { left: 28%; top: 40%; animation: dotGlow 3s ease-in-out 0.8s infinite; }
.rd-3 { left: 70%; top: 40%; animation: dotGlow 3s ease-in-out 1.6s infinite; }
.rd-4 { left: 70%; top: 75%; animation: dotGlow 3s ease-in-out 2.4s infinite; }

@keyframes routePulse {
    0%, 100% { opacity: 0.2; } 50% { opacity: 0.7; }
}
@keyframes dotGlow {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.4); opacity: 1; }
}

.floating-card {
    position: absolute;
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    animation: floatCard 6s ease-in-out infinite;
    color: rgba(255, 255, 255, 0.9);
}

.fc-1 { top: 8%; left: 5%; animation-delay: 0s; }
.fc-2 { top: 42%; right: 2%; animation-delay: 2s; }
.fc-3 { bottom: 12%; left: 15%; animation-delay: 4s; }

@keyframes floatCard {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.fc-icon-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.fc-label { font-size: 0.8rem; font-weight: 600; color: rgba(255,255,255,0.7); text-transform: uppercase; letter-spacing: 0.05em; }
.fc-label-light { font-size: 0.85rem; font-weight: 600; color: rgba(255,255,255,0.9); font-variant-numeric: tabular-nums; }

/* Fleet stats */
.fc-stat-row { display: flex; gap: 24px; }
.fc-stat { display: flex; flex-direction: column; }
.fc-stat-val { font-size: 1.3rem; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.fc-stat-lbl { font-size: 0.7rem; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.04em; }

/* Live pulse dot */
.fc-pulse {
    width: 10px; height: 10px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(48, 184, 118, 0.5);
    animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
    0%, 100% { box-shadow: 0 0 6px rgba(48,184,118,0.3); }
    50% { box-shadow: 0 0 16px rgba(48,184,118,0.7); }
}

/* Route info */
.fc-route-info { display: flex; gap: 16px; align-items: baseline; }
.fc-route-km { font-size: 1.1rem; font-weight: 700; color: #fff; }
.fc-route-eta { font-size: 0.75rem; color: var(--green); font-weight: 500; }

/* Delivery check */
.fc-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    background: var(--green);
    color: #fff;
    font-size: 0.75rem;
    border-radius: 50%;
    margin-right: 10px;
}

.fc-3 { display: flex; align-items: center; }
.fc-3 span { color: rgba(255,255,255,0.7); font-size: 0.85rem; font-weight: 500; }

/* Login form */
.login-right {
    width: 480px;
    display: flex;
    /* COLUMN, not row: the header bar belongs above the form. As a row
       flex container it became a sibling COLUMN beside the form, which
       is how the logo ended up floating to the left of it. */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    position: relative;
}

.login-form-wrapper {
    width: 100%;
    max-width: 360px;
    padding: 40px;
}

.login-heading {
    font-family: var(--font-body);
    font-size: 1.85rem;
    font-weight: 600;
    color: var(--gray-900);
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.login-subheading {
    color: var(--gray-500);
    font-size: 0.95rem;
    margin-bottom: 32px;
    line-height: 1.5;
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-google {
    background: var(--gray-900);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.btn-google:hover {
    background: var(--gray-800);
    color: #fff;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-demo {
    background: var(--gray-100);
    color: var(--gray-700);
}
.btn-demo:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    padding: 10px 24px;
    width: auto;
    box-shadow: 0 1px 3px rgba(99, 91, 255, 0.3);
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 91, 255, 0.3);
}

.btn-danger {
    background: #fff;
    color: var(--red);
    border: 1px solid var(--red);
    padding: 10px 24px;
    width: auto;
}
.btn-danger:hover {
    background: var(--red);
    color: #fff;
}

.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
    color: var(--gray-400);
    font-size: 0.82rem;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

.login-terms {
    margin-top: 20px;
    font-size: 0.78rem;
    color: var(--gray-400);
    line-height: 1.6;
    text-align: center;
}

.google-icon { flex-shrink: 0; }

/* Auth form (login / register) */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form .form-input {
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--gray-800);
    background: #fff;
    outline: none;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-form .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
}

.auth-form .form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-700);
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-link {
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 500;
}

.form-link:hover {
    color: var(--primary-dark);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-full {
    width: 100%;
}

.btn-google {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}
.btn-google:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.auth-footer-text {
    text-align: center;
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 4px;
}

.auth-footer-text a {
    font-weight: 600;
    color: var(--primary);
}

.auth-footer-text a:hover {
    color: var(--primary-dark);
}

/* Register page — wider right panel and scroll */
.register-form-wrapper {
    max-width: 420px !important;
    padding: 32px 36px !important;
    max-height: 100vh;
    overflow-y: auto;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */

.page-app {
    display: flex;
    min-height: 100vh;
    background: var(--gray-50);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: #fff;
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--topbar-height);
    padding: 0 24px;
    border-bottom: 1px solid var(--gray-100);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--gray-600);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.nav-item.active {
    background: var(--primary-ghost);
    color: var(--primary);
}

.nav-item.active svg { stroke: var(--primary); }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--gray-100);
}

.sidebar-lang { padding: 4px 8px 8px; }

.lang-select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--gray-600);
    background: var(--gray-50);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}
.lang-select:hover { border-color: var(--gray-300); }
.lang-select:focus { border-color: var(--primary); }

.nav-logout { color: var(--gray-500); }
.nav-logout:hover { color: var(--red); background: var(--red-bg); }

.nav-separator {
    height: 1px;
    background: var(--gray-100);
    margin: 8px 12px;
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    color: var(--gray-600);
}
.mobile-menu-toggle:hover { background: var(--gray-100); }
.sidebar-close { display: none; }
.sidebar-overlay { display: none; }

.topbar-right { display: flex; align-items: center; gap: 16px; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
}

.topbar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.topbar-avatar-placeholder {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 600;
}

.topbar-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
}
.topbar-company {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
    letter-spacing: -0.02em;
    padding-right: 12px;
    border-right: 1px solid var(--gray-200);
    margin-right: 4px;
}
.topbar-company-link {
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s;
}
.topbar-company-link:hover { color: var(--primary); }

.topbar-plan-link {
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.topbar-plan-link:hover {
    background: rgba(99, 91, 255, 0.18);
    border-color: rgba(99, 91, 255, 0.35);
}

.topbar-plan {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
    background: var(--primary-ghost, rgba(37,99,235,0.10));
    border: 1px solid var(--primary-ghost, rgba(37,99,235,0.20));
    padding: 3px 9px;
    border-radius: 999px;
    margin-right: 8px;
    white-space: nowrap;
}

/* Content area */
.content-area {
    flex: 1;
    padding: 32px;
    max-width: 1720px;   /* fill Full HD (1920 - sidebar); still capped on ultrawide */
    width: 100%;
}

.page-header {
    margin-bottom: 28px;
}

.page-title {
    font-family: var(--font-body);
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--gray-900);
    letter-spacing: -0.03em;
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--gray-500);
    font-size: 0.92rem;
}

/* ============================================================
   STATS GRID
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-card);
    display: flex;
    gap: 16px;
    transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

a.stat-card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.si-red    { background: rgba(239, 68, 68, 0.1);  color: var(--red); }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.si-blue { background: var(--blue-bg); color: var(--blue); }
.si-green { background: var(--green-bg); color: var(--green); }
.si-purple { background: var(--purple-bg); color: var(--purple); }
.si-teal { background: #e0f7f7; color: #0d9488; }

/* Stats grid variants */
.stats-grid-sm { margin-top: -8px; }
.stats-grid-sm .stat-value { font-size: 1.4rem; }

/* Activity meta (user name) */
.activity-meta { font-size: 12px; color: var(--gray-500); font-weight: 500; }

/* Table toolbar — search left, export right */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.table-toolbar .search-input-wrap { flex: 0 1 320px; }
.table-toolbar-left { display: flex; align-items: center; gap: 8px; }
.btn-export { white-space: nowrap; margin-left: auto; }
.btn-export svg { flex-shrink: 0; }

/* Column settings modal */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.5); z-index: 9999;
    align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background-color: #ffffff; border-radius: 14px; width: 380px; max-width: 90vw;
    max-height: 85vh; display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative; z-index: 10000;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px 0; background-color: #ffffff;
}
.modal-header h3 { margin: 0; font-size: 1.1rem; font-weight: 600; color: #1a1a2e; }
.modal-close { background: none; border: none; cursor: pointer; color: #9ca3af; padding: 4px; border-radius: 6px; }
.modal-close:hover { background: #f3f4f6; color: #4b5563; }
.modal-desc { padding: 4px 24px 12px; margin: 0; font-size: 13px; color: #6b7280; background-color: #ffffff; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid #e5e7eb; background-color: #ffffff; border-radius: 0 0 14px 14px; }
.col-settings-list { overflow-y: auto; padding: 0 24px; flex: 1; max-height: 400px; background-color: #ffffff; }
.col-settings-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 6px;
    cursor: grab; font-size: 14px; color: #374151; background-color: #ffffff;
    user-select: none; transition: box-shadow 0.15s, border-color 0.15s;
}
.col-settings-item:hover { border-color: #d1d5db; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.col-settings-item.dragging { opacity: 0.5; border-color: #635bff; }
.col-settings-item label { display: flex; align-items: center; gap: 8px; cursor: pointer; flex: 1; }
.col-drag { color: #d1d5db; font-size: 16px; cursor: grab; line-height: 1; }
.col-settings-item input[type=checkbox] { accent-color: #635bff; width: 16px; height: 16px; }
.si-orange { background: var(--orange-bg); color: var(--orange); }
.si-red    { background: var(--red-bg); color: var(--red); }

.stat-info { display: flex; flex-direction: column; }

.stat-label {
    font-size: 0.78rem;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.stat-change {
    font-size: 0.78rem;
    font-weight: 600;
    margin-top: 4px;
}
.stat-change.positive { color: var(--green); }
.stat-change small { color: var(--gray-400); font-weight: 400; }

/* ============================================================
   CARDS & CONTENT GRID
   ============================================================ */

.content-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
}

.card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
}

.card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body { padding: 24px; }

/* Chart */
.chart-period {
    display: flex;
    gap: 2px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.period-btn {
    padding: 5px 14px;
    border: none;
    background: none;
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-500);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}
.period-btn:hover { color: var(--gray-700); }
.period-btn.active {
    background: #fff;
    color: var(--gray-800);
    box-shadow: var(--shadow-xs);
}

.chart-area {
    padding: 20px 24px 24px;
    height: 280px;
}

.chart-area canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Activity */
.activity-list { padding: 8px 0; }

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 24px;
    transition: background 0.15s;
}
.activity-item:hover { background: var(--gray-50); }

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.dot-green { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.dot-blue { background: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
.dot-purple { background: var(--purple); box-shadow: 0 0 0 3px var(--purple-bg); }
.dot-orange { background: var(--orange); box-shadow: 0 0 0 3px var(--orange-bg); }

.activity-content { flex: 1; min-width: 0; }

.activity-text {
    display: block;
    font-size: 0.88rem;
    color: var(--gray-700);
    font-weight: 500;
}

.activity-time {
    font-size: 0.78rem;
    color: var(--gray-400);
    margin-top: 2px;
    display: block;
}

/* ============================================================
   ACCOUNT PAGE
   ============================================================ */

.account-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
}

.profile-sidebar {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 32px 24px;
    text-align: center;
}

.profile-avatar-wrapper { margin-bottom: 16px; }

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gray-100);
}

.profile-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 600;
}

.profile-name {
    font-family: var(--font-body);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.profile-email {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 20px;
}
.profile-login {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: -16px;
    margin-bottom: 20px;
}

.profile-meta {
    border-top: 1px solid var(--gray-100);
    padding-top: 16px;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
}

.meta-label { font-size: 0.8rem; color: var(--gray-500); }
.meta-value { font-size: 0.8rem; color: var(--gray-700); font-weight: 500; }

/* Settings form */
.settings-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
}

.form-input {
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--gray-800);
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
}

.form-input:disabled {
    background: var(--gray-50);
    color: var(--gray-500);
    cursor: not-allowed;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--gray-400);
}

.form-actions {
    display: flex; align-items: center; margin-top: 24px;
    padding-top: 20px; border-top: 1px solid var(--gray-100);
}
.form-actions .btn-outline { margin-right: auto; }
.form-actions .btn-primary { min-width: 140px; }

/* Danger zone */
.card-danger { border: 1px solid rgba(239, 68, 68, 0.2); }
.card-danger .card-header { border-bottom-color: rgba(239, 68, 68, 0.1); }
.card-danger .card-header h3 { color: var(--red); }

.danger-desc {
    font-size: 0.88rem;
    color: var(--gray-600);
    margin-bottom: 16px;
    line-height: 1.6;
}

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.alert-success {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid rgba(48, 184, 118, 0.15);
}

/* ============================================================
   FOOTER
   ============================================================ */

.app-footer {
    padding: 20px 32px;
    font-size: 0.78rem;
    color: var(--gray-400);
    border-top: 1px solid var(--gray-100);
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.footer-meta { font-size: 0.72rem; color: var(--gray-300); }

/* ============================================================
   TOOLBAR (page header with actions)
   ============================================================ */

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.82rem;
    width: auto;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
}

.search-input {
    flex: 1 1 auto;
    padding: 8px 10px 8px 12px;
    border: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--gray-800);
    background: transparent;
    outline: none;
    min-width: 180px;
    width: 100%;
}

.search-input:focus {
    border: none;
    box-shadow: none;
}

.search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0 13px;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    transition: background 0.15s;
}

.search-btn:hover {
    background: var(--primary-dark, #4b45cc);
}

.search-btn:focus-visible {
    outline: none;
    background: var(--primary-dark, #4b45cc);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6);
}

/* ============================================================
   MINI STAT CARDS (horizontal row)
   ============================================================ */

.stats-row {
    display: flex;
    gap: 14px;
    margin-bottom: 22px;
}

.stat-mini {
    flex: 1;
    background: #fff;
    border-radius: var(--radius-md);
    padding: 16px 20px;
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: box-shadow 0.2s, transform 0.2s;
}

.stat-mini:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-mini-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-mini-info {
    display: flex;
    flex-direction: column;
}

.stat-mini-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.stat-mini-label {
    font-size: 0.74rem;
    color: var(--gray-500);
    font-weight: 500;
    margin-top: 1px;
}

/* ============================================================
   DATA TABLES
   ============================================================ */

.table-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.table-card .card-header {
    padding: 16px 22px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    padding: 10px 22px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background 0.12s;
}

.data-table tbody tr:hover {
    background: rgba(99, 91, 255, 0.02);
}

.data-table tbody td {
    padding: 14px 22px;
    font-size: 0.88rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

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

/* Cell helpers */
.cell-primary {
    font-weight: 600;
    color: var(--gray-900);
}

.cell-secondary {
    font-size: 0.78rem;
    color: var(--gray-400);
    margin-top: 1px;
}

.cell-stack {
    display: flex;
    flex-direction: column;
}

/* ============================================================
   BADGES / STATUS PILLS
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.74rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-green  { background: var(--green-bg);  color: #1a7f4b; }
.badge-green::before  { background: var(--green); }
.badge-yellow { background: var(--orange-bg); color: #92610e; }
.badge-yellow::before { background: var(--orange); }
.badge-red    { background: var(--red-bg);    color: #b91c1c; }
.badge-red::before    { background: var(--red); }
.badge-blue   { background: var(--blue-bg);   color: #1d5bbf; }
.badge-blue::before   { background: var(--blue); }
.badge-gray   { background: var(--gray-100);  color: var(--gray-600); }
.badge-gray::before   { background: var(--gray-400); }
.badge-orange { background: #fff3e0; color: #c25e00; }
.badge-orange::before { background: #f57c00; }

.cell-mono {
    font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
    font-size: 0.82rem;
    color: var(--gray-600);
    letter-spacing: 0.02em;
}

.rating-stars {
    color: #f59e0b;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* ============================================================
   TABLE ACTION BUTTONS
   ============================================================ */

.table-actions {
    display: flex;
    gap: 6px;
}

.btn-table {
    padding: 5px 11px;
    font-size: 0.76rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    background: #fff;
    color: var(--gray-600);
    cursor: pointer;
    font-family: var(--font-body);
    text-decoration: none;
    transition: all 0.15s;
}

.btn-table:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-ghost);
}

/* ============================================================
   RATING STARS
   ============================================================ */

.rating {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--orange);
    font-size: 0.82rem;
}

.rating-value {
    font-weight: 600;
    color: var(--gray-800);
    margin-left: 4px;
    font-size: 0.82rem;
}

/* ============================================================
   AVATAR IN TABLE
   ============================================================ */

.table-avatar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.ta-blue   { background: var(--blue); }
.ta-green  { background: var(--green); }
.ta-purple { background: var(--purple); }
.ta-orange { background: var(--orange); }
.ta-red    { background: #e05b5b; }
.ta-teal   { background: #0ea5a5; }

/* ============================================================
   DETAIL / VIEW PAGE LAYOUT
   ============================================================ */

.detail-status-bar {
    display: flex;
    gap: 24px;
    padding: 14px 20px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.detail-status-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.detail-status-value {
    font-size: 0.88rem;
    color: var(--gray-800);
    font-weight: 500;
}

.detail-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 18px;
    align-items: start;
}

.detail-main {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px 24px;
}

.detail-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.detail-label {
    font-size: 0.78rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.detail-value {
    font-size: 0.9rem;
    color: var(--gray-800);
    font-weight: 500;
}

.detail-notes {
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--gray-100);
}

.detail-notes-text {
    font-size: 0.88rem;
    color: var(--gray-600);
    line-height: 1.6;
    margin-top: 4px;
}

/* Quick stats grid */
.quick-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.quick-stat {
    text-align: center;
    padding: 10px 4px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.quick-stat-value {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-900);
}

.quick-stat-label {
    display: block;
    font-size: 0.72rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 2px;
}

/* Driver mini card */
.driver-card-mini {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Empty state small */
.empty-state-sm {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px;
    color: var(--gray-400);
    font-size: 0.86rem;
}

/* Timeline */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.timeline-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}

.timeline-item:last-child { border-bottom: none; }

.timeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.dot-red    { background: var(--red); }
.dot-blue   { background: var(--blue); }
.dot-green  { background: var(--green); }
.dot-gray   { background: var(--gray-300); }
.dot-orange { background: var(--orange); }

.timeline-content { flex: 1; }

.timeline-text {
    display: block;
    font-size: 0.84rem;
    color: var(--gray-700);
    line-height: 1.4;
}

.timeline-date {
    font-size: 0.76rem;
    color: var(--gray-400);
    margin-top: 2px;
    display: block;
}

/* ============================================================
   SETTINGS LAYOUT (tabbed sub-pages)
   ============================================================ */

.settings-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: start;
}

/* No in-page tab column — the sidebar dropdown is the only settings nav */
.settings-layout-full {
    grid-template-columns: 1fr;
}

.settings-tabs {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 8px;
    position: sticky;
    top: 24px;
}

.settings-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--gray-600);
    text-decoration: none;
    transition: all 0.15s;
}

.settings-tab:hover {
    background: var(--gray-50);
    color: var(--gray-800);
}

.settings-tab.active {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}

.settings-tab svg { flex-shrink: 0; }

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.settings-desc {
    font-size: 0.88rem;
    color: var(--gray-600);
    line-height: 1.6;
}

.card-header-with-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body-flush { padding: 0; }
.card-body-flush .data-table { margin: 0; border: none; }

/* Toggle switches */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-100);
}

.toggle-row:last-child { border-bottom: none; }

.toggle-info { flex: 1; }

.toggle-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 2px;
}

.toggle-desc {
    display: block;
    font-size: 0.82rem;
    color: var(--gray-500);
}

.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin-left: 16px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--gray-200);
    border-radius: 24px;
    transition: 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Form hint text */
.form-hint {
    font-size: 0.78rem;
    color: var(--gray-400);
    margin-top: 4px;
}

/* Subscription: plan banner */
.plan-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff;
}

.plan-badge {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.plan-price {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 4px 0;
}

.plan-price span { font-size: 0.85rem; font-weight: 400; opacity: 0.8; }

.plan-desc { font-size: 0.85rem; opacity: 0.85; }

.plan-meta { text-align: right; }

.plan-meta-item { margin-bottom: 8px; }
.plan-meta-item:last-child { margin-bottom: 0; }

.plan-meta-label {
    display: block;
    font-size: 0.75rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.plan-meta-value { font-size: 0.88rem; font-weight: 600; }

/* Usage bars */
.usage-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}

.usage-row:last-child { border-bottom: none; }

.usage-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.usage-label { font-size: 0.86rem; color: var(--gray-700); font-weight: 500; }
.usage-count { font-size: 0.82rem; color: var(--gray-500); }

.usage-bar {
    height: 6px;
    background: var(--gray-100);
    border-radius: 6px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 6px;
    transition: width 0.4s ease;
}

/* Plans grid */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.plan-option {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 20px;
    position: relative;
    transition: border-color 0.2s;
}

.plan-option:hover { border-color: var(--gray-300); }

.plan-option-current {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.plan-current-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 12px;
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.plan-option h4 { font-size: 1rem; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }

.plan-option-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 12px;
}

.plan-option-price span { font-size: 0.82rem; font-weight: 400; color: var(--gray-500); }

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.plan-features li {
    font-size: 0.82rem;
    color: var(--gray-600);
    padding: 4px 0;
    padding-left: 18px;
    position: relative;
}

.plan-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--green);
    font-weight: 700;
    font-size: 0.78rem;
}

.btn-full { width: 100%; }

/* Users: avatar, roles */
.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.badge-purple { background: var(--purple-bg); color: #6d28d9; }
.badge-purple::before { background: var(--purple); }

.btn-table-danger { color: var(--red); }
.btn-table-danger:hover { background: var(--red-bg); }

.text-muted { color: var(--gray-400); font-size: 0.82rem; }

.roles-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.role-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}

.role-item:last-child { border-bottom: none; }

.role-name {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 2px;
}

.role-desc {
    font-size: 0.82rem;
    color: var(--gray-500);
}

/* Mobile App: phone mockup */
.mobile-app-banner {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 8px 0;
}

.app-phone-frame {
    width: 120px;
    height: 210px;
    border: 3px solid var(--gray-300);
    border-radius: 18px;
    padding: 8px;
    background: var(--gray-50);
    flex-shrink: 0;
}

.app-screen {
    width: 100%;
    height: 100%;
    background: #fff;
    border-radius: 10px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.app-screen-logo {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--primary);
}

.app-screen-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
}

.app-screen-card {
    height: 40px;
    background: var(--gray-100);
    border-radius: 6px;
}

.app-screen-card.short { height: 24px; }

.app-screen-nav {
    margin-top: auto;
    display: flex;
    gap: 4px;
    justify-content: center;
}

.app-screen-nav span {
    width: 16px;
    height: 3px;
    background: var(--gray-200);
    border-radius: 3px;
}

.app-info h4 { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; }
.app-info p { font-size: 0.88rem; color: var(--gray-600); line-height: 1.5; margin-bottom: 14px; }

.app-badges { display: flex; gap: 8px; }

.btn-dark {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--gray-900);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-dark:hover { background: var(--gray-700); }

/* Integrations grid */
.integrations-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.integration-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s;
}

.integration-card:hover { border-color: var(--gray-300); }

.integration-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.integration-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.int-gps        { background: #e0f2fe; color: #0284c7; }
.int-tacho      { background: #fce7f3; color: #be185d; }
.int-fuel       { background: #fef3c7; color: #b45309; }
.int-accounting { background: #d1fae5; color: #059669; }
.int-erp        { background: var(--purple-bg); color: var(--purple); }
.int-notify     { background: var(--orange-bg); color: var(--orange); }

.integration-name { font-size: 0.92rem; font-weight: 700; color: var(--gray-900); margin: 0; }
.integration-provider { font-size: 0.78rem; color: var(--gray-500); }

.integration-desc {
    font-size: 0.84rem;
    color: var(--gray-600);
    line-height: 1.5;
    flex: 1;
    margin-bottom: 14px;
}

.integration-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Upload area */
.upload-area {
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-md);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.upload-area:hover { border-color: var(--gray-300); }

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--gray-500);
    font-size: 0.88rem;
    font-weight: 500;
}

.upload-placeholder svg { color: var(--gray-400); }

.upload-hint {
    font-size: 0.78rem;
    color: var(--gray-400);
    font-weight: 400;
}

/* ============================================================
   LEGAL PAGES (Terms, Privacy)
   ============================================================ */

.legal-page {
    min-height: 100vh;
    background: var(--gray-50);
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

.legal-container {
    max-width: 720px;
    width: 100%;
}

.legal-header {
    margin-bottom: 32px;
}

.legal-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--gray-900);
}

.legal-logo-text {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
}

.legal-content {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 40px 48px;
    box-shadow: var(--shadow-sm);
}

.legal-title {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.legal-updated {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-100);
}

.legal-body h2 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 24px 0 8px 0;
}

.legal-body h2:first-child {
    margin-top: 0;
}

.legal-body p {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--gray-600);
    margin: 0 0 10px 0;
}

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

.legal-body a:hover {
    text-decoration: underline;
}

.legal-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--gray-500);
}

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

.legal-footer a:hover {
    text-decoration: underline;
}

.legal-sep {
    margin: 0 8px;
    color: var(--gray-300);
}

@media (max-width: 768px) {
    .legal-content { padding: 24px 20px; }
    .legal-title { font-size: 1.4rem; }
}

/* ============================================================
   FORM PAGES (Add Asset, Add Driver, etc.)
   ============================================================ */

.form-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-page .card {
    overflow: visible;
}

.form-page .settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-page .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-page .form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-page .form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-700);
}

.form-page .form-input {
    padding: 9px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.86rem;
    color: var(--gray-800);
    background: #fff;
    outline: none;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-page .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.form-page-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid var(--gray-200);
    background: #fff;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-outline:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
    color: var(--gray-800);
}

/* ============================================================
   RESPONSIVE — TABLES
   ============================================================ */

@media (max-width: 1024px) {
    .stats-row { flex-wrap: wrap; }
    .stats-row .stat-mini { min-width: calc(50% - 8px); }
    .page-header-row { flex-direction: column; }
    .settings-layout { grid-template-columns: 180px 1fr; }
    .settings-layout-full { grid-template-columns: 1fr; }
    .plans-grid { grid-template-columns: 1fr; }
    .integrations-grid { grid-template-columns: 1fr; }
    .detail-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .data-table { font-size: 0.82rem; }
    .data-table thead th,
    .data-table tbody td { padding: 10px 14px; }
    .stats-row .stat-mini { min-width: 100%; }
    .search-input { min-width: 160px; }
    .settings-layout { grid-template-columns: 1fr; }
    .settings-tabs {
        flex-direction: row;
        overflow-x: auto;
        position: static;
        gap: 0;
    }
    .settings-tab { white-space: nowrap; font-size: 0.82rem; padding: 8px 12px; }
    .settings-tab span { display: none; }
    .settings-tab svg { width: 20px; height: 20px; }
    .plan-banner { flex-direction: column; text-align: center; }
    .plan-meta { text-align: center; margin-top: 12px; }
    .mobile-app-banner { flex-direction: column; text-align: center; }
    .app-badges { justify-content: center; }
    .detail-layout { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .detail-status-bar { gap: 14px; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .content-grid { grid-template-columns: 1fr; }
    .account-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
        z-index: 1000;
    }
    .sidebar.open { transform: translateX(0); }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 999;
    }
    .sidebar-overlay.open { display: block; }

    .sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--gray-400);
        padding: 4px;
        border-radius: 6px;
    }
    .sidebar-close:hover { background: var(--gray-100); color: var(--gray-600); }

    .sidebar-brand { display: flex; justify-content: space-between; align-items: center; }

    .main-content { margin-left: 0; }

    .mobile-menu-toggle { display: flex; }

    .topbar-user-text { display: none; }
    .topbar-company { display: none; }
    .topbar-plan { display: none; }

    .login-container { flex-direction: column; }
    .login-left { display: none; }
    .login-right { width: 100%; min-height: 100vh; }

    .content-area { padding: 20px 16px; }
    .stats-grid { grid-template-columns: 1fr; }

    .form-page .form-row { grid-template-columns: 1fr; }
    .form-page-actions { flex-direction: column; }
    .form-page-actions .btn { width: 100%; }

    .lang-bar { position: static; padding: 12px 16px; background: var(--gray-900); }
}

/* --- reCAPTCHA --- */
.recaptcha-group { display: flex; justify-content: center; margin: 16px 0 8px; }
.recaptcha-group .g-recaptcha { transform-origin: center; }
@media (max-width: 400px) {
    .recaptcha-group .g-recaptcha { transform: scale(0.85); transform-origin: center; }
}

/* --- Login tabs --- */
.login-tabs { display: flex; gap: 0; margin-bottom: 20px; border: 1px solid var(--gray-200); border-radius: 8px; overflow: hidden; }

/* --- Defect notes --- */
.notes-list { padding: 0; }
.note-item { padding: 16px 20px; border-bottom: 1px solid var(--gray-100); }
.note-item:last-child { border-bottom: none; }
.note-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.note-author { font-size: 13px; font-weight: 500; color: var(--gray-800); }
.note-date { font-size: 12px; color: var(--gray-400); }
.note-text { font-size: 14px; color: var(--gray-600); margin: 0; line-height: 1.5; }

/* --- Input with action button --- */
.input-with-action { display: flex; gap: 8px; align-items: center; }
.input-with-action .form-input { flex: 1; }
.input-with-action .btn { white-space: nowrap; height: 40px; }

/* --- Form separator --- */
.form-separator { font-size: 14px; font-weight: 600; color: var(--gray-600); padding: 20px 0 12px 0; margin-top: 12px; border-top: 1px solid var(--gray-100); }

/* --- Pagination --- */
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-top: 1px solid var(--gray-100); }

/* --- Active/All toggle --- */
.toggle-group { display: flex; border: 1px solid var(--gray-200); border-radius: 6px; overflow: hidden; }
.toggle-btn { padding: 6px 14px; font-size: 13px; font-weight: 500; color: var(--gray-500); text-decoration: none; background: var(--white); border-right: 1px solid var(--gray-200); transition: all 0.15s; }
.toggle-btn:last-child { border-right: none; }
.toggle-btn:hover { background: var(--gray-50); color: var(--gray-700); }
a.toggle-active, .toggle-active, a.toggle-btn.toggle-active { background: var(--primary); color: #fff !important; border-color: var(--primary); }
a.toggle-active:hover, .toggle-active:hover { background: var(--primary-dark); color: #fff !important; }

/* ============================================================
   SWITCH TOGGLE — mirrors the Driver mobile app settings switch
   (rounded track + white knob, purple when ON). Used for the
   table Active/Open ⇄ All filters.
   ============================================================ */
.switch-toggle {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}
.switch-opt {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--gray-400);
    user-select: none;
    white-space: nowrap;
}
.switch-opt.is-active {
    color: var(--gray-800);
    font-weight: 600;
}
.switch {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: var(--gray-300);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease;
}
.switch:hover { background: var(--gray-400); }
.switch.is-on { background: var(--primary); }
.switch.is-on:hover { background: var(--primary-dark, #4b45cc); }
.switch-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}
.switch.is-on .switch-knob {
    transform: translateX(18px);
}
.switch:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.25);
}

/* --- Sortable table headers --- */
.sort-header { display: inline-flex; align-items: center; gap: 4px; color: var(--gray-600); text-decoration: none; white-space: nowrap; }
.sort-header:hover { color: var(--primary); }
.sort-active { color: var(--primary); font-weight: 600; }
.sort-arrow { flex-shrink: 0; }

/* --- Sidebar sub-menu --- */
.nav-sub { display: flex; flex-direction: column; padding: 0 0 4px 0; }
.nav-sub-item { padding: 6px 16px 6px 48px; font-size: 13px; color: var(--gray-500); text-decoration: none; transition: color 0.15s; }
.nav-sub-item:hover { color: var(--primary); }
.nav-sub-item.active { color: var(--primary); font-weight: 500; }

/* --- Filter tabs (stuff page) --- */
.filter-tabs { display: flex; gap: 0; margin-bottom: 16px; border: 1px solid var(--gray-200); border-radius: 8px; overflow: hidden; background: var(--white); }
.filter-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--gray-500); text-decoration: none; border-right: 1px solid var(--gray-200); transition: all 0.15s; }
.filter-tab:last-child { border-right: none; }
.filter-tab:hover { background: var(--gray-50); color: var(--gray-700); }
.filter-tab-active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.filter-tab-active:hover { background: var(--primary); color: var(--white); }
.filter-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 6px; font-size: 11px; font-weight: 600; border-radius: 10px; background: rgba(255,255,255,0.2); }
.filter-tab:not(.filter-tab-active) .filter-count { background: var(--gray-100); color: var(--gray-500); }

/* --- Page footer info (load time + server) --- */
.page-footer-info { text-align: right; font-size: 11px; color: var(--gray-400); padding: 8px 4px; margin-top: 4px; }
.pagination-info { font-size: 13px; color: var(--gray-500); }
.pagination-controls { display: flex; gap: 4px; align-items: center; }
.pagination-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px; font-size: 13px; font-weight: 500; color: var(--gray-600); background: var(--white); border: 1px solid var(--gray-200); border-radius: 6px; text-decoration: none; cursor: pointer; transition: all 0.15s; }
.pagination-btn:hover { background: var(--gray-50); border-color: var(--gray-300); color: var(--gray-800); }
.pagination-active, a.pagination-active, .pagination-btn.pagination-active { background: var(--primary); border-color: var(--primary); color: #fff !important; cursor: default; }
.pagination-active:hover, a.pagination-active:hover { background: var(--primary); color: #fff !important; }
.pagination-disabled { opacity: 0.4; cursor: default; pointer-events: none; }
.pagination-ellipsis { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 34px; font-size: 13px; color: var(--gray-400); }

/* --- VAT verification result --- */
.vat-result { margin-top: 8px; padding: 10px 14px; border-radius: 6px; font-size: 13px; line-height: 1.5; }
.vat-result-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.vat-result-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.vat-result-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }
.login-tab { flex: 1; padding: 10px 16px; font-size: 14px; font-weight: 500; background: transparent; border: none; cursor: pointer; color: var(--gray-500); transition: all 0.2s; }
.login-tab.active { background: var(--gray-900); color: #fff; }
.login-tab:not(.active):hover { background: var(--gray-100); }

/* ═══════ View tabs (asset/driver detail pages) ═══════ */
.view-tabs {
    display: flex; gap: 4px; margin: 20px 0 16px;
    border-bottom: 2px solid var(--gray-200);
}
.view-tab {
    padding: 10px 18px; border: none; background: none; cursor: pointer;
    font-size: 14px; font-weight: 500; color: var(--gray-500);
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}
.view-tab:hover { color: var(--gray-700); }
.view-tab-active { color: var(--primary); border-bottom-color: var(--primary); }

.detail-grid-2col {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
@media (max-width: 900px) { .detail-grid-2col { grid-template-columns: 1fr; } }

.detail-list {
    display: grid; grid-template-columns: 45% 55%; row-gap: 8px; margin: 0;
}
.detail-list dt { color: var(--gray-500); font-size: 13px; padding: 2px 0; }
.detail-list dd { margin: 0; font-size: 13px; color: var(--gray-800); padding: 2px 0; word-break: break-word; }

.form-check-row { display: flex; flex-wrap: wrap; gap: 16px; }
.form-check { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.form-check input { cursor: pointer; }

.empty-state-sm { padding: 32px; text-align: center; color: var(--gray-400); font-size: 14px; }
.doc-link { color: var(--primary); text-decoration: none; font-weight: 500; }
.doc-link:hover { text-decoration: underline; }
.doc-upload-form .form-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) { .doc-upload-form .form-grid { grid-template-columns: 1fr; } }

/* ═══════ Messenger ═══════ */
.msg-layout {
    display: grid; grid-template-columns: 320px 1fr;
    height: calc(100vh - 200px); min-height: 480px;
    background: #fff; border: 1px solid var(--gray-200); border-radius: 12px;
    overflow: hidden;
}
.msg-sidebar { border-right: 1px solid var(--gray-200); display: flex; flex-direction: column; }
.msg-search-wrap { padding: 12px 12px 6px; }
.msg-new-wrap { padding: 0 12px 10px; border-bottom: 1px solid var(--gray-100); }
.msg-convo-list { flex: 1; overflow-y: auto; }
.msg-convo {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    cursor: pointer; border-bottom: 1px solid var(--gray-100);
    transition: background .1s;
}
.msg-convo:hover { background: var(--gray-50); }
.msg-convo-active { background: #eef4ff; }
.msg-convo-avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
    background: var(--primary); color: #fff; font-weight: 600;
    display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.msg-convo-body { flex: 1; min-width: 0; }
.msg-convo-name { font-weight: 600; font-size: 13px; color: var(--gray-800); }
.msg-convo-preview {
    font-size: 12px; color: var(--gray-500);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg-unread-badge {
    background: #e11d48; color: #fff; font-size: 11px; font-weight: 700;
    border-radius: 10px; padding: 2px 7px; flex-shrink: 0;
}
.nav-unread-badge {
    background: #e11d48; color: #fff; font-size: 10px; font-weight: 700;
    border-radius: 9px; padding: 1px 6px; margin-left: auto;
}

.msg-chat { display: flex; flex-direction: column; min-width: 0; }
.msg-chat-header {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-bottom: 1px solid var(--gray-200);
    min-height: 56px;
}
.msg-chat-header .msg-convo-avatar { width: 32px; height: 32px; font-size: 13px; }
.msg-chat-title { font-weight: 600; font-size: 14px; color: var(--gray-800); }
.msg-chat-body {
    flex: 1; overflow-y: auto; padding: 16px;
    background: #f8fafc;
    display: flex; flex-direction: column; gap: 6px;
}
.msg-chat-empty {
    margin: auto; text-align: center; color: var(--gray-400);
}
.msg-chat-empty svg { margin-bottom: 8px; }
.msg-loading { margin: auto; color: var(--gray-400); font-size: 24px; }
.msg-day-sep {
    align-self: center; font-size: 11px; color: var(--gray-400);
    background: var(--gray-100); padding: 3px 10px; border-radius: 10px;
    margin: 8px 0 4px;
}
.msg-bubble-row { display: flex; }
.msg-mine { justify-content: flex-end; }
.msg-theirs { justify-content: flex-start; }
.msg-bubble {
    max-width: 65%; padding: 8px 12px; font-size: 13px; line-height: 1.45;
    border-radius: 14px; word-break: break-word; position: relative;
}
.msg-mine .msg-bubble {
    background: var(--primary); color: #fff; border-bottom-right-radius: 4px;
}
.msg-theirs .msg-bubble {
    background: #fff; color: var(--gray-800);
    border: 1px solid var(--gray-200); border-bottom-left-radius: 4px;
}
.msg-time {
    display: inline-block; font-size: 10px; margin-left: 8px; opacity: .65;
    vertical-align: bottom;
}
.msg-send-bar {
    display: flex; gap: 8px; padding: 12px 16px;
    border-top: 1px solid var(--gray-200); background: #fff;
}
.msg-send-bar .form-input { flex: 1; }

@media (max-width: 800px) {
    .msg-layout { grid-template-columns: 1fr; height: auto; }
    .msg-sidebar { max-height: 300px; }
    .msg-chat { height: 60vh; }
}

/* ═══════ Dashboard tiles (mobile-app style) ═══════ */
.dash-welcome {
    background: var(--gray-50); border-radius: 16px;
    padding: 28px 32px; margin-bottom: 20px;
}
.dash-welcome-name {
    font-size: 1.75rem; font-weight: 700; color: var(--gray-900); margin: 0;
}
.dash-welcome-role {
    font-size: 1rem; color: var(--gray-400); margin: 6px 0 0;
}
.dash-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}
.dash-tile {
    position: relative;
    background: #fff; border: 1px solid var(--gray-200); border-radius: 16px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px; padding: 44px 20px;
    color: var(--primary); text-decoration: none;
    transition: transform .12s, box-shadow .12s, background .12s;
}
.dash-tile:hover {
    background: #f8fafc; border-color: var(--primary); transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(20, 30, 80, .08);
}
.dash-tile-label {
    font-size: 17px; font-weight: 600; color: var(--gray-800);
}
.dash-tile-count {
    position: absolute; top: 14px; right: 16px;
    font-size: 12px; font-weight: 700; color: var(--gray-500);
    background: #fff; border: 1px solid var(--gray-200);
    border-radius: 12px; padding: 3px 10px;
}
.dash-tile-alert {
    color: #fff; background: #e11d48; border-color: #e11d48;
}
@media (max-width: 640px) {
    .dash-tiles { grid-template-columns: 1fr 1fr; gap: 12px; }
    .dash-tile { padding: 32px 12px; }
    .dash-welcome { padding: 20px; }
    .dash-welcome-name { font-size: 1.35rem; }
}

/* ═══════ Check template editor ═══════ */
.q-list { display: flex; flex-direction: column; gap: 8px; }
.q-row { display: flex; align-items: center; gap: 8px; }
.q-nr {
    width: 28px; height: 28px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--gray-100); border-radius: 8px;
    font-size: 12px; font-weight: 700; color: var(--gray-500);
}
.q-input { flex: 1; }
.q-btn {
    width: 30px; height: 30px; flex-shrink: 0;
    border: 1px solid var(--gray-200); border-radius: 8px;
    background: #fff; color: var(--gray-500); cursor: pointer;
    font-size: 11px; line-height: 1;
    transition: background .1s, color .1s;
}
.q-btn:hover { background: var(--gray-50); color: var(--gray-800); }
.q-btn-del:hover { background: #fef2f2; color: #e11d48; border-color: #fecaca; }
.btn-danger-hover:hover { background: #fef2f2; color: #e11d48; border-color: #fecaca; }

/* ═══════ Check editor: question groups ═══════ */
.g-list { display: flex; flex-direction: column; gap: 14px; }
.qg-group {
    border: 1px solid var(--gray-200); border-radius: 12px;
    padding: 12px; background: var(--gray-50);
}
.qg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.qg-grip { color: var(--gray-300); font-size: 14px; cursor: default; }
.qg-name { flex: 1; font-weight: 600; background: #fff; }
.qg-items { display: flex; flex-direction: column; gap: 8px; }
.qg-items .q-row .form-input { background: #fff; }
.qg-addq { margin-top: 10px; }
.qg-grip { cursor: grab; user-select: none; padding: 0 4px; }
.qg-grip:active { cursor: grabbing; }
.qg-dragging { opacity: .45; border-style: dashed; }

/* ═══════ Answer chips (cat 77) on question rows ═══════ */
.a-chips { display: flex; gap: 4px; flex-shrink: 0; }
.a-chip {
    font-size: 11px; font-weight: 600; padding: 4px 9px;
    border: 1px solid var(--gray-200); border-radius: 10px;
    background: #fff; color: var(--gray-400); cursor: pointer;
    user-select: none; white-space: nowrap;
    transition: background .1s, color .1s, border-color .1s;
}
.a-chip:hover { border-color: var(--gray-300); }
.a-chip-on { background: var(--primary); color: #fff; border-color: var(--primary); }
.a-chip[data-locked] { cursor: default; opacity: .9; }
@media (max-width: 900px) {
    .q-row { flex-wrap: wrap; }
    .a-chips { order: 10; width: 100%; padding-left: 36px; }
}

/* ═══════ Clickable table rows ═══════ */
tr.row-link { cursor: pointer; transition: background .1s; }
tr.row-link:hover { background: var(--gray-50); }
tr.row-link:hover .cell-primary { color: var(--primary); }

/* ═══════ Driver rotation editor ═══════ */
.rota-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .rota-grid { grid-template-columns: 1fr; } }
.rota-days { display: flex; flex-direction: column; gap: 8px; }
.rota-day { display: flex; align-items: center; gap: 12px; }
.rota-day-name { width: 100px; flex-shrink: 0; font-size: 13px; font-weight: 600; color: var(--gray-600); }
.rota-select { flex: 1; font-weight: 600; }
.rota-t1 { background: #e8f7ee !important; color: #157347 !important; }
.rota-t2 { background: var(--gray-100) !important; color: var(--gray-600) !important; }
.rota-t3 { background: #fef9e7 !important; color: #92700c !important; }
.rota-t4 { background: #fdeaea !important; color: #b02a37 !important; }
.rota-t5 { background: #f6e6f8 !important; color: #86338f !important; }
.rota-t6 { background: #e7f1fd !important; color: #1d5fbf !important; }
.rota-table td { padding: 6px 8px; vertical-align: middle; }
.rota-table th { padding: 8px; font-size: 11px; }
.rota-table .form-input { padding: 6px 8px; font-size: 12px; }
.rota-grid .card { margin-bottom: 0; }
.rota-table .rota-day-name { font-weight: 600; font-size: 13px; color: var(--gray-600); }

/* ═══════ Rota — single-panel two-week table with vertical divider ═══════ */
.rota-2wk { table-layout: fixed; }
.rota-2wk th, .rota-2wk td { padding: 6px 8px; font-size: 12px; vertical-align: middle; }
.rota-2wk .rota-daycol { width: 90px; }
.rota-2wk .rota-wkhead { text-align: center; font-weight: 700; font-size: 12px; color: var(--gray-700); background: var(--gray-50); }
.rota-2wk .rota-divider { width: 1px; padding: 0; background: var(--gray-200); }
.rota-2wk .rota-type-cell { width: 14%; }
.rota-2wk .rota-ct-cell   { width: 12%; }
.rota-2wk .rota-note-cell { width: auto; }
.rota-2wk .form-input { padding: 6px 8px; font-size: 12px; }
.rota-2wk .rota-day-name { font-weight: 600; color: var(--gray-600); }

/* ═══════ All-drivers rotation grid ═══════ */
.rota-nav-form { display: flex; gap: 6px; align-items: center; }
.rota-nav-form .form-input { padding: 6px 10px; font-size: 13px; }
.rota-all-table { width: auto; min-width: 100%; }
.rota-all-table th, .rota-all-table td {
    padding: 4px 6px; font-size: 11px;
    text-align: center; border-right: 1px solid var(--gray-100);
}
.rota-all-driver { text-align: left !important; min-width: 160px; font-weight: 600; background: #fff; position: sticky; left: 0; z-index: 2; }
.rota-all-name { color: var(--gray-800); text-decoration: none; font-size: 12px; }
.rota-all-name:hover { color: var(--primary); text-decoration: underline; }
.rota-all-cell { min-width: 40px; }
.rota-all-cell.rota-all-wknd { background: rgba(0,0,0,.02); }
.rota-all-dow { font-size: 10px; color: var(--gray-400); font-weight: 500; }
.rota-all-date { font-size: 11px; color: var(--gray-700); font-weight: 600; }
.rota-all-mark { display: inline-block; font-weight: 700; font-size: 11px; }
.rota-all-ct { display: block; font-size: 9px; opacity: .75; margin-top: 1px; }
.rota-all-empty { color: var(--gray-300); }
.rota-all-legend {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 6px 14px; margin-top: 12px; padding: 10px 14px;
    background: #fff; border: 1px solid var(--gray-200); border-radius: 10px;
    font-size: 12px;
}
.rota-all-legend-item {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 6px;
    font-weight: 700; font-size: 11px;
}
.rota-all-legend-label { color: var(--gray-600); margin-right: 8px; }

/* ═══════ GPS tracking map ═══════ */
.track-head { display: flex; align-items: center; justify-content: space-between; }
.track-controls { display: flex; gap: 8px; align-items: center; }
.track-controls .form-input { padding: 6px 10px; font-size: 13px; }
.track-map { height: 460px; width: 100%; border-radius: 10px; margin: 12px 0; z-index: 0; }
.track-status { font-size: 13px; color: var(--gray-500); }
.track-summary { display: flex; flex-wrap: wrap; gap: 20px; font-size: 13px; color: var(--gray-600); }
.track-summary strong { color: var(--gray-800); }

/* ═══════ Stop markers on the track ═══════ */
.stop-label {
    background: transparent; border: none; box-shadow: none;
    color: #7c2d12; font-weight: 700; font-size: 11px;
}
.stop-label::before { display: none; }

/* ═══════ Rota template editor (two weeks, one panel) ═══════ */
.rota-tpl-table { table-layout: fixed; }
.rota-tpl-table th, .rota-tpl-table td { padding: 6px 8px; font-size: 12px; vertical-align: middle; }
.rota-tpl-table .rt-daycol { width: 90px; }
.rota-tpl-table .rt-wkhead { text-align: center; font-weight: 700; background: var(--gray-50); }
.rota-tpl-table .rt-divider { width: 1px; padding: 0; background: var(--gray-200); }
.rota-tpl-table .rt-day-name { font-weight: 600; color: var(--gray-600); }
.rota-tpl-table .form-input { padding: 6px 8px; font-size: 12px; }
.rt-state.rt-off { background: #fef9e7; color: #92700c; }
.rt-state.rt-work { background: #e8f7ee; color: #157347; }

.rota-legend-body { display: flex; flex-wrap: wrap; gap: 24px; }
.rota-legend-item { display: flex; flex-direction: column; gap: 2px; }
.rota-legend-lbl { font-size: 11px; text-transform: uppercase; color: var(--gray-400); font-weight: 600; }
.rota-legend-val { font-size: 14px; color: var(--gray-800); }

/* ═══════ Weekly rotation grid ═══════ */
.rota-weeknav { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.rota-weeknav-cur { font-weight: 600; color: var(--gray-700); }
.rota-grid-table { border-collapse: collapse; }
.rota-grid-table th, .rota-grid-table td {
    border: 1px solid var(--gray-150, #e8eaed); padding: 4px 6px; font-size: 11px; text-align: center;
}
.rg-sticky { position: sticky; left: 0; background: #fff; z-index: 2; }
.rg-driver { text-align: left !important; min-width: 150px; }
.rg-name { color: var(--gray-800); text-decoration: none; font-weight: 600; font-size: 12px; }
.rg-name:hover { color: var(--primary); text-decoration: underline; }
.rg-notes { text-align: left !important; min-width: 120px; font-size: 11px; }
.rg-dow { font-size: 10px; color: var(--gray-400); }
.rg-date { font-size: 11px; font-weight: 600; color: var(--gray-700); }
.rg-day.rg-wknd { background: rgba(0,0,0,.02); }
.rg-cell { min-width: 74px; height: 42px; cursor: pointer; vertical-align: middle; }
.rg-cell:hover { outline: 2px solid var(--primary); outline-offset: -2px; }
.rg-state { font-weight: 600; font-size: 10px; }
.rg-contract { font-size: 10px; color: var(--gray-600); }
.rg-note { font-size: 10px; color: var(--gray-500); font-style: italic; }
/* cat 35 colours */
.rc-off      { background: #fef9c3; }
.rc-offav    { background: #fefce8; }
.rc-sick     { background: #fce7f3; }
.rc-absent   { background: #fee2e2; }
.rc-holiday  { background: #dbeafe; }

.rota-legend-row { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-top: 12px; font-size: 12px; }
.rota-lg-swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--gray-200); }
.rota-lg-txt { color: var(--gray-600); margin-right: 6px; }

.cell-pop { position: absolute; z-index: 1000; width: 260px; }
.cell-pop-inner { background: #fff; border: 1px solid var(--gray-200); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.15); padding: 14px; }
.cell-pop-inner label { display: block; font-size: 11px; font-weight: 600; color: var(--gray-500); margin: 8px 0 3px; }
.cell-pop-inner label:first-child { margin-top: 0; }
.cell-pop-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
/* rota template editor: explicit column widths so both weeks align */
.rota-tpl-table .rt-state-cell { width: 13%; }
.rota-tpl-table .rt-ct-cell    { width: 13%; }
.rota-tpl-table .rt-note-cell  { width: 20%; }
.rota-tpl-table .rt-divider-b { width: 1px; padding: 0; background: var(--gray-200); }

/* ═══════ Rota day-edit modal ═══════ */
.rota-modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(15, 23, 42, .45);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.rota-modal {
    background: #fff; border-radius: 14px; width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: rotaModalIn .15s ease-out;
}
@keyframes rotaModalIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.rota-modal-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 16px 18px 12px; border-bottom: 1px solid var(--gray-100);
}
.rota-modal-title { font-size: 16px; font-weight: 700; color: var(--gray-800); }
.rota-modal-sub { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.rota-modal-x {
    border: none; background: transparent; font-size: 16px; cursor: pointer;
    color: var(--gray-400); padding: 4px 8px; border-radius: 6px;
}
.rota-modal-x:hover { background: var(--gray-100); color: var(--gray-700); }
.rota-modal-body { padding: 14px 18px; }
.rota-modal-body label {
    display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
    color: var(--gray-500); margin: 12px 0 6px;
}
.rota-modal-body label:first-child { margin-top: 0; }
.rota-modal-actions {
    display: flex; justify-content: space-between; gap: 10px;
    padding: 12px 18px 16px; border-top: 1px solid var(--gray-100);
}
.rota-state-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.rs-pill {
    border: 1px solid var(--gray-200); background: #fff; border-radius: 16px;
    padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
    color: var(--gray-600); transition: box-shadow .1s, border-color .1s;
}
.rs-pill:hover { border-color: var(--gray-400); }
.rs-pill-on { border: 2px solid var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,.15); color: var(--gray-800); }

/* Rota modal polish: color-coded state pills + full-width inputs */
.rota-modal-body .form-input { width: 100%; box-sizing: border-box; }
.rs-pill.rc-off      { background: #fef9c3; }
.rs-pill.rc-offav    { background: #fefce8; }
.rs-pill.rc-sick     { background: #fce7f3; }
.rs-pill.rc-absent   { background: #fee2e2; }
.rs-pill.rc-holiday  { background: #dbeafe; }
.rs-pill[data-v="1"] { background: #e8f7ee; }   /* Working — green like the template editor */
.rs-pill-on { border: 2px solid var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,.18); color: var(--gray-900); font-weight: 700; }

/* ═══════ Print (PDF export of the rota grid & other pages) ═══════ */
@media print {
    @page { size: A4 landscape; margin: 8mm; }
    .sidebar, .topbar, .toolbar-actions, .rota-weeknav, .alert,
    .rota-legend-row, .cell-pop, .rota-modal-overlay, .page-subtitle { display: none !important; }
    .main-layout, .content-area { display: block !important; margin: 0 !important; padding: 0 !important; max-width: none !important; }
    .card { border: none !important; box-shadow: none !important; }
    .card-body { overflow: visible !important; }
    body { background: #fff !important; }
    .rota-grid-table th, .rota-grid-table td {
        font-size: 8px !important; padding: 2px 3px !important;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .rg-cell { height: auto !important; min-width: 0 !important; }
    .rg-sticky { position: static !important; }
    .page-title { font-size: 16px !important; margin-bottom: 4px !important; }
}

/* ═══════ Check results ═══════ */
.summary-row { display: flex; flex-wrap: wrap; gap: 32px; }
.summary-cell { display: flex; flex-direction: column; gap: 4px; }
.summary-lbl { font-size: 11px; text-transform: uppercase; color: var(--gray-400); font-weight: 600; }
.summary-val { font-size: 15px; color: var(--gray-800); }
.answer-fail { background: #fef2f2; }
.answer-fail-txt { color: #b02a37; font-weight: 600; }
.answer-ok-txt { color: #157347; }
.answer-note { font-size: 12px; color: var(--gray-500); margin-top: 3px; font-style: italic; }
.filter-tabs { display: flex; gap: 4px; }
.filter-tab { padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
    color: var(--gray-500); text-decoration: none; }
.filter-tab:hover { background: var(--gray-100); }
.filter-tab-active { background: var(--primary); color: #fff; }
.badge-amber { background: #fef3c7; color: #92700c; }

/* Check-result grouped sections */
.chk-section { border-bottom: 1px solid var(--gray-100); }
.chk-section:last-child { border-bottom: none; }
.chk-section-head {
    background: var(--gray-50); padding: 8px 16px;
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--gray-600);
}
.chk-answer-table { margin: 0; }
.chk-answer-table td { padding: 8px 16px; }
.chk-na { color: var(--gray-300); font-size: 13px; }

/* ============================================================
   SIGN-UP PAGE
   Plain white page, logo top-left, single centred card — a
   deliberately different shell from the split-hero login.
   ============================================================ */

body.page-signup {
    background: #fff;
    min-height: 100vh;
}

.signup-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #fff;
}

.signup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    background: #fff;
}

.signup-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--gray-900);
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.signup-logo img { display: block; border-radius: 8px; }

/* The header's language control sits inline rather than floating
   over a hero image as it does on the login screen. */
.signup-header .auth-lang-wrap { position: relative; top: auto; right: auto; }

.signup-main {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 8px 20px 56px;
}

.signup-card {
    width: 100%;
    max-width: 560px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    padding: 36px 40px 32px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04),
                0 8px 24px rgba(16, 24, 40, 0.06);
}

.signup-card .login-heading { text-align: center; }
.signup-card .login-subheading { text-align: center; margin-bottom: 24px; }
.signup-card .auth-footer-text { text-align: center; margin-top: 18px; }

/* Terms acceptance — checkbox and its wrapping text align at the top
   so the label doesn't drift as the sentence wraps. */
.signup-terms { margin: 20px 0 16px; }
.signup-terms .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--gray-600);
    cursor: pointer;
}
.signup-terms input[type="checkbox"] {
    margin-top: 2px;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}
.signup-terms a { color: var(--primary); text-decoration: none; }
.signup-terms a:hover { text-decoration: underline; }

@media (max-width: 640px) {
    .signup-header { padding: 16px 18px; }
    .signup-card { padding: 26px 20px 24px; border: none; box-shadow: none; }
    .signup-main { padding: 0 12px 40px; }
}

/* ============================================================
   GETTING-STARTED ROADMAP
   Shown on the dashboard until a tenant has set up the basics,
   then it removes itself — no dismiss button, no stored state.
   ============================================================ */

.roadmap-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    padding: 22px 24px;
    margin-bottom: 22px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.roadmap-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.roadmap-title {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 4px;
    letter-spacing: -0.01em;
}
.roadmap-sub { font-size: 0.85rem; color: var(--gray-500); margin: 0; }

.roadmap-progress-wrap { min-width: 140px; text-align: right; }
.roadmap-count {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
}
.roadmap-bar {
    margin-top: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--gray-100);
    overflow: hidden;
}
.roadmap-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.roadmap-steps { list-style: none; margin: 0; padding: 0; }

.roadmap-step {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-top: 1px solid var(--gray-100);
}
.roadmap-step:first-child { border-top: none; }

.roadmap-check {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--gray-200);
    color: #fff;
}
.roadmap-step.is-done .roadmap-check {
    background: var(--primary);
    border-color: var(--primary);
}

.roadmap-text { flex: 1 1 auto; min-width: 0; }
.roadmap-step-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
}
.roadmap-step-desc {
    display: block;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 2px;
}
.roadmap-step.is-done .roadmap-step-title {
    color: var(--gray-400);
    text-decoration: line-through;
}
.roadmap-step.is-done .roadmap-step-desc { color: var(--gray-400); }

.roadmap-action { flex: 0 0 auto; }

@media (max-width: 640px) {
    .roadmap-card { padding: 18px 16px; }
    .roadmap-progress-wrap { min-width: 0; text-align: left; width: 100%; }
    .roadmap-step { flex-wrap: wrap; }
    .roadmap-action { margin-left: 36px; }
}

/* Sign-up step indicator */
.signup-steps {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 18px; font-size: 0.78rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.signup-step { color: var(--gray-400); }
.signup-step.is-done { color: var(--primary); }
.signup-step.is-current { color: var(--gray-800); }
.signup-step-sep { color: var(--gray-300); }

/* ============================================================
   SUPPORT SESSION BANNER
   Shown whenever an operator is signed in to a tenant to help
   them. Deliberately loud: mistaking a support session for the
   customer's own is how someone changes the wrong fleet's data.
   ============================================================ */
.support-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    background: #7c2d12;
    color: #fed7aa;
    font-size: 0.82rem;
    line-height: 1.4;
    border-bottom: 2px solid #9a3412;
}
.support-banner svg { flex: 0 0 auto; }
.support-banner b { color: #fff; }
.support-banner span { flex: 1 1 auto; }
.support-banner a {
    flex: 0 0 auto;
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
    white-space: nowrap;
}
@media (max-width: 640px) {
    .support-banner { font-size: 0.75rem; padding: 8px 12px; }
}

/* ============================================================
   AUTH PAGES — HEADER BAR (superseded the mobile-only logo)
   The split-hero carries the branding on desktop but is hidden
   below 768px, which left login / forgot-password / reset with
   no logo at all on a phone. Shown only where the hero is not.
   ============================================================ */
.auth-mobile-logo {
    display: none;                 /* desktop: the hero already brands it */
    align-items: center;
    gap: 9px;
    text-decoration: none;
    color: var(--gray-900);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.auth-mobile-logo img { display: block; border-radius: 7px; }

@media (max-width: 768px) {
    .auth-mobile-logo { display: inline-flex; }
    /* The language switcher is absolutely positioned top-right on the
       hero layout; on mobile it shares a row with the logo. */
    .login-right { position: relative; }
    .auth-lang-wrap { position: absolute; top: 18px; right: 18px; }
}

/* "or" divider between the Google button and the email form */
.auth-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 14px 0; color: var(--gray-400); font-size: 0.78rem;
    text-transform: uppercase; letter-spacing: 0.06em;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1 1 auto; height: 1px; background: var(--gray-200);
}

/* ============================================================
   AUTH HEADER BAR
   Logo top-left, language top-right — matching the sign-up
   pages. Sits above the form rather than beside it.
   ============================================================ */
.auth-header {
    /* Pinned to the top of the column so it does not take part in the
       vertical centring of the form. */
    position: absolute;
    top: 26px;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 0 40px;
    box-sizing: border-box;
}
/* On a desktop the split-hero on the left already carries the logo,
   so showing it in the header too puts two on one page. It is needed
   below 768px, where the hero is hidden. */
.auth-header-logo {
    display: none;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--gray-900);
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.auth-header-logo img { display: block; border-radius: 8px; }

/* The switcher was absolutely positioned for the old layout; inside
   the header bar it sits in normal flow. */
.auth-header .auth-lang-wrap { position: static; top: auto; right: auto; }
/* With the logo hidden, the switcher is the only child — push it right. */
.auth-header { justify-content: flex-end; }

.login-right { padding-top: 0; }

@media (max-width: 768px) {
    .auth-header { max-width: none; padding: 0 22px; top: 18px;
                   justify-content: space-between; }
    .auth-header-logo { display: inline-flex; }
    /* Leave room for the pinned header so the form never slides under it */
    .login-form-wrapper { padding-top: 78px; }
}

/* Terms line under the sign-up options */
.auth-terms {
    max-width: 420px;
    margin: 20px auto 0;
    text-align: center;
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--gray-500);
}
.auth-terms a { color: var(--gray-600); text-decoration: underline; }
.auth-terms a:hover { color: var(--primary); }

/* ============================================================
   TOPBAR USER MENU
   Avatar (photo or initials) + name with the role beneath,
   opening a menu. Previously the whole thing was a bare link to
   /account, so signing out meant hunting for the link.
   ============================================================ */
.topbar-user-wrap { position: relative; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 9px 5px 5px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}
.topbar-user:hover { background: var(--gray-50); border-color: var(--gray-200); }
.topbar-user[aria-expanded="true"] { background: var(--gray-50); border-color: var(--gray-300); }

.topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 9px;          /* rounded rectangle, not a circle */
    object-fit: cover;
    flex: 0 0 auto;
    display: block;
}
.topbar-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.topbar-user-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}
.topbar-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
.topbar-role {
    font-size: 0.72rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
.topbar-caret { color: var(--gray-400); flex: 0 0 auto; }

/* ── the menu ── */
.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 260px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.12);
    padding: 6px;
    z-index: 200;
}
.user-menu[hidden] { display: none; }

.user-menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--gray-100); }
.user-menu-name { font-size: 0.9rem; font-weight: 700; color: var(--gray-900); }
.user-menu-sub {
    font-size: 0.76rem;
    color: var(--gray-500);
    margin-top: 2px;
    word-break: break-all;
}
.user-menu-sub.mono { font-family: var(--font-mono, monospace); }

.user-menu-meta {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.76rem;
}
.user-menu-meta > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0;
}
.user-menu-meta span { color: var(--gray-500); }
.user-menu-meta b { color: var(--gray-800); font-weight: 600; text-align: right; }
.user-menu-meta b.ok  { color: var(--green-600, #16a34a); }
.user-menu-meta b.dim { color: var(--gray-400); font-weight: 500; }

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-top: 2px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--gray-700);
    text-decoration: none;
}
.user-menu-item:hover { background: var(--gray-50); color: var(--gray-900); }
.user-menu-item svg { color: var(--gray-400); flex: 0 0 auto; }
.user-menu-danger { color: #b91c1c; }
.user-menu-danger:hover { background: #fef2f2; color: #991b1b; }
.user-menu-danger svg { color: #dc2626; }

@media (max-width: 768px) {
    /* Name and role are dropped, but the avatar stays — it is the
       only way back to the account and to signing out. */
    .topbar-user-text, .topbar-caret { display: none; }
    .topbar-user { padding: 4px; gap: 0; }
    .user-menu { min-width: 240px; }
}

/* ── document row actions ── */
.doc-actions { white-space: nowrap; text-align: right; width: 1%; }
.btn-icon {
    background: transparent; border: 1px solid transparent; border-radius: 7px;
    padding: 5px; cursor: pointer; color: var(--gray-500); line-height: 0;
}
.btn-icon:hover { background: var(--gray-100); color: var(--gray-800); }
.btn-icon-danger:hover { background: #fef2f2; color: #b91c1c; }

.doc-modal {
    position: fixed; inset: 0; background: rgba(16,24,40,0.45);
    display: flex; align-items: center; justify-content: center; z-index: 400; padding: 20px;
}
.doc-modal[hidden] { display: none; }
.doc-modal-box {
    background: #fff; border-radius: 14px; padding: 22px; width: 100%; max-width: 420px;
    box-shadow: 0 20px 50px rgba(16,24,40,0.2);
}
.doc-modal-box h3 { margin: 0 0 16px; font-size: 1.05rem; }

/* Breathing room above a full-width submit that follows a field with
   a hint under it — otherwise the button crowds the hint text. */
.form-actions-spaced { margin-top: 22px; }

/* Check template options */
.check-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px 24px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
}
.check-options .checkbox-label { align-items: flex-start; }
.check-options .checkbox-label b { display: block; font-size: 0.86rem; font-weight: 600; }
.check-options .checkbox-label em {
    display: block; font-style: normal; font-size: 0.76rem;
    color: var(--gray-500); line-height: 1.45; margin-top: 2px;
}

/* Check side photos */
.check-photos { display: flex; gap: 10px; flex-wrap: wrap; }
.check-photo {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; border: 1px solid var(--gray-200); border-radius: 8px;
    font-size: 0.82rem; color: var(--gray-700); text-decoration: none;
}
.check-photo:hover { border-color: var(--primary); color: var(--primary); }

/* ── walkaround side photos ──
   Four fixed slots. A missing side stays visible and greyed, because
   the absence is the finding. */
.side-photos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}
.side-photo {
    display: block;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    background: var(--gray-50);
}
.side-photo img {
    display: block;
    width: 100%;
    height: 110px;
    object-fit: cover;
    background: var(--gray-100);
}
.side-photo-label {
    display: block;
    padding: 7px 10px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--gray-700);
    text-align: center;
}
a.side-photo:hover { border-color: var(--primary); }
a.side-photo:hover .side-photo-label { color: var(--primary); }

.side-photo-missing { border-style: dashed; }
.side-photo-missing .side-photo-label { color: var(--gray-400); font-weight: 500; }
.side-photo-empty {
    display: flex; align-items: center; justify-content: center;
    height: 110px; color: var(--gray-300);
}

.side-lightbox {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(16,24,40,0.85);
    display: flex; align-items: center; justify-content: center; padding: 24px;
    cursor: zoom-out;
}
.side-lightbox[hidden] { display: none; }
.side-lightbox figure { margin: 0; max-width: 100%; max-height: 100%; text-align: center; }
.side-lightbox img { max-width: 100%; max-height: 84vh; border-radius: 10px; display: block; }
.side-lightbox figcaption { color: #fff; font-size: 0.9rem; margin-top: 12px; }
