:root {
    --ink: #17202a;
    --muted: #667085;
    --line: #d9e1ea;
    --soft: #f5f7fa;
    --panel: rgba(255, 255, 255, .92);
    --panel-solid: #ffffff;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --accent: #f59e0b;
    --notify-success: #0f766e;
    --notify-warning: #f59e0b;
    --notify-danger: #dc2626;
    --notify-info: #2563eb;
}

.app-body {
    min-height: 100vh;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--app-bg-color) 88%, #fff), color-mix(in srgb, var(--app-bg-color) 96%, #fff)),
        radial-gradient(circle at 18% 8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 32%),
        radial-gradient(circle at 86% 2%, color-mix(in srgb, var(--brand) 15%, transparent), transparent 34%),
        var(--app-bg-image);
    background-size: cover, auto, auto, cover;
    background-attachment: fixed;
    background-position: center;
    color: var(--ink);
    font-family: var(--app-font, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

.app-body.theme-dark {
    color-scheme: dark;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, .10), rgba(0, 0, 0, .10)),
        var(--app-bg-image),
        #111;
    background-size: cover, cover, auto;
    background-attachment: fixed;
    background-position: center;
}

.app-body.is-login {
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--login-bg-color) 84%, #fff), color-mix(in srgb, var(--login-bg-color) 94%, #fff)),
        radial-gradient(circle at 20% 8%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 34%),
        radial-gradient(circle at 78% 10%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 36%),
        var(--app-bg-image);
    background-size: cover, auto, auto, cover;
    background-attachment: fixed;
    background-position: center;
}

.app-body.theme-dark.is-login {
    background:
        linear-gradient(180deg, rgba(0, 0, 0, .10), rgba(0, 0, 0, .10)),
        var(--app-bg-image),
        #111;
    background-size: cover, cover, auto;
    background-attachment: fixed;
    background-position: center;
}

.app-main {
    position: relative;
}

.topbar {
    position: relative;
    z-index: 1000;
    background: transparent;
    border: 0;
    padding: 1.5rem 0 0;
}

.app-header {
    position: relative;
    z-index: 1;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    backdrop-filter: blur(16px);
    box-shadow: 0 18px 45px rgba(15, 23, 42, .10);
}

.brand-mark {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
}

.brand-mark-lg {
    width: 84px;
    height: 84px;
    font-size: 1.6rem;
}

.brand-logo {
    width: 132px;
    height: 82px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: transparent;
    border: 0;
    overflow: hidden;
    padding: .25rem;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.logo-preview {
    width: 260px;
    max-width: 100%;
    aspect-ratio: 8 / 5;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(45deg, rgba(148, 163, 184, .18) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(148, 163, 184, .18) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, .18) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, .18) 75%);
    background-color: var(--panel-solid);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
    padding: .5rem;
}

.background-preview {
    width: 220px;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.visual-upload {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px dashed color-mix(in srgb, var(--brand) 35%, var(--line));
    border-radius: 8px;
    padding: 1rem;
    background: color-mix(in srgb, var(--brand) 5%, #fff);
}

.brand-preview {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
    background: linear-gradient(180deg, var(--panel-solid), color-mix(in srgb, var(--panel-solid) 92%, var(--brand)));
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
    backdrop-filter: blur(12px);
}

.login-wrap {
    min-height: 100vh;
}

.login-panel {
    overflow: hidden;
}

.login-brand {
    min-height: 132px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-brand img {
    max-width: 360px;
    max-height: 165px;
    object-fit: contain;
    object-position: center;
}

.forgot-link {
    color: var(--notify-danger);
    font-weight: 700;
    text-decoration: none;
}

.forgot-link:hover,
.forgot-link:focus {
    color: var(--notify-danger);
    text-decoration: underline;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .42rem;
    border-radius: 8px;
    font-weight: 700;
}

.btn-nav,
.btn-soft {
    --bs-btn-color: var(--ink);
    --bs-btn-bg: color-mix(in srgb, var(--panel-solid) 88%, transparent);
    --bs-btn-border-color: var(--line);
    --bs-btn-hover-color: var(--brand);
    --bs-btn-hover-bg: var(--panel-solid);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
}

.nav-actions {
    row-gap: .55rem;
}

.mobile-nav-menu {
    display: none;
}

.mobile-nav-menu[open]::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: rgba(0, 0, 0, .62);
    backdrop-filter: blur(3px);
}

.mobile-nav-menu summary {
    position: relative;
    z-index: 1003;
    width: 52px;
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0;
    background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
    color: var(--ink);
    font-size: 1.45rem;
    cursor: pointer;
    list-style: none;
}

.mobile-nav-menu summary::marker {
    content: "";
    display: none;
}

.mobile-nav-menu summary::-webkit-details-marker {
    display: none;
}

.mobile-nav-list {
    display: grid;
    position: absolute;
    left: 1rem;
    right: 1rem;
    top: calc(100% + .75rem);
    z-index: 1002;
    margin-top: 0;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 8px;
    background: #050505;
    box-shadow: 0 22px 52px rgba(0, 0, 0, .55);
    overflow: hidden;
    backdrop-filter: blur(14px);
}

.mobile-nav-list a {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 54px;
    padding: .9rem 1rem;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .14);
    border-radius: 0;
    background: transparent;
    color: #fff;
    font-weight: 800;
    text-decoration: none;
}

.mobile-nav-list a:last-child {
    border-bottom: 0;
}

.mobile-nav-list a:hover,
.mobile-nav-list a:focus {
    color: #fff;
    background: rgba(255, 255, 255, .08);
    text-decoration: none;
}

.mobile-nav-list i {
    width: 1.25rem;
    color: #fff;
    text-align: center;
}

.btn-nav {
    min-height: 46px;
    padding-inline: .85rem;
}

.metric-link {
    color: var(--ink);
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
    min-height: 118px;
}

.metric-link:hover {
    color: var(--ink);
    transform: translateY(-2px);
    border-color: var(--brand);
    box-shadow: 0 14px 34px rgba(20, 35, 55, 0.09);
}

.metric-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: color-mix(in srgb, var(--brand) 10%, #fff);
    color: var(--brand);
    font-size: 1.25rem;
}

.muted {
    color: var(--muted);
}

.btn-brand {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 24%, transparent);
}

