:root {
    --fi-primary: #1d4ed8;
    --fi-primary-dark: #1e3a8a;
    --fi-primary-light: #dbeafe;
    --fi-secondary: #0ea5e9;
    --fi-accent: #38bdf8;
    --fi-success: #10b981;
    --fi-warning: #f59e0b;
    --fi-danger: #ef4444;
    --fi-surface: #ffffff;
    --fi-surface-subtle: #f8fafc;
    --fi-text-primary: #0f172a;
    --fi-text-secondary: #475569;
    --fi-text-muted: #94a3b8;
    --fi-border: #e2e8f0;
    --fi-border-strong: #cbd5f5;
    --fi-shadow-soft: 0 6px 20px rgba(15, 23, 42, 0.08);
    --fi-shadow-strong: 0 18px 44px rgba(15, 23, 42, 0.16);
    --fi-radius-sm: 0.375rem;
    --fi-radius-md: 0.75rem;
    --fi-radius-lg: 1.25rem;
    --fi-radius-pill: 999px;
    --fi-transition: 0.22s ease-in-out;
    --fi-font-family: 'Inter', 'Helvetica Neue', Helvetica, 'Roboto', Arial, sans-serif;
}

body {
    font-family: var(--fi-font-family);
    color: var(--fi-text-primary);
    background-color: var(--fi-surface-subtle);
}

a {
    color: var(--fi-primary);
    transition: color var(--fi-transition);
}

a:hover,
a:focus {
    color: var(--fi-primary-dark);
}

.fi-surface {
    background-color: var(--fi-surface);
    border-radius: var(--fi-radius-md);
    box-shadow: var(--fi-shadow-soft);
    border: 1px solid rgba(30, 64, 175, 0.05);
}

.fi-card {
    background-color: var(--fi-surface);
    border-radius: var(--fi-radius-md);
    border: 1px solid var(--fi-border);
    box-shadow: var(--fi-shadow-soft);
    padding: 1.5rem;
}

.fi-card-quiet {
    background: linear-gradient(140deg, rgba(29, 78, 216, 0.06), rgba(14, 165, 233, 0.04));
    border-radius: var(--fi-radius-md);
    border: 1px solid rgba(29, 78, 216, 0.08);
}

.fi-card-ghost {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.6);
}

.fi-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--fi-primary-dark);
    letter-spacing: -0.01em;
}

.fi-divider {
    border-bottom: 1px solid var(--fi-border);
    margin: 1.5rem 0;
}

.fi-badge,
.fi-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--fi-radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.fi-badge {
    background-color: var(--fi-primary-light);
    color: var(--fi-primary-dark);
}

.fi-badge-success {
    background-color: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.fi-badge-warning {
    background-color: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.fi-badge-danger {
    background-color: rgba(239, 68, 68, 0.14);
    color: #b91c1c;
}

.fi-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--fi-radius-sm);
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all var(--fi-transition);
    border: 1px solid transparent;
}

.fi-btn-primary {
    background-color: var(--fi-primary);
    border-color: var(--fi-primary);
    color: #ffffff;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}

.fi-btn-primary:hover,
.fi-btn-primary:focus {
    background-color: var(--fi-primary-dark);
    border-color: var(--fi-primary-dark);
    box-shadow: var(--fi-shadow-soft);
}

.fi-btn-secondary {
    background-color: rgba(29, 78, 216, 0.08);
    border-color: rgba(29, 78, 216, 0.2);
    color: var(--fi-primary-dark);
}

.fi-btn-secondary:hover,
.fi-btn-secondary:focus {
    background-color: rgba(29, 78, 216, 0.15);
    border-color: rgba(29, 78, 216, 0.32);
}

.fi-btn-ghost {
    background-color: transparent;
    border-color: rgba(148, 163, 184, 0.4);
    color: var(--fi-text-secondary);
}

.fi-btn-ghost:hover,
.fi-btn-ghost:focus {
    border-color: var(--fi-primary);
    color: var(--fi-primary);
    background-color: rgba(29, 78, 216, 0.05);
}

.fi-link {
    color: var(--fi-primary);
    font-weight: 600;
}

.fi-link:hover,
.fi-link:focus {
    color: var(--fi-primary-dark);
    text-decoration: underline;
}

.fi-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background-color: var(--fi-surface);
    border-radius: var(--fi-radius-md);
    overflow: hidden;
}

