/**
 * Golden Fabric ERP — Enterprise Design System
 * Global tokens, typography, and reusable UI components.
 * Load after Bootstrap 5, before module-specific CSS.
 */

/* ============================================================
   1. COLOR SYSTEM (CSS Variables)
   ============================================================ */
:root {
    /* Primary palette — Golden Fabric ERP official black & gold */
    --lf-primary: #0A0A0A;
    --lf-primary-hover: #1a1a1a;
    --lf-primary-subtle: #F8F6F0;
    --lf-primary-rgb: 10, 10, 10;
    --lf-accent: #C9A227;
    --lf-accent-hover: #8B6914;
    --lf-accent-subtle: #FBF5E6;

    --lf-success: #16a34a;
    --lf-success-hover: #15803d;
    --lf-success-subtle: #f0fdf4;
    --lf-success-rgb: 22, 163, 74;

    --lf-danger: #dc2626;
    --lf-danger-hover: #b91c1c;
    --lf-danger-subtle: #fef2f2;
    --lf-danger-rgb: 220, 38, 38;

    --lf-warning: #ea580c;
    --lf-warning-hover: #c2410c;
    --lf-warning-subtle: #fff7ed;
    --lf-warning-rgb: 234, 88, 12;

    --lf-info: #0ea5e9;
    --lf-info-hover: #0284c7;
    --lf-info-subtle: #f0f9ff;
    --lf-info-rgb: 14, 165, 233;

    --lf-secondary: #64748b;
    --lf-secondary-hover: #475569;
    --lf-secondary-subtle: #f1f5f9;

    /* Surfaces & text */
    --lf-bg: #f1f5f9;
    --lf-bg-card: #ffffff;
    --lf-border: #e2e8f0;
    --lf-border-strong: #cbd5e1;
    --lf-text: #1e293b;
    --lf-text-muted: #64748b;
    --lf-text-light: #94a3b8;

    /* Layout (shared with admin shell) */
    --lf-radius-sm: 6px;
    --lf-radius: 10px;
    --lf-radius-lg: 14px;
    --lf-radius-xl: 18px;
    --lf-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --lf-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
    --lf-shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.1);
    --lf-transition: 0.2s ease;
    --lf-transition-slow: 0.3s ease;

    /* Typography scale */
    --lf-font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --lf-font-page-title: 1.75rem;
    --lf-font-section-title: 1.125rem;
    --lf-font-card-title: 1rem;
    --lf-font-body: 0.9375rem;
    --lf-font-small: 0.8125rem;
    --lf-font-table-header: 0.75rem;
    --lf-font-badge: 0.6875rem;

    /* Spacing */
    --lf-space-xs: 0.25rem;
    --lf-space-sm: 0.5rem;
    --lf-space-md: 1rem;
    --lf-space-lg: 1.5rem;
    --lf-space-xl: 2rem;

    /* Bootstrap bridge */
    --primary-color: var(--lf-primary);
    --content-bg: var(--lf-bg);
    --border-color: var(--lf-border);
}

/* ============================================================
   2. TYPOGRAPHY
   ============================================================ */
.lf-page-title,
.page-title {
    font-size: var(--lf-font-page-title);
    font-weight: 700;
    color: var(--lf-text);
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.lf-section-title {
    font-size: var(--lf-font-section-title);
    font-weight: 600;
    color: var(--lf-text);
    line-height: 1.35;
}

.lf-card-title {
    font-size: var(--lf-font-card-title);
    font-weight: 600;
    color: var(--lf-text);
    margin: 0;
}

.lf-body {
    font-size: var(--lf-font-body);
    color: var(--lf-text);
    line-height: 1.55;
}

.lf-text-small,
.page-subtitle {
    font-size: var(--lf-font-small);
    color: var(--lf-text-muted);
}

.lf-table-header {
    font-size: var(--lf-font-table-header);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--lf-text-muted);
}

/* ============================================================
   3. CARD COMPONENT
   ============================================================ */
.lf-card,
.content-card {
    background: var(--lf-bg-card);
    border: 1px solid var(--lf-border);
    border-radius: var(--lf-radius-lg);
    overflow: hidden;
    box-shadow: var(--lf-shadow-sm);
    transition: box-shadow var(--lf-transition), transform var(--lf-transition), border-color var(--lf-transition);
}

.lf-card:hover,
.content-card.lf-card-hover:hover,
.content-card:hover {
    box-shadow: var(--lf-shadow);
}

.lf-card-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--lf-shadow-lg);
}

.lf-card-header,
.content-card-header {
    padding: var(--lf-space-md) var(--lf-space-lg);
    border-bottom: 1px solid var(--lf-border);
    background: var(--lf-bg-card);
}

