body {
    background-color: #f4f6f9;
}

.mobile-topbar {
    background-color: #1f2937;
}

/* Bootstrap's .offcanvas-lg forces background-color:transparent!important at
   the lg+ breakpoint (so the offcanvas can sit inline without an overlay
   look) - it beats a plain rule here, so this needs !important too or the
   sidebar goes transparent (showing the page background) on desktop. */
.sidebar {
    background-color: #1f2937 !important;
}

/* Below the lg breakpoint the sidebar is a true Bootstrap offcanvas (its own
   fixed/full-height styling applies). At lg+ it becomes a normal flex child
   sitting next to <main> - without this it would stretch to match main's
   height (flexbox default) and push the logout button off past the visible
   viewport on any page taller than one screen. Sticky + its own scroll keeps
   it pinned to the viewport and internally scrollable if it ever overflows. */
@media (min-width: 992px) {
    .sidebar.offcanvas-lg {
        width: 240px;
        flex-shrink: 0;
        position: sticky !important;
        top: 0;
        height: 100vh !important;
        overflow-y: auto;
    }
}

.sidebar .nav-link.active {
    background-color: #0d6efd;
}

/* A flex item's default min-width is `auto`, which lets a wide table inside
   it force the whole page to overflow horizontally even with a
   .table-responsive wrapper. This lets it shrink to the flex row instead. */
.main-content {
    min-width: 0;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f4f6f9;
    padding: 1rem;
}

/* Dashboard shortcut/stat cards - a small accent-color system so each card
   type reads at a glance, plus hover lift + a staggered fade-in on load. */
:root {
    --accent-service: #2563eb;
    --accent-customer: #0d9488;
    --accent-vehicle: #ea580c;
    --accent-approval: #d97706;
    --accent-open: #0284c7;
    --accent-scheduled: #16a34a;
    --accent-employee: #7c3aed;
}

.icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.hover-lift {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.hover-lift:hover,
.hover-lift:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 0.75rem 1.5rem rgba(15, 23, 42, 0.12) !important;
}

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

.animate-in {
    animation: fade-in-up 0.4s ease both;
}

.animate-in:nth-child(1) { animation-delay: 0s; }
.animate-in:nth-child(2) { animation-delay: 0.06s; }
.animate-in:nth-child(3) { animation-delay: 0.12s; }
.animate-in:nth-child(4) { animation-delay: 0.18s; }

@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.35); }
    70% { box-shadow: 0 0 0 8px rgba(217, 119, 6, 0); }
    100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); }
}

.pulse-attention {
    animation: pulse-ring 2s ease-out infinite;
}

.list-group-item {
    transition: background-color 0.15s ease;
}

.list-group-item:has(a):hover {
    background-color: #f8fafc;
}

@media (prefers-reduced-motion: reduce) {
    .animate-in, .pulse-attention, .hover-lift {
        animation: none;
        transition: none;
    }
}

/* Tables - a branded dark header (matches the sidebar), a tinted hover/
   stripe instead of Bootstrap's default gray, and softer pill-shaped
   badges. Applies globally so every table (Customers/Vehicles/Services/
   Employees lists, detail-page sub-tables, the calendar grid) picks it up
   without touching each template. */
.table thead th {
    background-color: #1f2937;
    color: #fff;
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-bottom-width: 0;
    vertical-align: middle;
    white-space: nowrap;
}

.table thead th a.text-reset {
    color: #fff !important;
}

.table thead th a.text-reset:hover {
    color: #cbd5e1 !important;
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(37, 99, 235, 0.06);
}

.table > tbody > tr:nth-of-type(even) > * {
    background-color: rgba(148, 163, 184, 0.06);
}

