/* ===== Self-hosted fonts ===== */
@font-face {
    font-family: 'Nunito';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url("../fonts/nunito-300-nQjjZd5.woff2") format('woff2');
}
@font-face {
    font-family: 'Nunito';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/nunito-400-nQjjZd5.woff2") format('woff2');
}
@font-face {
    font-family: 'Nunito';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/nunito-600-nQjjZd5.woff2") format('woff2');
}
@font-face {
    font-family: 'Nunito';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/nunito-700-nQjjZd5.woff2") format('woff2');
}
@font-face {
    font-family: 'Nunito';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url("../fonts/nunito-800-nQjjZd5.woff2") format('woff2');
}
@font-face {
    font-family: 'Bebas Neue';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/bebas-neue-400-c3igBv2.woff2") format('woff2');
}

/* ===== CDS App - CSS Variables & Theme ===== */
:root {
    /* Brand palette */
    --cds-navy: #1B2A4A;
    --cds-navy-light: #2A3D66;
    --cds-navy-deep: #2a3164;
    --cds-teal: #1B2A4A;
    --cds-teal-dark: #152035;
    --cds-teal-chat: #2A3D66;
    --cds-white: #FFFFFF;
    --cds-gray-light: #F5F5F5;
    --cds-gray: #E0E0E0;
    --cds-gray-text: #888888;
    --cds-red: #E74C3C;
    --cds-green: #2ECC71;
    --cds-green-toggle: #2dcf63;
    --cds-orange: #F39C12;

    /* Semantic tokens */
    --cds-text-dark: #1B2A4A;
    --cds-text-light: #FFFFFF;
    --cds-body-bg: #242a56;
    --cds-surface: #eceef3;
    --cds-surface-alt: #eef0f5;
    --cds-border-accent: #586595;
    --cds-border-card: #8fdde3;
    --cds-border-input: #3e4778;
    --cds-nav-bg: #f0f1f6;
    --cds-nav-border: #5a6391;

    /* Gradients */
    --cds-gradient-teal: linear-gradient(135deg, #1B2A4A 0%, #2A3D66 100%);
    --cds-gradient-teal-tab: linear-gradient(135deg, #1B2A4A 0%, #253562 100%);
    --cds-gradient-teal-active: linear-gradient(135deg, #2A3D66 0%, #3a5080 100%);
    --cds-gradient-stat: linear-gradient(135deg, #1B2A4A 0%, #2A3D66 100%);

    /* Effects */
    --cds-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --cds-shadow-hover: 0 6px 20px rgba(0,0,0,0.13);
    --cds-shadow-nav: 0 -2px 10px rgba(16, 20, 48, 0.14);
    --cds-shadow-sidebar: 0 -12px 36px rgba(0, 0, 0, 0.26);
    --cds-radius: 12px;
    --cds-radius-lg: 20px;

    /* Layout */
    --cds-bottom-nav-height: 88px;
    --cds-header-height: 56px;
    --cds-sidebar-width: 260px;

    /* Typography */
    --cds-display-font: 'Bebas Neue', 'Nunito', sans-serif;
    --cds-body-font: 'Nunito', 'Segoe UI', sans-serif;
}

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

/* Mobile tap feedback */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--cds-body-font);
    background-color: var(--cds-body-bg);
    background-image:
        radial-gradient(1100px 520px at -10% 22%, rgba(70, 80, 135, 0.28) 0%, rgba(36, 42, 86, 0) 58%),
        radial-gradient(980px 460px at 112% 86%, rgba(41, 55, 118, 0.3) 0%, rgba(36, 42, 86, 0) 56%),
        repeating-radial-gradient(circle at 84% 28%, rgba(255,255,255,0.24) 0 2px, rgba(255,255,255,0) 2px 84px),
        linear-gradient(180deg, #2a2f61 0%, #252b58 54%, #252d5d 100%);
    color: var(--cds-text-light);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== Layout ===== */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    padding-bottom: calc(var(--cds-bottom-nav-height) + 16px);
}

.app-main {
    padding: 0 16px;
    padding-top: var(--cds-header-height);
}

/* ===== Header ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: var(--cds-header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    z-index: 100;
    background: transparent;
}

.app-header .header-logo {
    height: 28px;
}

.app-header .header-profile {
    position: absolute;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cds-navy-light);
    border: 2px solid var(--cds-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cds-text-light);
    font-size: 18px;
    cursor: pointer;
}

.app-header .header-menu {
    position: absolute;
    left: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--cds-teal);
    background: var(--cds-navy-light);
    color: var(--cds-text-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.app-header .header-menu svg {
    width: 18px;
    height: 18px;
}

.app-header .header-back {
    position: absolute;
    left: 58px;
    font-size: 14px;
    color: var(--cds-text-light);
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.app-header .header-back svg {
    width: 20px;
    height: 20px;
}

/* ===== Page Title ===== */
.page-title {
    font-family: var(--cds-display-font);
    font-size: 20px;
    line-height: 1;
    font-weight: 400;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.8px;
    margin: 10px 0 18px;
}

/* ===== Private Mode Banner ===== */
.private-mode-banner {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--cds-teal);
    color: var(--cds-white);
    text-align: center;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.private-mode-banner + .app-header {
    top: 32px;
}

.private-mode-banner ~ .app-container .app-main {
    padding-top: calc(var(--cds-header-height) + 32px);
}

/* ===== Greeting ===== */
.greeting {
    font-family: var(--cds-display-font);
    font-size: 56px;
    font-weight: 400;
    line-height: 0.92;
    margin: 16px 0 24px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ===== Cards ===== */
.card-cds {
    background: var(--cds-white);
    border-radius: 18px;
    padding: 20px;
    color: var(--cds-text-dark);
    box-shadow: var(--cds-shadow);
    margin-bottom: 16px;
    border: 2px solid var(--cds-border-card);
}

.card-cds:active,
.maintenance-card:active {
    transform: scale(0.97);
    opacity: 0.85;
    transition: transform 80ms ease-out, opacity 80ms ease-out;
}

.card-cds-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-cds-title {
    font-size: 14px;
    font-weight: 400;
    font-family: var(--cds-display-font);
    color: var(--cds-navy);
    letter-spacing: 0.3px;
}

.card-cds-arrow {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 2px solid var(--cds-border-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cds-navy-deep);
    cursor: pointer;
}

/* ===== Score Circle ===== */
.score-circle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 0;
}

.score-circle {
    position: relative;
    width: 120px;
    height: 120px;
}

.score-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-circle .track {
    fill: none;
    stroke: var(--cds-gray);
    stroke-width: 8;
}

.score-circle .fill {
    fill: none;
    stroke: var(--cds-navy);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}

.score-circle .score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 22px;
    font-weight: 800;
    color: var(--cds-navy);
}

.score-circle .score-value span {
    font-size: 13px;
    font-weight: 400;
    color: var(--cds-gray-text);
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 20px);
    max-width: 460px;
    min-height: 76px;
    background: var(--cds-nav-bg);
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    padding: 6px 2px;
    box-shadow: var(--cds-shadow-nav);
    z-index: 100;
    border-radius: 18px;
    border: 2px solid var(--cds-nav-border);
}

.bottom-nav-item {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: clamp(9px, 2.65vw, 12px);
    line-height: 1.15;
    text-align: center;
    color: var(--cds-navy-deep);
    padding: 6px 2px;
    border-radius: 14px;
    transition: color 0.2s;
    overflow-wrap: break-word;
}

.bottom-nav-item svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.bottom-nav-item.active {
    background: var(--cds-navy);
    color: var(--cds-text-light);
    font-weight: 700;
    border: none;
}

.bottom-nav-item.active svg {
    stroke: var(--cds-text-light);
}

/* ===== Toggle Switch ===== */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

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

.toggle-slider {
    position: absolute;
    inset: 0;
    background-color: #6f7b8f; /* toggle off state */
    border-radius: 26px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    transition: background-color 0.25s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 2px;
    top: 2px;
    background: var(--cds-white);
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(11, 19, 41, 0.35);
    transition: transform 0.25s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--cds-green-toggle);
    border-color: rgba(255, 255, 255, 0.6);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
    box-shadow: 0 1px 6px rgba(9, 84, 33, 0.35);
}

