/**
 * Field Visits Manager - Mobile-first CSS
 * Minimum viewport: 360px
 */

/* CRITICAL: Alpine.js x-cloak - must be first */
[x-cloak] { display: none !important; }

/* CSS Variables */
:root {
    --fvm-primary: #2563eb;
    --fvm-primary-hover: #1d4ed8;
    --fvm-success: #16a34a;
    --fvm-success-hover: #15803d;
    --fvm-warning: #f97316;
    --fvm-warning-hover: #ea580c;
    --fvm-danger: #dc2626;
    --fvm-danger-hover: #b91c1c;
    --fvm-secondary: #6b7280;
    --fvm-text: #1f2937;
    --fvm-text-muted: #6b7280;
    --fvm-bg: #f9fafb;
    --fvm-bg-card: #ffffff;
    --fvm-border: #e5e7eb;
    --fvm-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --fvm-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --fvm-radius: 0.5rem;
    --fvm-radius-sm: 0.375rem;
    --fvm-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--fvm-font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--fvm-text);
    background-color: var(--fvm-bg);
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.fvm-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.fvm-header {
    background: var(--fvm-primary);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.fvm-header__logo a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
}

.fvm-header__logo-img {
    height: 40px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    flex-shrink: 0;
}

.fvm-header__title {
    font-weight: 600;
    font-size: 1.125rem;
}

.fvm-nav {
    display: none;
    gap: 0.25rem;
    flex-wrap: wrap;
    align-items: center;
}

@media (min-width: 768px) {
    .fvm-nav {
        display: flex;
    }
}

.fvm-nav__link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 0.4rem 0.5rem;
    border-radius: var(--fvm-radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    transition: background-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.fvm-nav__link:hover,
.fvm-nav__link--active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.fvm-header__user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.fvm-header__username {
    display: none;
    font-size: 0.875rem;
}

@media (min-width: 640px) {
    .fvm-header__username {
        display: inline;
    }
}

.fvm-header__logout {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.25rem;
    transition: color 0.15s;
}

.fvm-header__logout:hover {
    color: white;
}

.fvm-main {
    flex: 1;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Page */
.fvm-page__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.fvm-page__title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.fvm-page__actions {
    display: flex;
    gap: 0.5rem;
}

.fvm-back-link {
    display: inline-block;
    color: var(--fvm-primary);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

/* Cards */
.fvm-card {
    background: var(--fvm-bg-card);
    border-radius: var(--fvm-radius);
    box-shadow: var(--fvm-shadow);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.fvm-card__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--fvm-border);
}

.fvm-card--danger {
    border: 1px solid var(--fvm-danger);
}

/* Forms */
.fvm-form-group {
    margin-bottom: 1rem;
}

.fvm-form-row {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .fvm-form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

.fvm-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--fvm-text);
}

.fvm-label--required::after {
    content: ' *';
    color: var(--fvm-danger);
}

.fvm-input,
.fvm-select,
.fvm-textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid var(--fvm-border);
    border-radius: var(--fvm-radius-sm);
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.fvm-input:focus,
.fvm-select:focus,
.fvm-textarea:focus {
    outline: none;
    border-color: var(--fvm-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.fvm-textarea {
    resize: vertical;
    min-height: 100px;
}

.fvm-form-help {
    font-size: 0.75rem;
    color: var(--fvm-text-muted);
    margin: 0.375rem 0 0;
}

.fvm-form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.fvm-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.fvm-checkbox input {
    width: 1.125rem;
    height: 1.125rem;
}

.fvm-checkbox--danger span {
    color: var(--fvm-danger);
}

/* Buttons */
.fvm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--fvm-radius-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s, transform 0.1s;
}

.fvm-btn:active {
    transform: scale(0.98);
}

.fvm-btn--primary {
    background: var(--fvm-primary);
    color: white;
}

.fvm-btn--primary:hover {
    background: var(--fvm-primary-hover);
}

.fvm-btn--success {
    background: var(--fvm-success);
    color: white;
}

.fvm-btn--success:hover {
    background: var(--fvm-success-hover);
}

.fvm-btn--danger {
    background: var(--fvm-danger);
    color: white;
}

.fvm-btn--danger:hover {
    background: var(--fvm-danger-hover);
}

.fvm-btn--warning {
    background: var(--fvm-warning);
    color: white;
}

.fvm-btn--warning:hover {
    background: var(--fvm-warning-hover);
}

.fvm-btn--outline {
    background: transparent;
    border: 1px solid var(--fvm-border);
    color: var(--fvm-text);
}

.fvm-btn--outline:hover {
    background: var(--fvm-bg);
}

.fvm-btn--danger.fvm-btn--outline {
    background: transparent;
    border-color: var(--fvm-danger);
    color: var(--fvm-danger);
}

.fvm-btn--danger.fvm-btn--outline:hover {
    background: var(--fvm-danger);
    color: white;
}

.fvm-btn--ghost {
    background: transparent;
    color: var(--fvm-text-muted);
    padding: 0.5rem;
}

.fvm-btn--ghost:hover {
    background: var(--fvm-bg);
    color: var(--fvm-text);
}

.fvm-btn--sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
}

.fvm-btn--xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.fvm-btn--lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.fvm-btn--block {
    width: 100%;
}

/* Badges */
.fvm-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    text-transform: capitalize;
}

.fvm-badge--sm {
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
}

.fvm-badge--scheduled {
    background: #dbeafe;
    color: var(--fvm-primary);
}

.fvm-badge--in_progress {
    background: #ffedd5;
    color: #9a3412;
}

.fvm-badge--done {
    background: #dcfce7;
    color: #166534;
}

.fvm-badge--cancelled {
    background: #f3f4f6;
    color: #4b5563;
}

.fvm-badge--missed {
    background: #fee2e2;
    color: #991b1b;
}

.fvm-badge--success {
    background: #dcfce7;
    color: #166534;
}

.fvm-badge--secondary {
    background: #f3f4f6;
    color: #4b5563;
}

.fvm-badge--warning {
    background: #fef3c7;
    color: #92400e;
}

.fvm-badge--danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Tags */
.fvm-tag {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 500;
    border-radius: 9999px;
}