.lf-card-body,
.content-card-body {
    padding: var(--lf-space-lg);
}

.lf-card-footer {
    padding: var(--lf-space-md) var(--lf-space-lg);
    border-top: 1px solid var(--lf-border);
    background: #fafbfc;
}

/* ============================================================
   4. BUTTON SYSTEM
   ============================================================ */
.btn {
    border-radius: var(--lf-radius);
    font-weight: 500;
    font-size: var(--lf-font-body);
    transition: background-color var(--lf-transition), border-color var(--lf-transition),
        color var(--lf-transition), box-shadow var(--lf-transition), transform var(--lf-transition);
}

.btn:focus-visible {
    outline: 2px solid var(--lf-primary);
    outline-offset: 2px;
    box-shadow: none;
}

.btn-primary {
    background-color: var(--lf-primary);
    border-color: var(--lf-primary);
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--lf-primary-hover);
    border-color: var(--lf-primary-hover);
}

.btn-success {
    background-color: var(--lf-success);
    border-color: var(--lf-success);
}
.btn-success:hover {
    background-color: var(--lf-success-hover);
    border-color: var(--lf-success-hover);
}

.btn-danger {
    background-color: var(--lf-danger);
    border-color: var(--lf-danger);
}
.btn-danger:hover {
    background-color: var(--lf-danger-hover);
    border-color: var(--lf-danger-hover);
}

.btn-warning {
    background-color: var(--lf-warning);
    border-color: var(--lf-warning);
    color: #fff;
}
.btn-warning:hover {
    background-color: var(--lf-warning-hover);
    border-color: var(--lf-warning-hover);
    color: #fff;
}

.btn-info {
    background-color: var(--lf-info);
    border-color: var(--lf-info);
    color: #fff;
}
.btn-info:hover {
    background-color: var(--lf-info-hover);
    border-color: var(--lf-info-hover);
    color: #fff;
}

.btn-secondary {
    background-color: var(--lf-secondary-subtle);
    border-color: var(--lf-border);
    color: var(--lf-text);
}
.btn-secondary:hover {
    background-color: var(--lf-border);
    border-color: var(--lf-border-strong);
    color: var(--lf-text);
}

.btn-outline-primary { color: var(--lf-primary); border-color: var(--lf-primary); }
.btn-outline-primary:hover { background: var(--lf-primary); border-color: var(--lf-primary); }
.btn-outline-success { color: var(--lf-success); border-color: var(--lf-success); }
.btn-outline-success:hover { background: var(--lf-success); border-color: var(--lf-success); }
.btn-outline-danger { color: var(--lf-danger); border-color: var(--lf-danger); }
.btn-outline-danger:hover { background: var(--lf-danger); border-color: var(--lf-danger); }
.btn-outline-warning { color: var(--lf-warning); border-color: var(--lf-warning); }
.btn-outline-warning:hover { background: var(--lf-warning); border-color: var(--lf-warning); color: #fff; }
.btn-outline-secondary { color: var(--lf-secondary); border-color: var(--lf-border-strong); }

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.lf-btn-loading {
    pointer-events: none;
    opacity: 0.85;
}

.lf-btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* ============================================================
   5. TABLE SYSTEM
   ============================================================ */
.lf-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--lf-border);
    border-radius: var(--lf-radius-lg);
    background: var(--lf-bg-card);
}

.lf-table-wrap .table,
.table.lf-table {
    margin-bottom: 0;
}

.lf-table-wrap .table thead,
.table.lf-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.lf-table-wrap .table thead th,
.table.lf-table thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--lf-border);
    padding: 0.75rem 1rem;
    font-size: var(--lf-font-table-header);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--lf-text-muted);
    white-space: nowrap;
}

.lf-table-wrap .table thead th:first-child,
.table.lf-table thead th:first-child {
    border-top-left-radius: var(--lf-radius-lg);
}

.lf-table-wrap .table thead th:last-child,
.table.lf-table thead th:last-child {
    border-top-right-radius: var(--lf-radius-lg);
}

.lf-table-wrap .table tbody td,
.table.lf-table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    font-size: var(--lf-font-body);
    border-color: var(--lf-border);
}

.lf-table-wrap .table tbody tr:nth-child(even),
.table.lf-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.lf-table-wrap .table tbody tr:hover,
.table.lf-table.table-hover tbody tr:hover {
    background: var(--lf-primary-subtle);
}

.lf-table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    flex-wrap: nowrap;
}

.lf-table-badge-cell {
    white-space: nowrap;
}