.fi-table thead {
    background-color: rgba(29, 78, 216, 0.08);
    color: var(--fi-primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
}

.fi-table th,
.fi-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--fi-border);
}

.fi-table tbody tr:hover {
    background-color: rgba(219, 234, 254, 0.4);
}

.fi-shadow-soft {
    box-shadow: var(--fi-shadow-soft);
}

.fi-shadow-strong {
    box-shadow: var(--fi-shadow-strong);
}

.fi-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--fi-radius-pill);
    border: 2px solid var(--fi-surface);
    box-shadow: 0 6px 12px rgba(15, 23, 42, 0.12);
}

.fi-glow-card {
    position: relative;
    overflow: hidden;
}

.fi-glow-card::after {
    content: '';
    position: absolute;
    inset: -35%;
    background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.28), transparent 65%);
    z-index: -1;
}

.fi-stat-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--fi-primary-dark);
}

.fi-stat-label {
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    color: var(--fi-text-secondary);
    text-transform: uppercase;
}

.fi-form-label {
    display: block;
    font-weight: 600;
    color: var(--fi-text-secondary);
    margin-bottom: 0.35rem;
}

.fi-input,
.fi-textarea,
.fi-select {
    width: 100%;
    border-radius: var(--fi-radius-sm);
    border: 1px solid var(--fi-border);
    padding: 0.65rem 0.75rem;
    transition: border-color var(--fi-transition), box-shadow var(--fi-transition);
    font-size: 0.95rem;
    color: var(--fi-text-primary);
    background-color: #ffffff;
}

.fi-input:focus,
.fi-textarea:focus,
.fi-select:focus {
    border-color: var(--fi-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
    outline: none;
}

.fi-banner {
    border-radius: var(--fi-radius-md);
    padding: 1rem 1.25rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    border: 1px solid rgba(59, 130, 246, 0.2);
    background: linear-gradient(120deg, rgba(219, 234, 254, 0.85), rgba(14, 165, 233, 0.15));
}

.fi-banner-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--fi-radius-md);
    background-color: rgba(29, 78, 216, 0.12);
    color: var(--fi-primary);
}

.fi-gradient {
    background: radial-gradient(circle at top left, rgba(14, 165, 233, 0.18), transparent 55%),
        radial-gradient(circle at bottom right, rgba(29, 78, 216, 0.16), transparent 60%),
        linear-gradient(145deg, rgba(226, 232, 240, 0.75), rgba(248, 250, 252, 0.9));
}

.fi-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: var(--fi-radius-pill);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background-color: rgba(148, 163, 184, 0.16);
    color: var(--fi-text-secondary);
}

.fi-stepper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.25rem;
}

.fi-step {
    position: relative;
    padding: 1.25rem;
    border-radius: var(--fi-radius-md);
    border: 1px solid rgba(15, 23, 42, 0.08);
    background-color: rgba(255, 255, 255, 0.92);
}

.fi-step::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid transparent;
    pointer-events: none;
    transition: border-color var(--fi-transition);
}

.fi-step-active::after {
    border-color: rgba(29, 78, 216, 0.45);
}

.fi-progress-track {
    height: 0.5rem;
    border-radius: var(--fi-radius-pill);
    background-color: rgba(148, 163, 184, 0.25);
    overflow: hidden;
}

.fi-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--fi-primary) 0%, var(--fi-secondary) 100%);
    border-radius: inherit;
}