/* ===== Private Mode Bar (Dashboard bottom) ===== */
.private-mode-bar {
    position: fixed;
    bottom: calc(var(--cds-bottom-nav-height) + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 448px;
    background: var(--cds-teal);
    color: var(--cds-white);
    border-radius: 10px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 14px;
    z-index: 50;
    cursor: pointer;
}

.private-mode-bar.disabled {
    background: var(--cds-red);
}

/* ===== Buttons ===== */
.btn-cds {
    display: block;
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--cds-radius);
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-cds:hover {
    opacity: 0.9;
}

.btn-cds:active {
    transform: scale(0.98);
    transition: transform 60ms ease-out;
}

.btn-cds-primary {
    background: var(--cds-gradient-teal);
    color: var(--cds-white);
}

.btn-cds-dark {
    background: var(--cds-navy);
    color: var(--cds-white);
}

.btn-cds-outline {
    background: var(--cds-gray-light);
    color: var(--cds-navy);
    border: 2px solid var(--cds-border-accent);
}

/* ===== Form Inputs ===== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--cds-text-dark);
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--cds-border-input);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: var(--cds-white);
    color: var(--cds-text-dark);
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--cds-teal);
}

.form-input::placeholder {
    color: var(--cds-gray-text);
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    background: var(--cds-gradient-teal-tab);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 16px;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
    font-size: 13px;
    font-family: var(--cds-display-font);
    letter-spacing: 0.3px;
    font-weight: 700;
    color: rgba(255,255,255,0.7);
    border-radius: 22px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    background: var(--cds-surface-alt);
    color: var(--cds-navy-deep);
}

/* ===== Sub-tabs (Upcoming/Past) ===== */
.sub-tabs {
    display: flex;
    background: var(--cds-gray-light);
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 16px;
}

.sub-tab {
    flex: 1;
    text-align: center;
    padding: 8px;
    font-size: 13px;
    font-family: var(--cds-display-font);
    font-weight: 400;
    letter-spacing: 0.2px;
    color: var(--cds-gray-text);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.sub-tab.active {
    background: var(--cds-gray);
    color: var(--cds-navy-deep);
}

/* ===== Stat Cards ===== */
.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--cds-white);
    border-radius: 18px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: var(--cds-shadow);
    border: 2px solid var(--cds-border-card);
}