/* Alerts */
.fvm-alert {
    padding: 0.875rem 1rem;
    border-radius: var(--fvm-radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.fvm-alert--success {
    background: #dcfce7;
    color: #166534;
}

.fvm-alert--error {
    background: #fee2e2;
    color: #991b1b;
}

.fvm-alert--warning {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

.fvm-alert--info {
    background: #dbeafe;
    color: var(--fvm-primary);
}

.fvm-alert__actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Filters */
.fvm-filters {
    background: var(--fvm-bg-card);
    border-radius: var(--fvm-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--fvm-shadow);
}

.fvm-filters__row {
    display: grid;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .fvm-filters__row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .fvm-filters__row {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Visit List */
.fvm-visit-group {
    margin-bottom: 1rem;
}

.fvm-visit-group__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-weight: 600;
    color: var(--fvm-text-muted);
    font-size: 0.875rem;
}

.fvm-visit-group__count {
    background: var(--fvm-border);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
}

.fvm-visit-card {
    background: var(--fvm-bg-card);
    border-radius: var(--fvm-radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--fvm-shadow);
    display: flex;
    gap: 1rem;
    border-left: 4px solid var(--fvm-primary);
}

.fvm-visit-card--in_progress {
    border-left-color: var(--fvm-warning);
}

.fvm-visit-card--done {
    border-left-color: var(--fvm-success);
    opacity: 0.7;
}

.fvm-visit-card--cancelled,
.fvm-visit-card--missed {
    border-left-color: var(--fvm-secondary);
    opacity: 0.6;
}

.fvm-visit-card__time {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--fvm-primary);
    min-width: 3rem;
}

.fvm-visit-card__content {
    flex: 1;
    min-width: 0;
}

.fvm-visit-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.fvm-visit-card__name {
    font-weight: 600;
    color: var(--fvm-text);
    text-decoration: none;
}

.fvm-visit-card__name:hover {
    color: var(--fvm-primary);
}

.fvm-visit-card__address {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--fvm-text-muted);
    margin-bottom: 0.5rem;
}

.fvm-visit-card__address svg {
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.fvm-visit-card__meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--fvm-text-muted);
}

.fvm-visit-card__actions {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    flex-shrink: 0;
}

@media (min-width: 640px) {
    .fvm-visit-card__actions {
        flex-direction: row;
    }
}

/* Patient Grid */
.fvm-patient-grid {
    display: grid;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .fvm-patient-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .fvm-patient-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.fvm-patient-card {
    background: var(--fvm-bg-card);
    border-radius: var(--fvm-radius);
    padding: 1rem;
    box-shadow: var(--fvm-shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s;
}

.fvm-patient-card:hover {
    box-shadow: var(--fvm-shadow-lg);
}

.fvm-patient-card__avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--fvm-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.fvm-patient-card__content {
    flex: 1;
    min-width: 0;
}

.fvm-patient-card__name {
    font-weight: 600;
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.fvm-patient-card__phone {
    font-size: 0.8125rem;
    color: var(--fvm-text-muted);
    margin: 0;
}

.fvm-patient-card__tags {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.fvm-patient-card__arrow {
    color: var(--fvm-text-muted);
    flex-shrink: 0;
}

/* Tables */
.fvm-table-wrap {
    overflow-x: auto;
    margin: -0.5rem;
    padding: 0.5rem;
}

.fvm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.fvm-table th,
.fvm-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--fvm-border);
}

.fvm-table th {
    font-weight: 600;
    background: var(--fvm-bg);
    position: sticky;
    top: 0;
}

.fvm-table__empty {
    text-align: center;
    color: var(--fvm-text-muted);
    padding: 2rem !important;
}

.fvm-table__cell--nowrap {
    white-space: nowrap;
}

/* Tasks */
.fvm-task-card {
    background: var(--fvm-bg-card);
    border-radius: var(--fvm-radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--fvm-shadow);
    display: flex;
    gap: 0.75rem;
}

.fvm-task-card--done {
    opacity: 0.6;
}

.fvm-task-card--done .fvm-task-card__title {
    text-decoration: line-through;
}

.fvm-task-card__toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--fvm-text-muted);
}

.fvm-task-card__toggle:hover {
    color: var(--fvm-success);
}

.fvm-task-card__done-icon {
    color: var(--fvm-success);
}

.fvm-task-card__content {
    flex: 1;
}

.fvm-task-card__title {
    font-weight: 600;
    margin: 0 0 0.25rem;
}

.fvm-task-card__desc {
    font-size: 0.8125rem;
    color: var(--fvm-text-muted);
    margin: 0 0 0.5rem;
}

.fvm-task-card__meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--fvm-text-muted);
}

/* Tabs */
.fvm-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--fvm-border);
    padding-bottom: 0.5rem;
}

.fvm-tabs__tab {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--fvm-text-muted);
    text-decoration: none;
    border-radius: var(--fvm-radius-sm);
}

.fvm-tabs__tab:hover {
    color: var(--fvm-text);
    background: var(--fvm-bg);
}

.fvm-tabs__tab--active {
    color: var(--fvm-primary);
    background: rgba(37, 99, 235, 0.1);
}

/* Pagination */
.fvm-pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
}

.fvm-pagination__link {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border-radius: var(--fvm-radius-sm);
    text-decoration: none;
    color: var(--fvm-text);
    background: transparent;
    border: 1px solid var(--fvm-border);
    cursor: pointer;
    font-family: inherit;
}

.fvm-pagination__link:hover {
    background: var(--fvm-bg);
}

.fvm-pagination__link--active {
    background: var(--fvm-primary);
    color: white;
    border-color: var(--fvm-primary);
}

/* Empty State */
.fvm-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--fvm-text-muted);
}

.fvm-empty__icon {
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Detail List */
.fvm-detail-list {
    margin: 0;
}

.fvm-detail-list__item {
    display: flex;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--fvm-border);
    gap: 0.5rem;
}

.fvm-detail-list__item:last-child {
    border-bottom: none;
}

.fvm-detail-list__item dt {
    font-weight: 500;
    color: var(--fvm-text-muted);
    min-width: 120px;
    max-width: 140px;
    flex-shrink: 0;
    font-size: 0.875rem;
}

.fvm-detail-list__item dd {
    margin: 0;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

/* Notes */
.fvm-notes {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.fvm-note {
    padding: 0.75rem;
    background: var(--fvm-bg);
    border-radius: var(--fvm-radius-sm);
    border-left: 3px solid var(--fvm-border);
}

.fvm-note--handover {
    border-left-color: var(--fvm-warning);
    background: #fff7ed;
}

.fvm-note__header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 0.375rem;
}

.fvm-note__type {
    font-weight: 600;
    text-transform: uppercase;
}

.fvm-note__meta {
    color: var(--fvm-text-muted);
}

.fvm-note__content {
    font-size: 0.875rem;
}

/* Actions */
.fvm-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

/* FAB */
.fvm-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: var(--fvm-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--fvm-shadow-lg);
    text-decoration: none;
    transition: transform 0.15s, background-color 0.15s;
    z-index: 50;
}

.fvm-fab:hover {
    transform: scale(1.05);
    background: var(--fvm-primary-hover);
}

/* Modal */
.fvm-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.fvm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.fvm-modal__content {
    position: relative;
    background: var(--fvm-bg-card);
    border-radius: var(--fvm-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--fvm-shadow-lg);
}

.fvm-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--fvm-border);
}

.fvm-modal__title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.fvm-modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--fvm-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.fvm-modal__body {
    padding: 1.25rem;
}

.fvm-modal__footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--fvm-border);
}

/* Search Form */
.fvm-search-form {
    margin-bottom: 1rem;
}

.fvm-search-form__input-wrap {
    position: relative;
}

.fvm-search-form__icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--fvm-text-muted);
}

.fvm-search-form__input {
    padding-left: 2.5rem;
}