.fi-mini-card {
    padding: 1rem;
    border-radius: var(--fi-radius-md);
    border: 1px solid rgba(148, 163, 184, 0.22);
    background-color: rgba(255, 255, 255, 0.95);
}

.fi-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    border-radius: var(--fi-radius-lg);
    border: 1px dashed rgba(59, 130, 246, 0.35);
    color: var(--fi-text-secondary);
    background-color: rgba(219, 234, 254, 0.35);
}


/* Legacy class compatibility */
.bg-ramsay-blue,
.bg-flatiron-primary {
    background-color: var(--fi-primary);
}

.text-ramsay-blue,
.text-flatiron-primary {
    color: var(--fi-primary);
}

.hover\:bg-ramsay-blue-dark:hover,
.hover\:bg-flatiron-primary-dark:hover {
    background-color: var(--fi-primary-dark);
}

.focus\:ring-ramsay-blue:focus,
.focus\:ring-flatiron-primary:focus {
    --tw-ring-color: var(--fi-primary);
}

.focus\:border-ramsay-blue:focus,
.focus\:border-flatiron-primary:focus {
    border-color: var(--fi-primary);
}


/* Feedback elements */
.loader {
    border: 3px solid rgba(226, 232, 240, 0.9);
    border-radius: 50%;
    border-top: 3px solid var(--fi-primary);
    width: 24px;
    height: 24px;
    animation: fi-spin 1s linear infinite;
}

@keyframes fi-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--fi-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 1rem 1.25rem;
    border-radius: var(--fi-radius-md);
    background: var(--fi-surface);
    box-shadow: var(--fi-shadow-soft);
    z-index: 1000;
    animation: fi-slide-in 0.3s ease-out;
    border: 1px solid rgba(148, 163, 184, 0.18);
}

@keyframes fi-slide-in {
    from {
        transform: translateX(18%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    border-color: rgba(16, 185, 129, 0.2);
    background-color: rgba(236, 253, 245, 0.95);
    color: #047857;
}

.toast-danger {
    border-color: rgba(239, 68, 68, 0.2);
    background-color: rgba(254, 242, 242, 0.95);
    color: #b91c1c;
}

.toast-info {
    border-color: rgba(59, 130, 246, 0.2);
    background-color: rgba(219, 234, 254, 0.95);
    color: var(--fi-primary);
}


/* Utility helpers */
.fi-text-muted {
    color: var(--fi-text-muted);
}

.fi-blur {
    backdrop-filter: blur(18px);
}

.fi-stacked {
    display: grid;
    gap: 1.25rem;
}

.fi-grid-responsive {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .fi-grid-responsive {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

.fi-border-gradient {
    position: relative;
    border-radius: var(--fi-radius-lg);
    overflow: hidden;
}

.fi-border-gradient::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(125deg, rgba(29, 78, 216, 0.35), rgba(14, 165, 233, 0.2));
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.fi-border-gradient > * {
    position: relative;
}

.fi-metric-pair {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.fi-metric-caption {
    font-size: 0.75rem;
    color: var(--fi-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.fi-pill-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.fi-pill-group .fi-pill {
    background-color: rgba(29, 78, 216, 0.1);
    color: var(--fi-primary-dark);
}

.fi-avatar-stack {
    display: inline-flex;
    align-items: center;
}

.fi-avatar-stack .fi-avatar {
    margin-left: -0.9rem;
    border: 2px solid var(--fi-surface);
}

.fi-avatar-stack .fi-avatar:first-child {
    margin-left: 0;
}

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

.fi-timeline::before {
    content: '';
    position: absolute;
    left: 0.7rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.25), rgba(14, 165, 233, 0.15));
}

.fi-timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.fi-timeline-item::before {
    content: '';
    position: absolute;
    left: -1.05rem;
    top: 0.15rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: var(--fi-surface);
    border: 3px solid rgba(59, 130, 246, 0.35);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}