.stat-value {
    background: var(--cds-gradient-stat);
    color: var(--cds-white);
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 18px;
    font-weight: 800;
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
}

.stat-value small {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.stat-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--cds-text-dark);
}

/* ===== Period Navigator (arrows + month) ===== */
.period-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    color: var(--cds-text-light);
}

.period-nav-arrow {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--cds-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--cds-text-light);
    background: transparent;
}

.period-nav-label {
    font-size: 16px;
    font-weight: 700;
}

/* ===== Maintenance Card ===== */
.maintenance-card {
    background: var(--cds-white);
    border-radius: 18px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: var(--cds-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--cds-text-dark);
    cursor: pointer;
    border: 2px solid var(--cds-border-card);
}

.maintenance-card-info h4 {
    font-size: 16px;
    font-family: var(--cds-display-font);
    font-weight: 400;
    line-height: 1.02;
    margin-bottom: 4px;
}

.maintenance-card-info .date {
    font-size: 13px;
    color: var(--cds-gray-text);
    font-weight: 600;
}

.maintenance-card-info .place {
    font-size: 15px;
    color: var(--cds-gray-text);
}

/* ===== Chat ===== */
.chat-contact {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--cds-surface);
    border-radius: 18px;
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 2px solid var(--cds-border-card);
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--cds-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--cds-gray-text);
}

.chat-contact-info h4 {
    font-size: 18px;
    font-weight: 400;
    color: var(--cds-navy-deep);
    font-family: var(--cds-display-font);
}

.chat-contact-info p {
    font-size: 13px;
    font-family: inherit;
    color: var(--cds-gray-text);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 0;
    min-height: calc(100vh - 280px);
    justify-content: flex-end;
}