/* Calendar */
.fvm-calendar {
    background: var(--fvm-bg-card);
    border-radius: var(--fvm-radius);
    padding: 1rem;
    box-shadow: var(--fvm-shadow);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* FullCalendar toolbar fixes */
.fvm-calendar .fc-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fvm-calendar .fc-toolbar-title {
    font-size: 1.25rem !important;
}

.fvm-calendar .fc-button {
    padding: 0.4rem 0.6rem !important;
    font-size: 0.8125rem !important;
}

/* Calendar mobile fixes */
@media (max-width: 768px) {
    .fvm-calendar {
        padding: 0.5rem;
        margin: 0 -0.5rem;
        border-radius: 0;
    }
    
    .fvm-page--calendar .fvm-page__header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .fvm-page--calendar .fvm-page__actions {
        display: flex;
        gap: 0.5rem;
    }
    
    .fvm-page--calendar .fvm-page__actions .fvm-btn {
        flex: 1;
        justify-content: center;
        font-size: 0.8125rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* FullCalendar toolbar mobile - stack vertically */
    .fvm-calendar .fc-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .fvm-calendar .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
    }
    
    .fvm-calendar .fc-toolbar-chunk:first-child {
        order: 2;
    }
    
    .fvm-calendar .fc-toolbar-chunk:nth-child(2) {
        order: 1;
    }
    
    .fvm-calendar .fc-toolbar-chunk:last-child {
        order: 3;
    }
    
    .fvm-calendar .fc-toolbar-title {
        font-size: 1.125rem !important;
        text-align: center;
        margin: 0 !important;
    }
    
    .fvm-calendar .fc-button {
        padding: 0.375rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
    
    .fvm-calendar .fc-button-group {
        flex-wrap: nowrap;
    }
    
    /* Day grid on mobile */
    .fvm-calendar .fc-daygrid-day-number {
        font-size: 0.75rem;
        padding: 0.25rem;
    }
    
    .fvm-calendar .fc-daygrid-event {
        font-size: 0.6875rem;
    }
    
    .fvm-calendar .fc-col-header-cell-cushion {
        font-size: 0.75rem;
        padding: 0.25rem;
    }
    
    /* Time grid on mobile */
    .fvm-calendar .fc-timegrid-slot-label {
        font-size: 0.6875rem;
    }
    
    .fvm-calendar .fc-timegrid-event {
        font-size: 0.6875rem;
    }
    
    /* List view on mobile */
    .fvm-calendar .fc-list-event-title {
        font-size: 0.8125rem;
    }
    
    .fvm-calendar .fc-list-event-time {
        font-size: 0.75rem;
    }
}

/* Audit */
.fvm-audit-detail {
    background: var(--fvm-bg);
    padding: 1rem !important;
}

.fvm-audit-detail__grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 768px) {
    .fvm-audit-detail__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.fvm-audit-detail__json {
    background: white;
    padding: 0.75rem;
    border-radius: var(--fvm-radius-sm);
    font-size: 0.75rem;
    overflow-x: auto;
    margin: 0.5rem 0 0;
}

.fvm-audit-detail__meta {
    margin-top: 0.75rem;
    color: var(--fvm-text-muted);
}

.fvm-code {
    font-family: monospace;
    background: var(--fvm-bg);
    padding: 0.125rem 0.375rem;
    border-radius: var(--fvm-radius-sm);
    font-size: 0.8125rem;
}

/* Login Page */
.fvm-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--fvm-primary) 0%, var(--fvm-primary-hover) 100%);
}

.fvm-auth-container {
    width: 100%;
    max-width: 400px;
}

.fvm-login {
    background: var(--fvm-bg-card);
    border-radius: var(--fvm-radius);
    padding: 2rem;
    box-shadow: var(--fvm-shadow-lg);
}

.fvm-login__header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.fvm-login__icon {
    color: var(--fvm-primary);
    margin-bottom: 0.5rem;
}

.fvm-login__title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.5rem 0 0 0;
}

.fvm-login__form {
    margin-bottom: 1rem;
}

.fvm-login__footer {
    text-align: center;
}

.fvm-login__link {
    color: var(--fvm-primary);
    text-decoration: none;
    font-size: 0.875rem;
}

.fvm-login__link:hover {
    text-decoration: underline;
}

/* Error Pages */
.fvm-error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.fvm-error {
    text-align: center;
}

.fvm-error__icon {
    color: var(--fvm-text-muted);
    margin-bottom: 1rem;
}

.fvm-error__title {
    font-size: 4rem;
    font-weight: 700;
    margin: 0;
    color: var(--fvm-text-muted);
}

.fvm-error__message {
    color: var(--fvm-text-muted);
    margin-bottom: 2rem;
}

.fvm-error__actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

/* Utility Classes */
.fvm-text--muted {
    color: var(--fvm-text-muted);
}

.fvm-text--danger {
    color: var(--fvm-danger);
}

.fvm-text--warning {
    color: var(--fvm-warning);
}

/* Toast Container */
.fvm-toast-container {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

@media (min-width: 640px) {
    .fvm-toast-container {
        left: auto;
        width: 320px;
    }
}

.fvm-toast {
    background: var(--fvm-text);
    color: white;
    padding: 0.875rem 1rem;
    border-radius: var(--fvm-radius-sm);
    box-shadow: var(--fvm-shadow-lg);
    pointer-events: auto;
    animation: fvm-toast-in 0.2s ease-out;
}

.fvm-toast--error {
    background: #dc2626;
}

.fvm-toast--success {
    background: #059669;
}

.fvm-toast--warning {
    background: #d97706;
}

@keyframes fvm-toast-in {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Inline alerts */
.fvm-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--fvm-radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.fvm-alert--error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.fvm-alert--success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.fvm-alert--warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.fvm-alert--info {
    background: #eff6ff;
    color: var(--fvm-primary);
    border: 1px solid #bfdbfe;
}

/* Button loading state */
.fvm-btn--loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.fvm-btn--loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: fvm-spin 0.6s linear infinite;
}

.fvm-btn--loading::after {
    border-color: white;
    border-right-color: transparent;
}

.fvm-btn--outline.fvm-btn--loading::after,
.fvm-btn--secondary.fvm-btn--loading::after {
    border-color: var(--fvm-primary);
    border-right-color: transparent;
}

@keyframes fvm-spin {
    to { transform: rotate(360deg); }
}

/* HTMX Loading Indicator */
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
}

.htmx-indicator {
    opacity: 0;
    transition: opacity 0.2s;
}

/* Alpine cloak */
[x-cloak] {
    display: none !important;
}

/* ================================
   Google Maps
   ================================ */

.fvm-map {
    width: 100%;
    height: 250px;
    border-radius: var(--fvm-radius);
    border: 1px solid var(--fvm-border);
    margin-bottom: 1rem;
    background-color: #e5e7eb;
}

.fvm-map-preview {
    width: 100%;
    height: 200px;
    border-radius: var(--fvm-radius);
    border: 1px solid var(--fvm-border);
    margin-top: 0.5rem;
    background-color: #e5e7eb;
}

.fvm-map-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fvm-map-actions .fvm-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.fvm-map-actions .fvm-btn svg {
    flex-shrink: 0;
}

/* Address autocomplete dropdown styling */
.pac-container {
    z-index: 10000 !important;
    font-family: var(--fvm-font);
    border-radius: var(--fvm-radius);
    border: 1px solid var(--fvm-border);
    box-shadow: var(--fvm-shadow-lg);
    margin-top: 4px;
}