/* Pagination */
.lf-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--lf-space-md);
    padding: var(--lf-space-md) var(--lf-space-lg);
    border-top: 1px solid var(--lf-border);
    background: #fafbfc;
    font-size: var(--lf-font-small);
    color: var(--lf-text-muted);
}

.lf-pagination .pagination {
    margin-bottom: 0;
}

.lf-pagination .page-link {
    border-radius: var(--lf-radius-sm);
    margin: 0 2px;
    color: var(--lf-text);
    border-color: var(--lf-border);
}

.lf-pagination .page-item.active .page-link {
    background: var(--lf-primary);
    border-color: var(--lf-primary);
}

/* ============================================================
   6. FORM SYSTEM
   ============================================================ */
.admin-content .form-label,
.lf-form-label {
    font-size: var(--lf-font-small);
    font-weight: 600;
    color: var(--lf-text);
    margin-bottom: 0.35rem;
}

.admin-content .form-label .text-danger,
.lf-required {
    color: var(--lf-danger);
}

.admin-content .form-control,
.admin-content .form-select,
.lf-input {
    min-height: 2.625rem;
    border-radius: var(--lf-radius);
    border-color: var(--lf-border);
    font-size: var(--lf-font-body);
    padding: 0.5rem 0.85rem;
    transition: border-color var(--lf-transition), box-shadow var(--lf-transition);
}

.admin-content .form-control:focus,
.admin-content .form-select:focus,
.lf-input:focus {
    border-color: var(--lf-primary);
    box-shadow: 0 0 0 3px rgba(var(--lf-primary-rgb), 0.15);
}

.admin-content .form-control.is-invalid,
.lf-input.is-invalid {
    border-color: var(--lf-danger);
}

.lf-field-error {
    font-size: var(--lf-font-small);
    color: var(--lf-danger);
    margin-top: 0.25rem;
}

.lf-form-hint {
    font-size: var(--lf-font-small);
    color: var(--lf-text-muted);
    margin-top: 0.25rem;
}

.lf-form-section {
    margin-bottom: var(--lf-space-lg);
}

.lf-form-section-title {
    font-size: var(--lf-font-section-title);
    font-weight: 600;
    margin-bottom: var(--lf-space-md);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--lf-border);
}

/* ============================================================
   7. SEARCH & FILTER BAR
   ============================================================ */
.lf-filter-bar {
    background: var(--lf-bg-card);
    border: 1px solid var(--lf-border);
    border-radius: var(--lf-radius-lg);
    padding: var(--lf-space-md) var(--lf-space-lg);
    margin-bottom: var(--lf-space-lg);
    box-shadow: var(--lf-shadow-sm);
}

.lf-filter-bar .form-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--lf-text-muted);
    margin-bottom: 0.25rem;
}

.lf-filter-bar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem;
}

.lf-filter-bar-export {
    margin-left: auto;
}

@media (max-width: 767.98px) {
    .lf-filter-bar-export {
        margin-left: 0;
        width: 100%;
    }
    .lf-filter-bar-export .btn {
        width: 100%;
    }
}

/* ============================================================
   8. STATUS BADGES
   ============================================================ */
.lf-badge,
.lf-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.28em 0.65em;
    font-size: var(--lf-font-badge);
    font-weight: 600;
    line-height: 1.3;
    border-radius: 50px;
    text-transform: capitalize;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Semantic status map */
.lf-badge-active, .lf-badge-completed, .lf-badge-paid, .lf-badge-received, .lf-badge-approved {
    background: var(--lf-success-subtle); color: var(--lf-success);
}
.lf-badge-inactive, .lf-badge-draft, .lf-badge-pending {
    background: var(--lf-warning-subtle); color: var(--lf-warning);
}
.lf-badge-cancelled, .lf-badge-rejected, .lf-badge-danger {
    background: var(--lf-danger-subtle); color: var(--lf-danger);
}
.lf-badge-refunded, .lf-badge-info {
    background: var(--lf-info-subtle); color: var(--lf-info);
}
.lf-badge-partial, .lf-badge-low-stock {
    background: #fef3c7; color: #b45309;
}
.lf-badge-out-of-stock {
    background: var(--lf-danger-subtle); color: var(--lf-danger);
}
.lf-badge-secondary {
    background: var(--lf-secondary-subtle); color: var(--lf-secondary);
}
.lf-badge-primary {
    background: var(--lf-primary-subtle); color: var(--lf-primary);
}

/* ============================================================
   9. DASHBOARD KPI CARD
   ============================================================ */
