:root {
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: #1f2937;
    background: #f3f4f6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
}

button,
input,
textarea {
    font: inherit;
}

.topbar {
    padding: 18px 20px;
    background: #111827;
    color: white;
}

.topbar h1 {
    margin: 0;
    font-size: 1.5rem;
}

.version {
    margin-top: 4px;
    font-size: 0.85rem;
    color: #d1d5db;
}

.navigation {
    display: flex;
    gap: 4px;
    padding: 8px;
    overflow-x: auto;
    background: white;
    border-bottom: 1px solid #d1d5db;
}

.nav-button {
    flex: 1 0 auto;
    min-width: 90px;
    padding: 10px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.nav-button.active {
    background: #e5e7eb;
    font-weight: 600;
}

.container {
    width: min(100%, 1000px);
    margin: 0 auto;
    padding: 20px;
}

.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

.page-section h2 {
    margin-top: 0;
}

.card {
    padding: 18px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: white;
    box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
}

.vehicle-name {
    margin: 0 0 14px;
    font-size: 1.35rem;
}

.vehicle-details {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.detail {
    padding: 10px;
    border-radius: 8px;
    background: #f9fafb;
}

.detail-label {
    display: block;
    margin-bottom: 3px;
    font-size: 0.75rem;
    color: #6b7280;
}

.detail-value {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.vehicle-notes {
    margin-top: 14px;
    padding: 12px;
    border-radius: 8px;
    background: #f9fafb;
}

.vehicle-notes p {
    margin: 4px 0 0;
    white-space: pre-wrap;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.action-button {
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 600;
}

.action-button.primary {
    background: #1d4ed8;
    color: white;
}

.action-button.primary:hover {
    background: #1e40af;
}

.action-button.secondary {
    background: #e5e7eb;
    color: #1f2937;
}

.service-card {
    margin-top: 0;
}

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

.card-heading h3 {
    margin: 0 0 12px;
}

.service-alert {
    padding: 12px;
    margin-top: 8px;
    border-radius: 8px;
}

.service-alert.overdue {
    border: 1px solid #fecaca;
    background: #fef2f2;
}

.service-alert.approaching {
    border: 1px solid #fde68a;
    background: #fffbeb;
}

.service-alert-title {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
}

.status-badge {
    flex: 0 0 auto;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
}

.status-badge.overdue {
    background: #fee2e2;
    color: #991b1b;
}

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

.service-detail {
    margin: 6px 0 0;
    color: #4b5563;
    font-size: 0.9rem;
}

.message-box {
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
}

.message-box.success {
    background: #ecfdf5;
    color: #065f46;
}

.message-box.error {
    background: #fef2f2;
    color: #991b1b;
}

.dialog {
    width: min(92vw, 650px);
    padding: 0;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgb(0 0 0 / 25%);
}

.dialog::backdrop {
    background: rgb(0 0 0 / 45%);
}

.dialog form {
    padding: 20px;
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.dialog-header h2 {
    margin: 0;
}

.close-button {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: 1.6rem;
    line-height: 1;
}

.close-button:hover {
    background: #f3f4f6;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.9rem;
    font-weight: 600;
}

.form-grid input,
.form-grid textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
}

.form-grid input:focus,
.form-grid textarea:focus {
    outline: 2px solid #93c5fd;
    border-color: #2563eb;
}

.full-width {
    grid-column: 1 / -1;
}

.checkbox-label {
    flex-direction: row !important;
    align-items: center;
}

.checkbox-label input {
    width: auto;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.error {
    color: #b91c1c;
}

@media (max-width: 600px) {
    .container {
        padding: 14px;
    }

    .topbar {
        padding: 14px;
    }

    .navigation {
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .nav-button {
        min-width: auto;
        padding-inline: 12px;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: auto;
    }

    .dialog-actions {
        flex-direction: column-reverse;
    }

    .dialog-actions .action-button {
        width: 100%;
    }
}

/* Poznámka vozidla na Přehledu neroztahuje kartu */
.vehicle-notes {
    max-height: 100px;
    overflow-y: auto;
}

.vehicle-notes p {
    margin-right: 4px;
}

@media (max-width: 700px) {
    .vehicle-notes {
        max-height: 90px;
    }
}

/* Pevná výška poznámky - nesmí zvětšovat kartu vozidla */
.vehicle-notes {
    height: 70px;
    min-height: 70px;
    max-height: 70px;
    box-sizing: border-box;
    overflow-y: auto;
}

@media (max-width: 700px) {
    .vehicle-notes {
        height: 65px;
        min-height: 65px;
        max-height: 65px;
    }
}

/* === VEHICLE APP COLOR SYSTEM START === */
:root {
    /* Primární ovládací prvky */
    --color-primary: #1d4ed8;
    --color-primary-hover: #1e40af;

    /* Jízdy */
    --color-trip: #4f46e5;
    --color-trip-dark: #3730a3;
    --color-trip-soft: #eef2ff;
    --color-trip-border: #c7d2fe;

    /* Tankování */
    --color-fuel: #db2777;
    --color-fuel-dark: #9d174d;
    --color-fuel-soft: #fdf2f8;
    --color-fuel-border: #f9a8d4;

    /* Servis / servisní náklady */
    --color-service: #d97706;
    --color-service-dark: #92400e;
    --color-service-soft: #fffbeb;
    --color-service-border: #fde68a;

    /* Neutrální */
    --color-neutral: #64748b;
    --color-neutral-soft: #f8fafc;
    --color-neutral-border: #dbe1e8;

    /* Semafor */
    --status-ok: #16a34a;
    --status-ok-soft: #f0fdf4;
    --status-ok-border: #86efac;

    --status-warning: #d97706;
    --status-warning-soft: #fffbeb;
    --status-warning-border: #fcd34d;

    --status-danger: #dc2626;
    --status-danger-soft: #fef2f2;
    --status-danger-border: #fca5a5;

    --status-unknown: #64748b;
    --status-unknown-soft: #f8fafc;
    --status-unknown-border: #d1d5db;
}


/* Aktivní záložka podle typu evidence */

.nav-button[data-section="trips"].active {
    color: var(--color-trip-dark);
    background: var(--color-trip-soft);
    box-shadow:
        inset 0 -3px 0
        var(--color-trip);
}

.nav-button[data-section="fuel"].active {
    color: var(--color-fuel-dark);
    background: var(--color-fuel-soft);
    box-shadow:
        inset 0 -3px 0
        var(--color-fuel);
}

.nav-button[data-section="service"].active {
    color: var(--color-service-dark);
    background: var(--color-service-soft);
    box-shadow:
        inset 0 -3px 0
        var(--color-service);
}

.nav-button[data-section="statistics"].active {
    color: #1e3a8a;
    background: #eff6ff;
    box-shadow:
        inset 0 -3px 0
        var(--color-primary);
}
/* === VEHICLE APP COLOR SYSTEM END === */

/* === STRONG OVERDUE STATUS START === */

:root {
    --status-danger: #dc2626;
    --status-danger-soft: #fee2e2;
    --status-danger-border: #ef4444;
}

/* Přehled - servis po termínu */
.service-alert.overdue {
    border: 1px solid var(--status-danger-border);
    background: var(--status-danger-soft);
}

.status-badge.overdue {
    background: var(--status-danger);
    color: #ffffff;
}

/* Servis - stavová karta po termínu */
.service-status-card.overdue {
    border-color: var(--status-danger-border);
    background: var(--status-danger-soft);
}

.service-status-card.overdue
.service-status-summary {
    color: #991b1b;
}

/* === STRONG OVERDUE STATUS END === */