.chat-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
}

.chat-bubble.other {
    background: var(--cds-teal-chat);
    color: var(--cds-white);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-bubble.self {
    background: var(--cds-surface);
    color: var(--cds-text-dark);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-bubble-meta {
    font-size: 11px;
    color: var(--cds-gray-text);
    margin-top: 4px;
}

.chat-bubble-meta.other {
    text-align: left;
}

.chat-bubble-meta.self {
    text-align: right;
}

.chat-sender {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.chat-input-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--cds-nav-bg);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    z-index: 100;
}

.chat-input-bar .photo-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--cds-gray-text);
    cursor: pointer;
}

.chat-input-bar input {
    flex: 1;
    padding: 10px 16px;
    border: 1.5px solid var(--cds-border-input);
    border-radius: 25px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.chat-input-bar input:focus {
    border-color: var(--cds-teal);
}

/* ===== Bottom Sheet ===== */
.bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.bottom-sheet-overlay.open {
    opacity: 1;
    visibility: visible;
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 480px;
    background: var(--cds-white);
    border-top-left-radius: var(--cds-radius-lg);
    border-top-right-radius: var(--cds-radius-lg);
    z-index: 210;
    transition: transform 0.3s ease;
    max-height: 85vh;
    overflow-y: auto;
    color: var(--cds-text-dark);
}

.bottom-sheet.open {
    transform: translateX(-50%) translateY(0);
}

.bottom-sheet-handle {
    width: 48px;
    height: 5px;
    background: var(--cds-gray);
    border-radius: 3px;
    margin: 12px auto;
}

.bottom-sheet-content {
    padding: 8px 24px 32px;
}

.bottom-sheet-title {
    font-size: 18px;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    margin-bottom: 20px;
    color: var(--cds-navy);
}

/* ===== Period Item (Private Mode list) ===== */
.period-item {
    border: 2px solid var(--cds-gray);
    border-radius: var(--cds-radius);
    padding: 14px 16px;
    margin-bottom: 12px;
}

.period-item.active {
    border-color: var(--cds-teal);
}

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

.period-item-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--cds-text-dark);
}

.period-item-time {
    font-size: 13px;
    color: var(--cds-gray-text);
    margin-top: 2px;
}

.period-days {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.period-day {
    font-size: 11px;
    font-weight: 700;
    color: var(--cds-gray-text);
}

.period-day.active {
    color: var(--cds-teal);
}

/* ===== Vehicle Info ===== */
.vehicle-section {
    background: var(--cds-white);
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 16px;
    color: var(--cds-text-dark);
    box-shadow: var(--cds-shadow);
    border: 2px solid var(--cds-border-card);
}

.vehicle-section-title {
    font-size: 18px;
    font-family: var(--cds-display-font);
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.vehicle-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 17px;
}

.vehicle-detail-row .label {
    color: var(--cds-gray-text);
}

.vehicle-detail-row .value {
    font-weight: 600;
}

.vehicle-plate {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--cds-white);
    border: 2px solid var(--cds-navy);
    border-radius: 6px;
    padding: 4px 12px;
    margin-top: 12px;
}

.vehicle-plate .country {
    background: var(--cds-navy);
    color: var(--cds-white);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
}

.vehicle-plate .number {
    font-size: 16px;
    font-weight: 800;
    color: var(--cds-navy);
    letter-spacing: 1px;
}

/* ===== Document Row ===== */
.document-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--cds-gray-light);
    font-size: 14px;
    color: var(--cds-text-dark);
}

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

.document-row .doc-icon {
    color: var(--cds-teal);
    cursor: pointer;
}

/* ===== Map ===== */
.map-container {
    position: fixed;
    top: var(--cds-header-height);
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: calc(100vh - var(--cds-header-height) - var(--cds-bottom-nav-height));
    z-index: 1;
}

.map-address-bar {
    position: fixed;
    bottom: calc(var(--cds-bottom-nav-height) + 12px);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 448px;
    background: var(--cds-teal);
    color: var(--cds-white);
    border-radius: 14px;
    padding: 12px 20px;
    text-align: center;
    z-index: 50;
    box-shadow: 0 8px 16px rgba(9, 14, 42, 0.2);
}