.pac-item {
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.4;
    border-top: 1px solid var(--fvm-border);
    cursor: pointer;
}

.pac-item:first-child {
    border-top: none;
}

.pac-item:hover,
.pac-item-selected {
    background-color: #f3f4f6;
}

.pac-icon {
    margin-right: 0.5rem;
}

.pac-item-query {
    font-weight: 500;
    color: var(--fvm-text);
}

/* Responsive map height */
@media (min-width: 768px) {
    .fvm-map {
        height: 300px;
    }
    
    .fvm-map-preview {
        height: 250px;
    }
}

/* ================================
   Card Variants
   ================================ */

.fvm-card--highlight {
    border-left: 4px solid var(--fvm-warning);
    background-color: #fffbeb;
}

.fvm-card--highlight .fvm-card__title {
    color: var(--fvm-warning);
}

.fvm-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.fvm-card__header .fvm-card__title {
    margin-bottom: 0;
}

/* ================================
   Patient Notes
   ================================ */

.fvm-patient-notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.fvm-note--important {
    background: #fef3c7;
    border-radius: var(--fvm-radius-sm);
    padding: 0.75rem;
    border-left: 3px solid var(--fvm-warning);
}

.fvm-note--important .fvm-note__content {
    margin-bottom: 0.5rem;
    color: var(--fvm-text);
}

.fvm-note--important .fvm-note__meta {
    font-size: 0.75rem;
    color: var(--fvm-text-muted);
}

.fvm-note-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--fvm-border);
}

/* ================================
   Emergency Contact Styles
   ================================ */

.fvm-detail-list__item--emergency {
    background: #fef2f2;
    margin: 0.5rem -1rem;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--fvm-danger);
}

.fvm-text--warning {
    color: var(--fvm-warning) !important;
}

/* ================================
   Header Actions & Language Switch
   ================================ */

.fvm-header__actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.fvm-lang-switch {
    position: relative;
}

.fvm-lang-switch__btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.5rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--fvm-radius-sm);
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.fvm-lang-switch__btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.fvm-lang-switch__menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.25rem;
    background: white;
    border-radius: var(--fvm-radius);
    box-shadow: var(--fvm-shadow-lg);
    min-width: 140px;
    z-index: 100;
    overflow: hidden;
}

.fvm-lang-switch__item {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--fvm-text);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s;
}

.fvm-lang-switch__item:hover {
    background: var(--fvm-bg);
}

.fvm-lang-switch__item--active {
    background: var(--fvm-primary-light);
    color: var(--fvm-primary);
    font-weight: 500;
}

/* ================================
   Login Page Enhancements
   ================================ */

.fvm-login__logo {
    max-width: 280px;
    max-height: 120px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

.fvm-login__subtitle {
    color: var(--fvm-text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.fvm-login__instructions {
    background: var(--fvm-bg);
    border-radius: var(--fvm-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: var(--fvm-text-muted);
    line-height: 1.5;
}

.fvm-login__help {
    color: var(--fvm-text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    text-align: center;
    line-height: 1.5;
}

.fvm-login__divider {
    color: var(--fvm-border);
    margin: 0 0.5rem;
}

.fvm-login__language {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
}

.fvm-login__language a {
    color: var(--fvm-text-muted);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--fvm-radius-sm);
    transition: all 0.15s;
}

.fvm-login__language a:hover {
    color: var(--fvm-primary);
    background: var(--fvm-primary-light);
}

.fvm-login__language a.active {
    color: var(--fvm-primary);
    font-weight: 500;
}

/* ================================
   Audit Detail Fix
   ================================ */

.fvm-audit-detail {
    background: var(--fvm-bg);
    padding: 1rem !important;
}

.fvm-audit-detail__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .fvm-audit-detail__grid {
        grid-template-columns: 1fr;
    }
}

.fvm-audit-detail__col strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--fvm-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.fvm-audit-detail__json {
    background: white;
    border: 1px solid var(--fvm-border);
    border-radius: var(--fvm-radius-sm);
    padding: 0.75rem;
    font-size: 0.75rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.fvm-audit-detail__meta {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--fvm-border);
    color: var(--fvm-text-muted);
}

/* ================================
   Alpine.js Cloak
   ================================ */

[x-cloak] {
    display: none !important;
}

/* ================================
   Dashboard Styles
   ================================ */

.fvm-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.fvm-stat-card {
    background: white;
    border-radius: var(--fvm-radius);
    box-shadow: var(--fvm-shadow);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.fvm-stat-card__icon--primary {
    background: var(--fvm-primary-light);
    color: var(--fvm-primary);
}

.fvm-stat-card__icon--success {
    background: #dcfce7;
    color: var(--fvm-success);
}

.fvm-stat-card__icon--warning {
    background: #fef3c7;
    color: var(--fvm-warning);
}

.fvm-stat-card__icon--info {
    background: #dbeafe;
    color: #3b82f6;
}

.fvm-stat-card__value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--fvm-text);
    line-height: 1;
}

.fvm-stat-card__label {
    font-size: 0.875rem;
    color: var(--fvm-text-muted);
    margin-top: 0.25rem;
}

.fvm-dashboard-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.fvm-dashboard-card {
    padding: 1.25rem;
}

.fvm-status-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

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

.fvm-status-item__label {
    color: var(--fvm-text-muted);
}

.fvm-rates-summary {
    display: flex;
    gap: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--fvm-border);
}

.fvm-rate-item {
    text-align: center;
}

.fvm-rate-item__value {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

.fvm-rate-item__label {
    font-size: 0.75rem;
    color: var(--fvm-text-muted);
}

.fvm-staff-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.fvm-staff-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--fvm-border);
}

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

.fvm-staff-item__stats {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.fvm-quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    text-align: center;
}

.fvm-quick-stat__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--fvm-primary);
    display: block;
}

.fvm-quick-stat__label {
    font-size: 0.75rem;
    color: var(--fvm-text-muted);
}

.fvm-recent-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fvm-recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--fvm-bg);
    border-radius: var(--fvm-radius-sm);
    text-decoration: none;
    color: var(--fvm-text);
    transition: background 0.15s;
}

.fvm-recent-item:hover {
    background: var(--fvm-primary-light);
}

.fvm-recent-item__time {
    font-size: 0.75rem;
    color: var(--fvm-text-muted);
}

/* Color utilities */
.fvm-text--success {
    color: var(--fvm-success) !important;
}

.fvm-text--danger {
    color: var(--fvm-danger) !important;
}

.fvm-text--info {
    color: #3b82f6 !important;
}

/* ================================
   Mobile Navigation
   ================================ */

.fvm-header__left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.fvm-header__menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: var(--fvm-radius-sm);
    transition: background 0.15s;
}

.fvm-header__menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

@media (min-width: 769px) {
    .fvm-header__menu-toggle {
        display: none;
    }
}

.fvm-nav--desktop {
    display: none;
}

@media (min-width: 769px) {
    .fvm-nav--desktop {
        display: flex;
    }
}