.badge {
    border-radius: 50rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Whole-row navigation (paired with the click-delegation listener in
   templates/base.html) - cursor + a trailing chevron that's faint at rest
   and steps forward on hover, so it reads as "this row goes somewhere"
   rather than a plain data table. */
.clickable-row {
    cursor: pointer;
}

.clickable-row .row-chevron {
    color: #9aa4af;
    font-size: 1.15rem;
    transition: transform 0.15s ease, color 0.15s ease;
}

.clickable-row:hover .row-chevron {
    color: var(--accent-service);
    transform: translateX(3px);
}

@media (prefers-reduced-motion: reduce) {
    .clickable-row .row-chevron {
        transition: none;
    }
}

/* New-service wizard stepper (dashboard/services/partials/_wizard_stepper.html) */
.wizard-stepper {
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
}

.wizard-step-circle {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
    background-color: #e9ecef;
    color: #6c757d;
    border: 2px solid #e9ecef;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.wizard-step.active .wizard-step-circle {
    background-color: var(--accent-service);
    border-color: var(--accent-service);
    color: #fff;
}

.wizard-step.complete .wizard-step-circle {
    background-color: #fff;
    border-color: var(--accent-service);
    color: var(--accent-service);
}

.wizard-step-label {
    font-size: 0.8125rem;
    color: #6c757d;
    white-space: nowrap;
}

.wizard-step.active .wizard-step-label {
    color: #1f2937;
    font-weight: 600;
}

.wizard-step-line {
    flex: 1;
    height: 2px;
    min-width: 2rem;
    background-color: #e9ecef;
    margin: 0 0.5rem 1.4rem;
    transition: background-color 0.2s ease;
}

.wizard-step-line.complete {
    background-color: var(--accent-service);
}

/* Detail-page field grid - replaces the plain Bootstrap <dl class="row">
   two-column list on Customer/Vehicle/Service/Employee detail pages with
   labeled cards, so a long field list scans at a glance instead of reading
   like a form. */
.detail-card {
    border: none;
    overflow: hidden;
}

.detail-card .card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    padding: 1.1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.detail-card .card-header .icon-badge {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1rem;
    border-radius: 0.625rem;
}

.detail-card .card-header h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: #1f2937;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem 2rem;
    padding: 1.5rem;
}

.detail-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.detail-field--full {
    grid-column: 1 / -1;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
}

.detail-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
    word-break: break-word;
}

.detail-value.text-muted-value {
    color: #64748b;
    font-weight: 500;
}

.detail-value a {
    font-weight: 600;
    text-decoration: none;
}

.detail-value a:hover {
    text-decoration: underline;
}

@media (max-width: 575.98px) {
    .detail-grid {
        grid-template-columns: 1fr;
        gap: 1.1rem;
        padding: 1.25rem;
    }
}

/* Service workflow status colors (calendar/partials/_calendar.html) - one
   distinct hue per status in the pending -> in_progress ->
   completed/canceled -> archived lifecycle, shared between the calendar's
   event chips and its legend so the mapping only lives in one place. */
:root {
    --status-pending: #6b7280;
    --status-in-progress: #16a34a;
    --status-completed: #16a34a;
    --status-canceled: #dc2626;
    --status-archived: #64748b;
    --status-overdue: #f97316;
}

.status-chip[data-status="pending"], .legend-dot[data-status="pending"] { background-color: var(--status-pending); }
.status-chip[data-status="in_progress"], .legend-dot[data-status="in_progress"] { background-color: var(--status-in-progress); }
.status-chip[data-status="completed"], .legend-dot[data-status="completed"] { background-color: var(--status-completed); }
.status-chip[data-status="canceled"], .legend-dot[data-status="canceled"] { background-color: var(--status-canceled); }
.status-chip[data-status="archived"], .legend-dot[data-status="archived"] { background-color: var(--status-archived); }

.status-chip {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    text-decoration: none;
    transition: filter 0.15s ease;
}

.status-chip:hover {
    filter: brightness(0.92);
    color: inherit;
}

/* Flags an in_progress service whose scheduled_at + estimated_hours window
   has already passed - it's running longer than estimated. */
.status-chip-overdue {
    font-weight: 800;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--status-overdue);
}

.status-chip-overdue .bi-exclamation-triangle-fill {
    margin-right: 0.15rem;
}

.legend-dot-overdue {
    background-color: var(--status-overdue);
}

.calendar-legend {
    color: #475569;
}

.legend-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Calendar grid - each week is its own day-number row followed by zero or
   more "lane" rows of event bars (see views._calendar_event_lanes). A bar
   spanning several days is one <td colspan> rather than a chip repeated in
   each day cell, so the top/bottom borders between those rows are dropped
   to read as a single merged block, with a full border only reinstated on
   calendar-week-end - the last row of each week - to separate weeks. */
.calendar-table td {
    border-top: none;
    border-bottom: none;
}

.calendar-table tr.calendar-week-end td {
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}

.calendar-day-cell {
    padding: 0.3rem 0.4rem 0.1rem;
    text-align: center;
}

.calendar-event-cell {
    padding: 1px 3px;
    height: 1.5rem;
}

.calendar-event-cell .status-chip {
    font-size: 0.7rem;
    padding: 0.05rem 0.35rem;
}

.app-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    color: #94a3b8;
    font-size: 0.8125rem;
}

.app-footer img {
    border-radius: 0.2rem;
}