.lf-kpi-card,
.stat-card {
    background: var(--lf-bg-card);
    border: 1px solid var(--lf-border);
    border-radius: var(--lf-radius-lg);
    padding: var(--lf-space-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--lf-space-md);
    height: 100%;
    box-shadow: var(--lf-shadow-sm);
    transition: box-shadow var(--lf-transition), transform var(--lf-transition);
}

.lf-kpi-card:hover,
.stat-card:hover {
    box-shadow: var(--lf-shadow);
    transform: translateY(-2px);
}

.lf-kpi-icon,
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--lf-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.lf-kpi-icon-primary, .stat-icon.bg-primary-subtle { background: var(--lf-primary-subtle); color: var(--lf-primary); }
.lf-kpi-icon-success, .stat-icon.bg-success-subtle { background: var(--lf-success-subtle); color: var(--lf-success); }
.lf-kpi-icon-danger, .stat-icon.bg-danger-subtle { background: var(--lf-danger-subtle); color: var(--lf-danger); }
.lf-kpi-icon-warning, .stat-icon.bg-warning-subtle { background: var(--lf-warning-subtle); color: var(--lf-warning); }
.lf-kpi-icon-info, .stat-icon.bg-info-subtle { background: var(--lf-info-subtle); color: var(--lf-info); }

.lf-kpi-content,
.stat-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.lf-kpi-label,
.stat-label {
    font-size: var(--lf-font-small);
    color: var(--lf-text-muted);
    font-weight: 500;
    margin-bottom: 0.15rem;
}

.lf-kpi-value,
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--lf-text);
    line-height: 1.2;
}

.lf-kpi-trend {
    font-size: var(--lf-font-small);
    margin-top: 0.35rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.lf-kpi-trend-up { color: var(--lf-success); }
.lf-kpi-trend-down { color: var(--lf-danger); }

/* ============================================================
   10. EMPTY STATES
   ============================================================ */
.lf-empty-state {
    text-align: center;
    padding: var(--lf-space-xl) var(--lf-space-lg);
}

.lf-empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto var(--lf-space-md);
    border-radius: 50%;
    background: var(--lf-secondary-subtle);
    color: var(--lf-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.lf-empty-title {
    font-size: var(--lf-font-section-title);
    font-weight: 600;
    color: var(--lf-text);
    margin-bottom: 0.35rem;
}

.lf-empty-desc {
    font-size: var(--lf-font-body);
    color: var(--lf-text-muted);
    max-width: 360px;
    margin: 0 auto var(--lf-space-lg);
}

/* ============================================================
   11. CONFIRMATION MODAL
   ============================================================ */
.lf-confirm-modal .modal-content {
    border: none;
    border-radius: var(--lf-radius-xl);
    box-shadow: var(--lf-shadow-lg);
}

.lf-confirm-body {
    text-align: center;
    padding: var(--lf-space-xl) var(--lf-space-lg) var(--lf-space-md);
}

.lf-confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--lf-space-md);
    font-size: 1.75rem;
}

.lf-confirm-icon-warning { background: var(--lf-warning-subtle); color: var(--lf-warning); }
.lf-confirm-icon-danger { background: var(--lf-danger-subtle); color: var(--lf-danger); }
.lf-confirm-icon-success { background: var(--lf-success-subtle); color: var(--lf-success); }
.lf-confirm-icon-info { background: var(--lf-info-subtle); color: var(--lf-info); }

.lf-confirm-title {
    font-size: var(--lf-font-section-title);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.lf-confirm-message {
    font-size: var(--lf-font-body);
    color: var(--lf-text-muted);
    margin-bottom: 0;
}

.lf-confirm-footer {
    border-top: none;
    padding: var(--lf-space-md) var(--lf-space-lg) var(--lf-space-lg);
    justify-content: center;
    gap: 0.75rem;
}

/* ============================================================
   12. TOAST NOTIFICATIONS
   ============================================================ */
.lf-toast-container {
    position: fixed;
    top: calc(var(--topnav-height, 64px) + 12px);
    right: 16px;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-width: min(400px, calc(100vw - 32px));
    pointer-events: none;
}

.lf-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--lf-bg-card);
    border: 1px solid var(--lf-border);
    border-radius: var(--lf-radius-lg);
    box-shadow: var(--lf-shadow-lg);
    pointer-events: auto;
    border-left-width: 4px;
}

.lf-toast-success { border-left-color: var(--lf-success); }
.lf-toast-error { border-left-color: var(--lf-danger); }
.lf-toast-warning { border-left-color: var(--lf-warning); }
.lf-toast-info { border-left-color: var(--lf-info); }