.fvm-mobile-nav {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.fvm-mobile-nav--open {
    opacity: 1;
    visibility: visible;
}

.fvm-mobile-nav__content {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 85%;
    height: 100%;
    background: white;
    padding: 1rem 0;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    box-shadow: var(--fvm-shadow-lg);
}

.fvm-mobile-nav--open .fvm-mobile-nav__content {
    transform: translateX(0);
}

.fvm-mobile-nav__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    color: var(--fvm-text);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.fvm-mobile-nav__link:hover {
    background: var(--fvm-bg);
}

.fvm-mobile-nav__link--active {
    background: var(--fvm-primary-light);
    color: var(--fvm-primary);
}

.fvm-mobile-nav__link--danger {
    color: var(--fvm-danger);
}

.fvm-mobile-nav__link--danger:hover {
    background: #fef2f2;
}

.fvm-mobile-nav__link svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.fvm-mobile-nav__divider {
    height: 1px;
    background: var(--fvm-border);
    margin: 0.75rem 1rem;
}

/* Adjust header for mobile */
@media (max-width: 768px) {
    .fvm-header {
        padding: 0 0.75rem;
    }
    
    .fvm-header__username {
        display: none;
    }
    
    .fvm-header__title {
        font-size: 0.9rem;
    }
    
    .fvm-header__logo-img {
        height: 32px;
        max-width: 120px;
    }
    
    .fvm-main {
        padding: 1rem;
    }
    
    .fvm-page__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .fvm-page__actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .fvm-form-row {
        flex-direction: column;
    }
    
    .fvm-dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .fvm-stat-card {
        padding: 1rem;
    }
    
    .fvm-stat-card__value {
        font-size: 1.25rem;
    }
    
    .fvm-dashboard-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .fvm-header__title {
        font-size: 0.8rem;
    }
    
    .fvm-header__logo-img {
        height: 28px;
        max-width: 36px;
    }
    
    .fvm-dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .fvm-card {
        padding: 1rem;
    }
}

/* ================================
   Modal Styles
   ================================ */

.fvm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.fvm-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.fvm-modal__dialog {
    position: relative;
    background: white;
    border-radius: var(--fvm-radius);
    box-shadow: var(--fvm-shadow-lg);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    animation: fvm-modal-in 0.2s ease-out;
}

@keyframes fvm-modal-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fvm-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--fvm-border);
}

.fvm-modal__title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.fvm-modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--fvm-text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--fvm-radius-sm);
}

.fvm-modal__close:hover {
    background: var(--fvm-bg);
    color: var(--fvm-text);
}

.fvm-modal__body {
    padding: 1.25rem;
}

.fvm-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--fvm-border);
}

.fvm-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--fvm-border);
    border-radius: var(--fvm-radius-sm);
    font-size: 0.9375rem;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

.fvm-textarea:focus {
    outline: none;
    border-color: var(--fvm-primary);
    box-shadow: 0 0 0 3px var(--fvm-primary-light);
}

.fvm-required {
    color: var(--fvm-danger);
}

.fvm-visit-card__vehicle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--fvm-text-muted);
    font-size: 0.8125rem;
}

.fvm-visit-card__km {
    margin-top: 0.25rem;
    color: var(--fvm-text-muted);
    font-size: 0.75rem;
}

/* ================================
   Modal Styles
   ================================ */

.fvm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.fvm-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.fvm-modal__dialog {
    position: relative;
    background: white;
    border-radius: var(--fvm-radius);
    box-shadow: var(--fvm-shadow-lg);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.fvm-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--fvm-border);
}

.fvm-modal__title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.fvm-modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--fvm-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.fvm-modal__close:hover {
    color: var(--fvm-text);
}

.fvm-modal__body {
    padding: 1.25rem;
    overflow-y: auto;
}

.fvm-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--fvm-border);
    background: var(--fvm-bg);
}

.fvm-textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.9375rem;
    font-family: inherit;
    border: 1px solid var(--fvm-border);
    border-radius: var(--fvm-radius-sm);
    background: white;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.fvm-textarea:focus {
    outline: none;
    border-color: var(--fvm-primary);
    box-shadow: 0 0 0 3px var(--fvm-primary-light);
}

.fvm-required {
    color: var(--fvm-danger);
}

/* Visit Card KM display */
.fvm-visit-card__km {
    margin-top: 0.25rem;
    color: var(--fvm-text-muted);
    font-size: 0.75rem;
}

/* Visit Detail KM Section */
.fvm-visit-km {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem;
    background: var(--fvm-bg);
    border-radius: var(--fvm-radius-sm);
    margin-bottom: 1rem;
}

.fvm-visit-km__item {
    display: flex;
    flex-direction: column;
}

.fvm-visit-km__label {
    font-size: 0.75rem;
    color: var(--fvm-text-muted);
    text-transform: uppercase;
}

.fvm-visit-km__value {
    font-size: 1.125rem;
    font-weight: 600;
}

.fvm-visit-km__diff {
    color: var(--fvm-primary);
}

/* Visit Notes Full Width */
.fvm-detail-list__item--full {
    grid-column: 1 / -1;
}

.fvm-visit-notes-content {
    padding: 0.75rem;
    background: var(--fvm-bg);
    border-radius: var(--fvm-radius-sm);
    border-left: 3px solid var(--fvm-primary);
    white-space: pre-wrap;
}

/* Visit Notes Styling */
.fvm-detail-list__item--full {
    flex-basis: 100%;
}

.fvm-detail-list__item--full dt {
    margin-bottom: 0.5rem;
}

.fvm-visit-notes-content {
    background: var(--fvm-bg);
    padding: 0.75rem;
    border-radius: var(--fvm-radius-sm);
    border-left: 3px solid var(--fvm-primary);
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* ================================
   Modal Styles
   ================================ */

.fvm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.fvm-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.fvm-modal__content {
    position: relative;
    background: white;
    border-radius: var(--fvm-radius-lg);
    box-shadow: var(--fvm-shadow-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}

.fvm-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--fvm-border);
}

.fvm-modal__title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.fvm-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--fvm-text-muted);
    cursor: pointer;
    border-radius: var(--fvm-radius-sm);
    transition: background 0.15s, color 0.15s;
}

.fvm-modal__close:hover {
    background: var(--fvm-bg);
    color: var(--fvm-text);
}

.fvm-modal__body {
    padding: 1.25rem;
}

.fvm-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--fvm-border);
}

.fvm-location-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--fvm-bg);
    border-radius: var(--fvm-radius);
    font-size: 0.875rem;
    color: var(--fvm-text-muted);
}

.fvm-spinner {
    animation: fvm-spin 1s linear infinite;
}

@keyframes fvm-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.fvm-form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--fvm-text-muted);
}

.fvm-textarea {
    display: block;
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--fvm-text);
    background: white;
    border: 1px solid var(--fvm-border);
    border-radius: var(--fvm-radius);
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.fvm-textarea:focus {
    outline: none;
    border-color: var(--fvm-primary);
    box-shadow: 0 0 0 3px var(--fvm-primary-light);
}

.fvm-visit-card__km {
    margin-top: 0.25rem;
    color: var(--fvm-text-muted);
}

/* Additional mobile fixes */
@media (max-width: 480px) {
    .fvm-modal__content {
        max-height: 85vh;
    }
    
    .fvm-modal__footer {
        flex-direction: column;
    }
    
    .fvm-modal__footer .fvm-btn {
        width: 100%;
    }
}