.map-address-bar .map-date {
    font-size: 13px;
    font-weight: 700;
}

.map-address-bar .map-address {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 2px;
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.login-page .login-bg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    object-fit: cover;
    opacity: 0.3;
}

.login-logo {
    margin-bottom: 40px;
    z-index: 2;
}

.login-logo img {
    height: 60px;
}

.login-card {
    background: var(--cds-white);
    border-radius: 18px;
    padding: 32px 24px;
    width: 100%;
    max-width: 360px;
    z-index: 2;
    border: 2px solid var(--cds-border-accent);
}

.login-card h2 {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--cds-text-dark);
    margin-bottom: 24px;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--cds-gray-text);
    margin-bottom: 20px;
}

.login-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.login-forgot {
    text-align: center;
    margin-top: 16px;
}

.login-forgot a {
    color: var(--cds-navy);
    font-size: 14px;
    font-weight: 600;
    text-decoration: underline;
}

/* ===== Profile ===== */
.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--cds-gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
    color: var(--cds-gray-text);
}

.profile-name {
    text-align: center;
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--cds-navy);
    margin-bottom: 20px;
}

.profile-detail {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid var(--cds-gray-light);
}

.profile-detail .label {
    color: var(--cds-gray-text);
}

.profile-detail .value {
    font-weight: 600;
    color: var(--cds-text-dark);
}

/* ===== Flash Messages ===== */
.flash-container {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 448px;
    z-index: 300;
}

.flash-message {
    padding: 12px 16px;
    border-radius: var(--cds-radius);
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    animation: flash-in 0.3s ease;
}

.flash-message.success {
    background: var(--cds-green);
    color: var(--cds-white);
}

.flash-message.error {
    background: var(--cds-red);
    color: var(--cds-white);
}

/* ===== Sidebar ===== */
.app-sidebar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(102%);
    width: min(100%, 480px);
    max-height: 82vh;
    background: var(--cds-surface-alt);
    color: var(--cds-text-dark);
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    box-shadow: var(--cds-shadow-sidebar);
    padding: 28px 18px 22px;
    z-index: 230;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.28s ease;
}

.app-sidebar.open {
    transform: translateX(-50%) translateY(0);
}

.app-sidebar::before {
    content: "";
    width: 110px;
    height: 6px;
    border-radius: 999px;
    background: var(--cds-navy-deep);
    align-self: center;
    margin-bottom: 16px;
}

.sidebar-logo-link {
    display: block;
    margin-bottom: 18px;
    text-align: center;
}

.sidebar-logo {
    height: 30px;
    filter: brightness(0) saturate(100%) invert(18%) sepia(40%) saturate(905%) hue-rotate(196deg) brightness(90%) contrast(89%);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-nav-item {
    display: block;
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--cds-navy-deep);
    font-weight: 700;
    font-size: 15px;
    border: 1px solid var(--cds-gray);
    background: rgba(255, 255, 255, 0.65);
}

.sidebar-nav-item.active {
    background: var(--cds-gradient-teal-active);
    color: var(--cds-white);
    border-color: transparent;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 220;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

@keyframes flash-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Filters ===== */
.filters-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border: 1.5px solid var(--cds-gray);
    border-radius: var(--cds-radius);
    margin-bottom: 0;
    color: var(--cds-text-dark);
    background: var(--cds-white);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    user-select: none;
    transition: border-color 0.2s;
}

.filters-bar.filters-active {
    border-color: var(--cds-navy);
    color: var(--cds-navy);
}

.filters-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filters-active-badge {
    background: var(--cds-navy);
    color: var(--cds-white);
    font-size: 10px;
    font-weight: 800;
    border-radius: 9px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filters-panel {
    background: var(--cds-white);
    border: 1.5px solid var(--cds-navy);
    border-top: none;
    border-radius: 0 0 var(--cds-radius) var(--cds-radius);
    padding: 14px 16px 16px;
    margin-bottom: 16px;
    display: none;
    gap: 12px;
    flex-direction: column;
}

.filters-panel.open {
    display: flex;
}

.filters-panel .form-group {
    margin-bottom: 0;
}

.filter-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--cds-gray-text);
    margin-bottom: 5px;
}