.lf-toast-icon { font-size: 1.25rem; flex-shrink: 0; margin-top: 0.1rem; }
.lf-toast-success .lf-toast-icon { color: var(--lf-success); }
.lf-toast-error .lf-toast-icon { color: var(--lf-danger); }
.lf-toast-warning .lf-toast-icon { color: var(--lf-warning); }
.lf-toast-info .lf-toast-icon { color: var(--lf-info); }

.lf-toast-title { font-weight: 600; font-size: var(--lf-font-body); color: var(--lf-text); }
.lf-toast-message { font-size: var(--lf-font-small); color: var(--lf-text-muted); margin-top: 0.15rem; }

.lf-toast-close {
    border: none;
    background: transparent;
    color: var(--lf-text-light);
    padding: 0.15rem;
    margin-left: auto;
    cursor: pointer;
    border-radius: var(--lf-radius-sm);
    line-height: 1;
}
.lf-toast-close:hover { color: var(--lf-text); background: var(--lf-secondary-subtle); }
.lf-toast-close:focus-visible { outline: 2px solid var(--lf-primary); outline-offset: 2px; }

.lf-toast-out {
    animation: lfToastOut 0.28s ease forwards;
}

/* ============================================================
   13. LOADING / SKELETON
   ============================================================ */
.lf-spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--lf-border);
    border-top-color: var(--lf-primary);
    border-radius: 50%;
    animation: lfSpin 0.7s linear infinite;
}

.lf-spinner-sm { width: 1rem; height: 1rem; border-width: 2px; }
.lf-spinner-lg { width: 2rem; height: 2rem; border-width: 3px; }

.lf-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
    background: var(--lf-loader-bg, rgba(255, 255, 255, 0.75));
}

@keyframes lfShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.lf-skeleton {
    background: var(--lf-skeleton-shimmer, linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%));
    background-size: 200% 100%;
    animation: lfShimmer 1.4s ease-in-out infinite;
    border-radius: var(--lf-radius-sm);
}

.lf-skeleton-text { height: 0.875rem; margin-bottom: 0.5rem; }
.lf-skeleton-title { height: 1.25rem; width: 60%; margin-bottom: 0.75rem; }
.lf-skeleton-value { height: 2rem; width: 45%; }
.lf-skeleton-card { height: 120px; border-radius: var(--lf-radius-lg); }
.lf-skeleton-row { height: 2.5rem; margin-bottom: 0.5rem; }

.lf-skeleton-block { padding: var(--lf-space-lg); }

/* ============================================================
   14. RESPONSIVE HELPERS
   ============================================================ */
.lf-page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--lf-space-md);
    margin-bottom: var(--lf-space-lg);
}

.lf-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 575.98px) {
    .lf-page-actions .btn { flex: 1 1 auto; }
    .lf-kpi-value, .stat-value { font-size: 1.25rem; }
    .lf-toast-container { right: 8px; left: 8px; max-width: none; }
}

/* ============================================================
   15. ACCESSIBILITY
   ============================================================ */
.lf-skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--lf-primary);
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 9999;
    border-radius: 0 0 var(--lf-radius) 0;
    text-decoration: none;
}
.lf-skip-link:focus { top: 0; color: #fff; }

:focus-visible {
    outline: 2px solid var(--lf-primary);
    outline-offset: 2px;
}

/* Visually hidden flash for screen readers when toasts shown */
.lf-flash-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ============================================================
   16. ANIMATIONS
   ============================================================ */
@keyframes lfFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes lfToastOut {
    to { opacity: 0; transform: translateX(20px); }
}

@keyframes lfSpin {
    to { transform: rotate(360deg); }
}

.lf-fade-in { animation: lfFadeIn 0.35s ease forwards; }
.lf-page-enter { animation: lfFadeIn 0.4s ease forwards; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .lf-kpi-card:hover, .stat-card:hover, .btn:hover { transform: none; }
}

/* ============================================================
   Legacy compatibility — section headers (reports, etc.)
   ============================================================ */
.reports-section-title,
.lf-module-section-title {
    font-size: var(--lf-font-small);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--lf-text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--lf-border);
}

/* ============================================================
   User avatars (shared — header, profile, user lists)
   ============================================================ */
.usr-avatar {
    border-radius: 50%;
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--lf-primary, var(--bs-primary));
    color: #fff;
    font-weight: 600;
    flex-shrink: 0;
}

.usr-avatar-xs {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
}

.usr-avatar-sm {
    width: 36px;
    height: 36px;
    font-size: 0.875rem;
}

.usr-avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
}

.usr-avatar-fallback {
    text-transform: uppercase;
}

img.usr-avatar {
    background: transparent;
}