/* ================================
   Vehicle Logs Styles
   ================================ */

.fvm-log-form {
    padding: 1rem;
    background: var(--fvm-bg);
    border-radius: var(--fvm-radius-sm);
    margin-bottom: 1rem;
}

.fvm-form-row--inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-end;
}

.fvm-form-group--type {
    flex: 0 0 auto;
    width: 120px;
}

.fvm-form-group--content {
    flex: 1 1 200px;
}

.fvm-form-group--km {
    flex: 0 0 auto;
    width: 100px;
}

@media (max-width: 600px) {
    .fvm-form-row--inline {
        flex-direction: column;
    }
    
    .fvm-form-group--type,
    .fvm-form-group--content,
    .fvm-form-group--km {
        width: 100%;
    }
}

.fvm-log-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.fvm-log-item {
    padding: 0.75rem;
    background: white;
    border: 1px solid var(--fvm-border);
    border-radius: var(--fvm-radius-sm);
    border-left: 3px solid var(--fvm-border);
}

.fvm-log-item--note {
    border-left-color: var(--fvm-info);
}

.fvm-log-item--issue {
    border-left-color: var(--fvm-danger);
    background: rgba(239, 68, 68, 0.03);
}

.fvm-log-item--warning {
    border-left-color: var(--fvm-warning);
    background: rgba(245, 158, 11, 0.03);
}

.fvm-log-item--service {
    border-left-color: var(--fvm-success);
    background: rgba(34, 197, 94, 0.03);
}

.fvm-log-item--resolved {
    opacity: 0.7;
    border-left-color: var(--fvm-text-muted);
    background: var(--fvm-bg);
}

.fvm-log-item__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.fvm-log-item__meta {
    font-size: 0.75rem;
    color: var(--fvm-text-muted);
}

.fvm-log-item__content {
    font-size: 0.9375rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.fvm-log-item__resolved {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.fvm-log-item__actions {
    display: flex;
    gap: 0.5rem;
}

/* Table row highlighting */
.fvm-table__row--danger {
    background-color: rgba(239, 68, 68, 0.08);
}

.fvm-table__row--warning {
    background-color: rgba(245, 158, 11, 0.08);
}

/* Card section styling */
.fvm-card__section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--fvm-border);
}

.fvm-card__subtitle {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--fvm-text-muted);
    text-transform: uppercase;
    margin: 0 0 0.75rem;
}

.fvm-card__header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Link styles */
.fvm-link {
    color: var(--fvm-primary);
    text-decoration: none;
}

.fvm-link:hover {
    text-decoration: underline;
}

.fvm-link--strong {
    font-weight: 600;
}

/* Modal large variant */
.fvm-modal__content--lg {
    max-width: 600px;
}

/* ================================
   Improved Mobile UI
   ================================ */

/* Ensure hamburger is always visible on mobile */
@media (max-width: 768px) {
    .fvm-header__menu-toggle {
        display: flex !important;
    }
    
    .fvm-nav--desktop {
        display: none !important;
    }
    
    .fvm-header__username {
        display: none;
    }
    
    .fvm-header__title {
        font-size: 0.875rem;
    }
    
    .fvm-page__header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .fvm-page__title {
        font-size: 1.25rem;
    }
    
    .fvm-page__actions {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    /* Better tables on mobile */
    .fvm-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .fvm-table {
        font-size: 0.8125rem;
    }
    
    .fvm-table th,
    .fvm-table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    /* Filters on mobile */
    .fvm-filters {
        padding: 0.75rem;
    }
    
    .fvm-filters__row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    /* Cards on mobile */
    .fvm-card {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .fvm-card__title {
        font-size: 1rem;
    }
    
    /* Dashboard grid on mobile */
    .fvm-dashboard-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .fvm-stat-card {
        padding: 0.75rem;
    }
    
    .fvm-stat-card__value {
        font-size: 1.25rem;
    }
    
    .fvm-stat-card__label {
        font-size: 0.6875rem;
    }
    
    .fvm-stat-card__icon {
        width: 32px;
        height: 32px;
    }
    
    .fvm-stat-card__icon svg {
        width: 18px;
        height: 18px;
    }
    
    /* Dashboard rows */
    .fvm-dashboard-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    /* Form improvements */
    .fvm-form-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .fvm-btn {
        padding: 0.625rem 1rem;
    }
    
    .fvm-btn--sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    /* FAB positioning */
    .fvm-fab {
        bottom: 1rem;
        right: 1rem;
        width: 52px;
        height: 52px;
    }
    
    /* Modal on mobile */
    .fvm-modal__content {
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }
    
    .fvm-modal__body {
        padding: 1rem;
    }
    
    /* Visit card improvements */
    .fvm-visit-card {
        padding: 0.75rem;
    }
    
    .fvm-visit-card__actions {
        flex-wrap: wrap;
        gap: 0.375rem;
    }
    
    /* Detail list on mobile */
    .fvm-detail-list {
        grid-template-columns: 1fr;
    }
    
    .fvm-detail-list__item {
        flex-direction: column;
        gap: 0.2rem;
    }
    
    .fvm-detail-list__item dt {
        font-size: 0.75rem;
        min-width: 0;
        max-width: none;
    }
    
    .fvm-detail-list__item dd {
        font-size: 0.9rem;
    }
}

/* Very small screens */
@media (max-width: 400px) {
    .fvm-header {
        padding: 0 0.5rem;
    }
    
    .fvm-header__logo-img {
        max-height: 32px;
        max-width: 120px;
    }
    
    .fvm-main {
        padding: 0.75rem;
    }
    
    .fvm-dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .fvm-stat-card {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }
    
    .fvm-stat-card__icon {
        margin-bottom: 0;
    }
}

/* Touch-friendly buttons */
@media (pointer: coarse) {
    .fvm-btn {
        min-height: 44px;
    }
    
    .fvm-input,
    .fvm-select,
    .fvm-textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    .fvm-checkbox span,
    .fvm-radio span {
        padding-left: 2rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .fvm-mobile-nav__link {
        min-height: 48px;
    }
}

/* Language switch in login */
.fvm-login__language {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.875rem;
}

.fvm-login__language a {
    color: var(--fvm-text-muted);
    text-decoration: none;
    padding: 0.5rem;
}

.fvm-login__language a:hover,
.fvm-login__language a.active {
    color: var(--fvm-primary);
}

/* Bottom navigation bar for mobile (optional enhancement) */
.fvm-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .fvm-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid var(--fvm-border);
        padding: 0.5rem;
        justify-content: space-around;
        z-index: 100;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    
    .fvm-bottom-nav__item {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0.5rem;
        color: var(--fvm-text-muted);
        text-decoration: none;
        font-size: 0.625rem;
        min-width: 60px;
    }
    
    .fvm-bottom-nav__item--active {
        color: var(--fvm-primary);
    }
    
    .fvm-bottom-nav__item svg {
        margin-bottom: 0.25rem;
    }
    
    /* Add padding to main content to account for bottom nav */
    .fvm-main {
        padding-bottom: 70px;
    }
}

/* Spinner animation */
@keyframes fvm-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.fvm-spinner {
    animation: fvm-spin 1s linear infinite;
}

/* Location status */
.fvm-location-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--fvm-text-muted);
    padding: 0.5rem;
    background: var(--fvm-bg);
    border-radius: var(--fvm-radius-sm);
}