.filter-input,
.filter-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--cds-border-input);
    border-radius: 8px;
    font-size: 14px;
    background: var(--cds-surface);
    color: var(--cds-text-dark);
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--cds-navy);
    box-shadow: 0 0 0 2px rgba(27, 42, 74, 0.1);
}

.filters-footer {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.filter-reset-btn {
    flex: 1;
    padding: 9px;
    border: 1.5px solid var(--cds-gray);
    border-radius: 8px;
    background: none;
    font-size: 13px;
    font-weight: 700;
    color: var(--cds-text-dark);
    cursor: pointer;
}

.filter-reset-btn:hover {
    border-color: var(--cds-navy);
    color: var(--cds-navy);
}

.maintenance-card--hidden {
    display: none !important;
}

.filters-empty-state {
    display: none;
    text-align: center;
    padding: 24px 0;
    color: var(--cds-gray-text);
}

.dashboard-grid,
.vehicle-grid,
.maintenance-grid,
.maintenance-detail-grid,
.driving-stats-grid,
.period-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.dashboard-grid .card-cds p {
    font-size: 16px;
    font-family: inherit;
}

.vehicle-tabs-row {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.messaging-layout {
    display: block;
}

.messaging-placeholder {
    display: none;
}

.chat-view {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.localize-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.private-mode-form {
    max-width: 760px;
}

.private-mode-form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

/* ===== Add Button (bottom) ===== */
.add-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    color: var(--cds-teal);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-top: 1px solid var(--cds-gray-light);
    margin-top: 8px;
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.text-teal { color: var(--cds-teal); }
.text-navy { color: var(--cds-navy); }
.text-gray { color: var(--cds-gray-text); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }
.card-block { display: block; }
.text-bold { font-weight: 600; }
.mb-0 { margin-bottom: 0; }
.empty-state { padding: 40px 20px; }
.flex-1 { flex: 1; }
.page-title-dark { color: var(--cds-navy); }
.section-heading { font-size: 16px; font-weight: 700; color: var(--cds-navy); margin-bottom: 12px; }
.btn-cds-sm { padding: 10px; font-size: 13px; }
.btn-cds-tab { padding: 10px; font-size: 14px; }
.form-group-inline { margin-bottom: 0; }
.repeat-label { flex: 1; }
.repeat-label input[type="radio"] { display: none; }
.vehicle-thumb { width: 120px; height: 80px; background: var(--cds-gray-light); border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.vehicle-hero { display: flex; align-items: center; gap: 16px; }
.signal-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 2px; }
.signal-dot.on { background: var(--cds-teal); }
.signal-dot.off { background: var(--cds-gray); }
.detail-meta { padding-left: 0; font-size: 13px; color: var(--cds-gray-text); margin-bottom: 8px; }
.comment-date { text-align: right; font-size: 12px; color: var(--cds-gray-text); }
.card-form { background: var(--cds-white); padding: 20px; border-radius: var(--cds-radius); color: var(--cds-text-dark); }
.days-row { display: flex; gap: 8px; margin-bottom: 20px; }
.flash-message.error { margin-bottom: 16px; }

/* ===== Entrance Animations ===== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.animate-in > * {
    opacity: 0;
    animation: fadeUp 0.4s ease forwards;
}
.animate-in > *:nth-child(1) { animation-delay: 0.04s; }
.animate-in > *:nth-child(2) { animation-delay: 0.1s; }
.animate-in > *:nth-child(3) { animation-delay: 0.16s; }
.animate-in > *:nth-child(4) { animation-delay: 0.22s; }
.animate-in > *:nth-child(5) { animation-delay: 0.28s; }
.animate-in > *:nth-child(6) { animation-delay: 0.34s; }

.greeting {
    animation: fadeIn 0.5s ease 0.06s both;
}

.score-circle .fill {
    animation: scoreReveal 0.8s ease 0.35s both;
}
@keyframes scoreReveal {
    from { stroke-dashoffset: 282.74; }
}

/* ===== Hover & Active States ===== */
.card-cds {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card-cds:hover {
    transform: translateY(-2px);
    box-shadow: var(--cds-shadow-hover);
}
.card-cds:active {
    transform: scale(0.97);
}

.maintenance-card {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.maintenance-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--cds-shadow-hover);
}

.chat-contact {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.chat-contact:hover {
    transform: translateY(-1px);
    box-shadow: var(--cds-shadow-hover);
}

.stat-card {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--cds-shadow-hover);
}

.bottom-nav-item {
    transition: color 0.2s, transform 0.15s ease;
}
.bottom-nav-item:active {
    transform: scale(0.92);
}

.sidebar-nav-item {
    transition: background 0.2s, color 0.2s, transform 0.15s;
}
.sidebar-nav-item:hover:not(.active) {
    background: rgba(255, 255, 255, 0.9);
}
.sidebar-nav-item:active {
    transform: scale(0.97);
}

.btn-cds {
    transition: opacity 0.2s, transform 0.12s ease;
}

.period-item {
    transition: border-color 0.2s, transform 0.15s ease;
}
.period-item:hover {
    transform: translateY(-1px);
}

.private-mode-bar {
    transition: background 0.25s ease, transform 0.15s ease;
}
.private-mode-bar:hover {
    transform: translateX(-50%) translateY(-1px);
}
.private-mode-bar:active {
    transform: translateX(-50%) scale(0.98);
}

/* ===== Focus Styles (Accessibility) ===== */
:focus-visible {
    outline: 2px solid var(--cds-teal);
    outline-offset: 2px;
}

.btn-cds:focus-visible {
    outline-offset: 3px;
}

.form-input:focus-visible {
    outline: none;
    border-color: var(--cds-teal);
    box-shadow: 0 0 0 3px rgba(27, 42, 74, 0.2);
}

.toggle-switch input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(27, 42, 74, 0.3);
}

.bottom-nav-item:focus-visible,
.sidebar-nav-item:focus-visible {
    outline-offset: -2px;
}

/* ===== Desktop / Tablet ===== */
@media (min-width: 992px) {
    .app-container {
        max-width: 480px;
        margin: 0 auto;
    }

    .app-main {
        max-width: none;
    }

    .app-header {
        left: 50%;
        transform: translateX(-50%);
        max-width: 480px;
        width: 100%;
    }

    .private-mode-bar {
        position: static;
        width: 100%;
        max-width: none;
        transform: none;
        margin-top: 8px;
    }

    .private-mode-bar:hover {
        transform: translateY(-1px);
    }

    .private-mode-bar:active {
        transform: scale(0.99);
    }

    .chat-input-bar {
        position: sticky;
        left: auto;
        bottom: 0;
        transform: none;
        width: 100%;
        max-width: none;
        border-radius: var(--cds-radius);
    }

    .map-container {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        max-width: none;
        height: calc(100vh - 180px);
        border-radius: var(--cds-radius);
        overflow: hidden;
    }

    .map-address-bar {
        position: static;
        width: 100%;
        max-width: none;
        transform: none;
        margin-top: 12px;
    }

    .dashboard-grid,
    .vehicle-grid,
    .maintenance-grid,
    .maintenance-detail-grid,
    .driving-stats-grid,
    .period-grid {
        grid-template-columns: 1fr;
    }

    .messaging-layout {
        display: block;
    }

    .messaging-placeholder {
        display: none;
    }
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: calc(var(--cds-header-height) + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 460px;
    padding: 0 12px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--cds-white);
    border-radius: var(--cds-radius);
    padding: 14px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    pointer-events: auto;
    animation: toastSlideIn 0.35s ease-out;
    cursor: pointer;
    transition: opacity 0.3s, transform 0.3s;
    border-left: 4px solid var(--cds-teal);
}

.toast.toast-removing {
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
}

.toast-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon.chat_message { background: rgba(27, 42, 74, 0.15); color: var(--cds-teal); }
.toast-icon.maintenance_reminder { background: rgba(243, 156, 18, 0.15); color: var(--cds-orange); }
.toast-icon.period_alert { background: rgba(27, 42, 74, 0.12); color: var(--cds-navy); }
.toast-icon.vehicle_status { background: rgba(46, 204, 113, 0.15); color: var(--cds-green); }

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 700;
    font-size: 13px;
    color: var(--cds-navy);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 12px;
    color: var(--cds-gray-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--cds-gray-text);
    font-size: 18px;
    line-height: 1;
}

.toast-close:hover { color: var(--cds-navy); }

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Notification badge on bottom nav */
.notification-badge {
    position: absolute;
    top: 4px;
    right: 50%;
    transform: translateX(16px);
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--cds-red);
    color: var(--cds-white);
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
}