.customer-whatsapp {
    color: inherit;
    font-weight: 700;
    text-decoration: none;
    text-underline-offset: 3px;
}

.customer-whatsapp:hover {
    color: #15803d;
    text-decoration: underline;
}

.wa-link {
    --bs-btn-color: #15803d;
    --bs-btn-border-color: #16a34a;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #16a34a;
    --bs-btn-hover-border-color: #16a34a;
    font-weight: 700;
}

.reminder-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
    background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: .32rem;
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    background: #eef6ff;
    color: var(--notify-info);
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid currentColor;
}

.status-pill.info {
    background: #eef6ff;
    color: var(--notify-info);
}

.status-pill.pending {
    background: #fff7ed;
    color: var(--notify-warning);
}

.status-pill.warning {
    background: #fff7ed;
    color: var(--notify-warning);
}

.status-pill.success {
    background: #ecfdf5;
    color: var(--notify-success);
}

.status-pill.danger {
    background: #fef2f2;
    color: var(--notify-danger);
}

.timeline {
    position: relative;
    padding-left: 1rem;
}

.timeline::before {
    content: "";
    position: absolute;
    top: 0.2rem;
    bottom: 0;
    left: 0;
    width: 2px;
    background: var(--line);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-solid);
}

.timeline-item::before {
    content: "";
    position: absolute;
    top: 0.35rem;
    left: -1.28rem;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 4px #fff;
}

.photo-thumb {
    width: 112px;
    height: 82px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.vehicle-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: linear-gradient(135deg, #eef2f7, #ffffff);
}

.vehicle-photo-preview {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.vehicle-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #eef2f7;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 700;
}

.health-bar {
    height: 10px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.health-fill {
    height: 100%;
    border-radius: inherit;
}

.health-fill.success {
    background: var(--notify-success);
}

.health-fill.warning {
    background: var(--notify-warning);
}

.health-fill.danger {
    background: var(--notify-danger);
}

.calendar-day {
    min-height: 110px;
    background: color-mix(in srgb, var(--panel-solid) 86%, transparent);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .75rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .75rem;
}

.calendar-item {
    border-left: 3px solid var(--brand);
    padding: .45rem .55rem;
    background: color-mix(in srgb, var(--panel-solid) 88%, var(--brand) 5%);
    border-radius: 6px;
    font-size: .82rem;
}

.filter-bar {
    background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .75rem;
}

.assistant-box {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
    padding: .85rem 1rem;
}

.assistant-box summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--brand);
}

.assistant-box p {
    margin-top: .85rem;
}

.state-change-box {
    border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--line));
    border-radius: 8px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 12%, var(--panel-solid)), var(--panel-solid));
    padding: 1rem;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.65);
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--ink);
}

.table thead th {
    color: var(--muted);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: 0;
    border-bottom-color: var(--line);
}

.table tbody tr {
    border-color: rgba(217, 225, 234, .75);
}

.form-control,
.form-select {
    border-radius: 8px;
    border-color: var(--line);
    background-color: var(--panel-solid);
    color: var(--ink);
}

.form-control::placeholder {
    color: var(--muted);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--brand) 16%, transparent);
}

.password-field {
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-solid);
    overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.password-field .form-control {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding-right: .75rem;
}

.password-field:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--brand) 16%, transparent);
}

.password-toggle {
    flex: 0 0 3rem;
    align-self: stretch;
    min-height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
}

.password-toggle:hover,
.password-toggle:focus {
    color: var(--brand);
    background: color-mix(in srgb, var(--brand) 10%, transparent);
}

.theme-dark .password-field {
    background: color-mix(in srgb, var(--panel-solid) 84%, transparent);
}

.theme-dark .password-toggle,
.theme-dark .password-toggle:hover,
.theme-dark .password-toggle:focus {
    color: #fff;
}

@media (max-width: 991px) {
    .calendar-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .app-header {
        padding: 1rem !important;
    }

    .header-row {
        align-items: center !important;
    }

    .brand-logo,
    .brand-mark {
        width: 86px;
        height: 58px;
    }

    .nav-actions-desktop {
        display: none !important;
    }

    .mobile-nav-menu {
        display: block;
        flex: 0 0 auto;
        margin-left: auto;
    }

    .mobile-nav-menu summary {
        margin-left: auto;
    }
}

@media (max-width: 575px) {
    .header-row {
        display: flex !important;
        align-items: center !important;
    }

    .mobile-nav-menu {
        margin-left: auto;
    }

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

    .visual-upload {
        flex-direction: column;
        align-items: stretch;
    }
}

.form-hint {
    font-size: .82rem;
    color: var(--muted);
}

.table > :not(caption) > * > * {
    vertical-align: middle;
}