/* Shift Bar */
.fvm-shift-bar {
    background: var(--fvm-card-bg);
    border: 1px solid var(--fvm-border);
    border-radius: var(--fvm-radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.fvm-shift-bar--start .fvm-btn--block {
    width: 100%;
    justify-content: center;
    padding: 1rem;
    font-size: 1rem;
}

.fvm-shift-bar--active {
    background: linear-gradient(135deg, #10b98110, #10b98105);
    border-color: #10b981;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.fvm-shift-bar__info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.fvm-shift-bar__status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #10b981;
}

.fvm-shift-bar__time,
.fvm-shift-bar__km {
    font-size: 0.875rem;
    color: var(--fvm-text-muted);
}

.fvm-shift-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Pulse animation for active shift */
.fvm-pulse {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    animation: fvm-pulse 2s ease-in-out infinite;
}

@keyframes fvm-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Login page logo sizing */
.fvm-login__logo {
    max-width: 280px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Mobile shift bar */
@media (max-width: 640px) {
    .fvm-shift-bar--active {
        flex-direction: column;
        text-align: center;
    }
    
    .fvm-shift-bar__info {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Visit card staff indicator */
.fvm-visit-card__staff {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--fvm-primary);
    font-size: 0.8125rem;
}
.fvm-visit-card__staff svg {
    opacity: 0.7;
}

/* Follow-up widget */
.fvm-card--warning {
    border-left: 4px solid #f59e0b;
}
.fvm-dashboard-card--full {
    grid-column: 1 / -1;
}
.fvm-follow-up-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.fvm-follow-up-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem;
    background: var(--fvm-bg);
    border-radius: var(--fvm-radius-sm);
    gap: 1rem;
}
.fvm-follow-up-item__info {
    flex: 1;
    min-width: 0;
}
.fvm-follow-up-item__info strong {
    display: block;
    margin-bottom: 0.25rem;
}
.fvm-follow-up-item__actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}
@media (max-width: 640px) {
    .fvm-follow-up-item {
        flex-direction: column;
    }
    .fvm-follow-up-item__actions {
        width: 100%;
    }
    .fvm-follow-up-item__actions .fvm-btn {
        flex: 1;
    }
}

/* Visit card floor and doorbell */
.fvm-visit-card__floor {
    color: var(--fvm-text-muted);
    font-size: 0.8125rem;
    margin-left: 0.5rem;
}
.fvm-visit-card__doorbell {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--fvm-primary);
    margin-top: 0.25rem;
}
.fvm-visit-card__doorbell svg {
    opacity: 0.7;
}

/* Mobile responsive utilities */
@media (max-width: 640px) {
    .fvm-hide-mobile {
        display: none !important;
    }
    
    .fvm-page__header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .fvm-page__actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .fvm-select--sm {
        flex: 1;
        min-width: 0 !important;
    }
}

/* Swipe to delete */
.fvm-swipe-container {
    position: relative;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.fvm-swipe-action {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 0.5rem 0.5rem 0;
    z-index: 1;
    /* Hidden by default - positioned behind the card */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Show action when swiped */
.fvm-swipe-container.swiped .fvm-swipe-action {
    opacity: 1;
    pointer-events: auto;
}

.fvm-swipe-action--delete {
    background: #ef4444;
}

.fvm-swipe-action__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 0.75rem;
}

.fvm-swipe-action__btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Ensure visit card covers delete action */
.fvm-swipe-container .fvm-visit-card {
    transition: transform 0.2s ease;
    position: relative;
    z-index: 2;
    background: var(--fvm-bg-card, white);
    user-select: none;
    -webkit-user-select: none;
}

/* Restore selection for links and text inside */
.fvm-visit-card a,
.fvm-visit-card .fvm-visit-card__name {
    user-select: text;
    -webkit-user-select: text;
}

/* Next visit highlight */
.fvm-visit-card--next {
    border-left: 4px solid #f97316 !important;
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.1) 0%, transparent 30%);
}

/* Countdown timer */
.fvm-visit-card__countdown {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #f97316;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    animation: pulse-countdown 2s infinite;
}

@keyframes pulse-countdown {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.fvm-countdown-label {
    opacity: 0.9;
}

.fvm-countdown-value {
    font-variant-numeric: tabular-nums;
}

/* Swipe hint animation on mobile */
@media (max-width: 768px) {
    .fvm-swipe-container::after {
        content: '';
        position: absolute;
        top: 50%;
        right: 0.5rem;
        width: 4px;
        height: 30px;
        background: rgba(0, 0, 0, 0.1);
        border-radius: 2px;
        transform: translateY(-50%);
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .fvm-swipe-container:not(.swiped):hover::after,
    .fvm-swipe-container:not(.swiped):focus-within::after {
        opacity: 1;
    }
}

/* Desktop swipe improvements */
@media (min-width: 769px) {
    .fvm-swipe-container {
        cursor: grab;
    }
    
    .fvm-swipe-container:active {
        cursor: grabbing;
    }
    
    /* Show a subtle hint on hover */
    .fvm-swipe-container:hover .fvm-visit-card {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    /* Swipe action wider on desktop */
    .fvm-swipe-action {
        width: 100px;
    }
}

/* Calendar color legend */
.fvm-calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--fvm-bg-card, white);
    border-radius: var(--fvm-radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.fvm-calendar-legend__title {
    font-weight: 600;
    color: var(--fvm-text-muted);
    margin-right: 0.5rem;
}

.fvm-calendar-legend__item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.fvm-calendar-legend__dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .fvm-calendar-legend {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
        font-size: 0.75rem;
    }
    
    .fvm-calendar-legend__dot {
        width: 10px;
        height: 10px;
    }
}

/* Multi-date picker */
.fvm-multi-date-input {
    margin-bottom: 0.5rem;
}

.fvm-selected-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.fvm-date-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--fvm-primary);
    color: white;
    border-radius: var(--fvm-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
}

.fvm-date-tag__remove {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 0;
    font-size: 1.125rem;
    line-height: 1;
    margin-left: 0.125rem;
}

.fvm-date-tag__remove:hover {
    color: white;
}

/* Radio group */
.fvm-radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fvm-radio {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.fvm-radio input[type="radio"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--fvm-primary);
}

/* Staff Availability Calendar */
.fvm-availability-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--fvm-border);
}

.fvm-availability-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fvm-availability-month-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fvm-availability-month-nav button {
    background: var(--fvm-bg);
    border: 1px solid var(--fvm-border);
    border-radius: var(--fvm-radius-sm);
    padding: 0.375rem 0.625rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.fvm-availability-month-nav button:hover {
    background: var(--fvm-border);
}

.fvm-availability-month-nav span {
    font-weight: 600;
    min-width: 120px;
    text-align: center;
}

.fvm-availability-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: var(--fvm-border);
    border: 1px solid var(--fvm-border);
    border-radius: var(--fvm-radius);
    overflow: hidden;
}