.notification-badge:empty,
.notification-badge[data-count="0"] {
    display: none;
}

/* Notification bell in header */
.header-bell {
    position: relative;
    color: var(--cds-text-light);
    margin-right: 4px;
}

.header-bell .notification-badge {
    top: -4px;
    right: -6px;
    transform: none;
    min-width: 16px;
    height: 16px;
    font-size: 9px;
}

/* ===== Programmer un entretien (maintenance schedule form) ===== */
.maintenance-schedule-heading {
    font-family: var(--cds-body-font);
    font-size: 1.35rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.82);
    text-align: left;
    text-transform: none;
    letter-spacing: 0.02em;
    margin: 8px 0 16px;
}

.maintenance-schedule-form {
    background: var(--cds-white);
    border: 1.5px solid var(--cds-navy);
    border-radius: var(--cds-radius);
    padding: 20px 18px 22px;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.12);
    margin-bottom: 24px;
}

.maintenance-schedule-form .form-group {
    margin-bottom: 18px;
}

.maintenance-schedule-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
}

.maintenance-schedule-input,
.maintenance-schedule-select {
    background: #f9fafb !important;
    border: 1px solid #d1d5db !important;
    border-radius: 10px !important;
    color: #111827 !important;
    padding: 13px 14px !important;
    font-size: 15px !important;
}

.maintenance-schedule-input:focus,
.maintenance-schedule-select:focus {
    border-color: var(--cds-navy) !important;
    box-shadow: 0 0 0 3px rgba(27, 42, 74, 0.12);
}

.maintenance-schedule-textarea {
    min-height: 88px;
    resize: vertical;
}

.maintenance-schedule-btn-full {
    width: 100%;
    display: block;
    padding: 14px 16px;
    font-weight: 800;
    font-size: 15px;
    border-radius: 10px;
    margin-bottom: 18px;
}

.maintenance-schedule-submit {
    margin-bottom: 0;
    margin-top: 8px;
}

.maintenance-schedule-btn-muted {
    font-weight: 700;
    margin-bottom: 0;
}

.maintenance-new-place-panel {
    padding-top: 4px;
    margin-bottom: 18px;
    animation: maintenancePanelIn 0.28s ease-out;
}

.maintenance-new-place-panel--hidden {
    display: none !important;
}

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

.maintenance-file-drop {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 12px 14px;
    background: #f9fafb;
    border: 1px dashed #9ca3af;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.maintenance-file-drop:hover {
    border-color: var(--cds-navy);
    background: #f3f4f6;
}

.maintenance-file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.maintenance-file-text {
    font-size: 14px;
    color: #6b7280;
}

.mt-24 > a.btn-cds {
    display: block;
    text-align: center;
}

/* ===== View Transitions ===== */
@view-transition {
    navigation: auto;
}

@keyframes cds-slide-in-right {
    from { transform: translateX(24px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes cds-slide-out-right {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(24px); opacity: 0; }
}
@keyframes cds-fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}
@keyframes cds-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

::view-transition-old(root) {
    animation: 220ms ease-out both cds-fade-out;
}
::view-transition-new(root) {
    animation: 220ms ease-out both cds-slide-in-right;
}

html.is-back-transition::view-transition-old(root) {
    animation: 220ms ease-out both cds-slide-out-right;
}
html.is-back-transition::view-transition-new(root) {
    animation: 220ms ease-out both cds-fade-in;
}