.fvm-availability-day-header {
    background: var(--fvm-bg);
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--fvm-text-muted);
}

.fvm-availability-day {
    background: white;
    padding: 0.5rem;
    min-height: 60px;
    cursor: pointer;
    transition: background-color 0.15s;
    position: relative;
}

.fvm-availability-day:hover {
    background: var(--fvm-bg);
}

.fvm-availability-day--empty {
    background: var(--fvm-bg);
    cursor: default;
}

.fvm-availability-day--past {
    opacity: 0.5;
}

.fvm-availability-day__number {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.fvm-availability-day__badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    display: inline-block;
    font-weight: 600;
    text-transform: uppercase;
}

.fvm-availability-day__badge--rest {
    background: #fef3c7;
    color: #92400e;
}

.fvm-availability-day__badge--sick {
    background: #fee2e2;
    color: #991b1b;
}

.fvm-availability-day__badge--vacation {
    background: #dbeafe;
    color: var(--fvm-primary);
}

.fvm-availability-day__visits {
    font-size: 0.625rem;
    color: var(--fvm-danger);
    margin-top: 0.25rem;
}

/* Availability Modal */
.fvm-availability-type-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fvm-availability-type-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 2px solid var(--fvm-border);
    border-radius: var(--fvm-radius);
    cursor: pointer;
    transition: all 0.15s;
}

.fvm-availability-type-option:hover {
    border-color: var(--fvm-primary);
    background: #f0f7ff;
}

.fvm-availability-type-option.active {
    border-color: var(--fvm-primary);
    background: #eff6ff;
}

.fvm-availability-type-option__icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.fvm-availability-type-option__icon--rest {
    background: #fef3c7;
}

.fvm-availability-type-option__icon--sick {
    background: #fee2e2;
}

.fvm-availability-type-option__icon--vacation {
    background: #dbeafe;
}

.fvm-availability-type-option__text {
    flex: 1;
}

.fvm-availability-type-option__title {
    font-weight: 600;
    font-size: 0.875rem;
}

.fvm-availability-type-option__desc {
    font-size: 0.75rem;
    color: var(--fvm-text-muted);
}

@media (max-width: 640px) {
    .fvm-availability-day {
        min-height: 50px;
        padding: 0.25rem;
    }
    
    .fvm-availability-day__number {
        font-size: 0.75rem;
    }
    
    .fvm-availability-day__badge {
        font-size: 0.5rem;
        padding: 0.0625rem 0.25rem;
    }
}

/* FullCalendar - Staff Unavailability Background Events */
.fc .fc-bg-event {
    opacity: 1 !important;
}

.fc .fc-bg-event .fc-event-title {
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #78350f;
    padding: 0.25rem;
    text-align: center;
}

/* Striped pattern for unavailable days */
.fc-daygrid-day.fc-day-unavailable {
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(0, 0, 0, 0.03) 10px,
        rgba(0, 0, 0, 0.03) 20px
    );
}

/* Legend for calendar */
.fvm-calendar-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--fvm-bg-secondary);
    border-radius: var(--fvm-radius);
    font-size: 0.75rem;
}

.fvm-calendar-legend__item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.fvm-calendar-legend__color {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.fvm-calendar-legend__color--rest {
    background: #fef3c7;
}

.fvm-calendar-legend__color--sick {
    background: #fee2e2;
}

.fvm-calendar-legend__color--vacation {
    background: #dbeafe;
}

/* Late Visits Banner */
.fvm-late-visits-banner {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: var(--fvm-radius);
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.fvm-late-visits-banner__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.5);
}

.fvm-late-visits-banner__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #92400e;
    font-size: 0.9375rem;
}

.fvm-late-visits-banner__icon {
    font-size: 1.25rem;
    animation: fvm-pulse-warning 2s infinite;
}

@keyframes fvm-pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.fvm-late-visits-banner__content {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.fvm-late-visit-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    background: white;
    border-radius: calc(var(--fvm-radius) - 2px);
    text-decoration: none;
    color: inherit;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.fvm-late-visit-item:hover {
    border-color: #f59e0b;
    transform: translateX(2px);
}

.fvm-late-visit-item__info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.fvm-late-visit-item__patient {
    font-weight: 600;
    color: #1f2937;
}

.fvm-late-visit-item__time {
    font-size: 0.75rem;
    color: #6b7280;
}

.fvm-late-visit-item__badge {
    background: #dc2626;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    white-space: nowrap;
}

.fvm-rotate-180 {
    transform: rotate(180deg);
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .fvm-late-visits-banner__header {
        padding: 0.625rem 0.75rem;
    }
    
    .fvm-late-visits-banner__title {
        font-size: 0.875rem;
    }
    
    .fvm-late-visit-item {
        padding: 0.5rem 0.625rem;
    }
    
    .fvm-late-visit-item__patient {
        font-size: 0.875rem;
    }
}

/* Alert sections in banner */
.fvm-alert-section {
    margin-bottom: 0.5rem;
}

.fvm-alert-section:last-child {
    margin-bottom: 0;
}

.fvm-alert-section__label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    padding: 0.25rem 0.5rem;
    color: #78350f;
    opacity: 0.8;
}

/* Badge colors */
.fvm-late-visit-item__badge--late {
    background: #dc2626;
}

.fvm-late-visit-item__badge--overlong {
    background: #ea580c;
}

/* Overlong section styling */
.fvm-alert-section--overlong .fvm-late-visit-item {
    border-left: 3px solid #ea580c;
}

.fvm-alert-section--late .fvm-late-visit-item {
    border-left: 3px solid #dc2626;
}

/* GPS Status Indicator */
.fvm-geo-status {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--fvm-radius);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.fvm-geo-status--checking {
    background: #f0f9ff;
    color: var(--fvm-primary);
    border: 1px solid color-mix(in srgb, var(--fvm-primary) 20%, transparent);
}
.fvm-geo-status--ok {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}
.fvm-geo-status--warn {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
    line-height: 1.4;
}

/* ================================
   Bulk Selection
   ================================ */
.fvm-visit-card__select {
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 5;
    background: color-mix(in srgb, var(--fvm-bg-card) 90%, transparent);
}
.fvm-visit-card__select input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--fvm-primary);
}
.fvm-swipe-container {
    position: relative;
}

/* When select mode is active, add left padding to cards */
.fvm-visit-card__select[style*="flex"] ~ .fvm-swipe-action + .fvm-visit-card,
.fvm-visit-card__select[style*="flex"] ~ .fvm-visit-card {
    padding-left: 2.5rem;
}

.fvm-bulk-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--fvm-bg-card);
    border-top: 2px solid var(--fvm-primary);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
    padding: 0.75rem 1rem;
    z-index: 200;
    animation: fvm-slideUp 0.2s ease-out;
}
@keyframes fvm-slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.fvm-bulk-bar__inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}
.fvm-bulk-bar__selectall {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
}
.fvm-bulk-bar__selectall input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--fvm-primary);
}
.fvm-bulk-bar__count {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--fvm-primary);
    flex: 1;
}
.fvm-btn--active {
    background: var(--fvm-primary) !important;
    color: #fff !important;
}
