/*
 * FORMS.CSS - Shared Form Styling
 * ================================
 * Single source of truth for ALL forms in the system.
 * DO NOT create custom form styles in components.
 * Use these classes everywhere for consistency.
 *
 * Pattern: firm-form-* classes
 */

/* ============================================
   FORM GROUP - Stacked label pattern
   Label on top, input below, consistent spacing
   ============================================ */
.firm-form-group {
    margin-bottom: var(--space-5, 20px);
}

.firm-form-group:last-child {
    margin-bottom: 0;
}

.firm-form-group > label {
    display: block;
    font-size: var(--font-size-sm, 13px);
    font-weight: var(--font-weight-semibold, 600);
    color: var(--color-text-secondary, #475569);
    margin-bottom: var(--space-2, 8px);
}

/* ============================================
   INPUTS, SELECTS, TEXTAREAS
   ============================================ */
.firm-form-group input:not([type="radio"]):not([type="checkbox"]),
.firm-form-group select,
.firm-form-group textarea {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border-radius: 6px;
    border: 1px solid var(--color-border, #e2e8f0);
    background: var(--color-surface, white);
    color: var(--color-text, #0f172a);
    font-size: 14px;
    font-family: inherit;
    line-height: 44px;
    transition: all var(--transition-normal, 0.15s ease);
    box-sizing: border-box;
}

.firm-form-group textarea {
    height: auto;
    padding: 12px 14px;
    line-height: 1.5;
}

.firm-form-group input:focus,
.firm-form-group select:focus,
.firm-form-group textarea:focus {
    outline: none;
    border-color: var(--color-info, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.firm-form-group input::placeholder,
.firm-form-group textarea::placeholder {
    color: var(--color-text-tertiary, #94a3b8);
}

/* Disabled/read-only inputs - clearly show non-editable */
.firm-form-group input:disabled,
.firm-form-group input[readonly],
.firm-form-group select:disabled,
.firm-form-group textarea:disabled,
.disabled-input {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #64748b;
    cursor: not-allowed;
    opacity: 1;  /* Override browser default opacity */
}

.firm-form-group input:disabled:focus,
.firm-form-group input[readonly]:focus,
.disabled-input:focus {
    outline: none;
    box-shadow: none;
    border-color: #e2e8f0;
}

/* Read-only label styling */
.firm-form-group.readonly > label {
    color: #94a3b8;
}

/* Explicit read-only field styling */
.firm-readonly-field {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px 14px;
    color: #64748b;
    font-size: 14px;
}

.firm-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Uppercase inputs (postcodes, etc) */
.firm-form-group input.uppercase {
    text-transform: uppercase;
}

/* Form field wrapper - allows nesting in firm-form-group */
.firm-form-group .form-field {
    flex: 1;
    min-width: 0;
}

/* Form field inline - puts multiple items on same line with gap */
.firm-form-group .form-field-inline {
    display: flex;
    align-items: stretch;
    gap: var(--space-3, 12px);
}

.firm-form-group .form-field-inline > select,
.firm-form-group .form-field-inline > input {
    flex: 1;
    min-width: 0;
}

.firm-form-group .form-field-inline > .firm-input-group {
    flex: 0 0 auto;
    min-width: 100px;
}

/* ============================================
   FORM GROUP INLINE - Side label pattern
   Label on left, input on right (desktop)
   Stacks on mobile automatically
   ============================================ */
.firm-form-group-inline {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4, 16px);
    margin-bottom: var(--space-5, 20px);
}

.firm-form-group-inline:last-child {
    margin-bottom: 0;
}

.firm-form-group-inline > label {
    flex: 0 0 120px;
    padding-top: var(--space-3, 12px);
    font-size: var(--font-size-sm, 13px);
    font-weight: var(--font-weight-semibold, 600);
    color: var(--color-text-secondary, #475569);
    text-align: left;
}

.firm-form-group-inline > .form-field {
    flex: 1;
    min-width: 0;
}

.firm-form-group-inline .form-field input:not([type="radio"]):not([type="checkbox"]),
.firm-form-group-inline .form-field select,
.firm-form-group-inline .form-field textarea {
    width: 100%;
    padding: var(--space-3, 12px) var(--space-4, 14px);
    border-radius: 6px;
    border: 1px solid var(--color-border, #e2e8f0);
    background: var(--color-surface, white);
    color: var(--color-text, #0f172a);
    font-size: var(--font-size-base, 14px);
    font-family: inherit;
    transition: all var(--transition-normal, 0.15s ease);
    box-sizing: border-box;
}

.firm-form-group-inline .form-field input:focus,
.firm-form-group-inline .form-field select:focus,
.firm-form-group-inline .form-field textarea:focus {
    outline: none;
    border-color: var(--color-info, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Inline field with input + button or input + hint side by side */
.firm-form-group-inline .form-field-inline {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
}

.firm-form-group-inline .form-field-inline > input,
.firm-form-group-inline .form-field-inline > select {
    flex: 1;
    min-width: 0;
}

/* ============================================
   FORM ROW - Side by side fields
   ============================================ */
.firm-form-row {
    display: flex;
    gap: var(--space-3, 12px);
}

.firm-form-row .firm-form-group {
    flex: 1;
}

/* ============================================
   INLINE FORM - Input with button
   ============================================ */
.firm-form-inline {
    display: flex;
    align-items: stretch;
    gap: var(--space-2, 8px);
}

.firm-form-inline input {
    flex: 1;
    min-width: 0;
}

/* ============================================
   INPUT WITH PREFIX/SUFFIX (£, %, etc)
   Must look like ONE unified field
   ============================================ */
.firm-input-group {
    display: flex;
    align-items: stretch;
}

/* Override form-group input styles - must be more specific than .firm-form-group input:not() */
.firm-input-group input:not([type="radio"]):not([type="checkbox"]),
.firm-form-group .firm-input-group input:not([type="radio"]):not([type="checkbox"]),
.firm-form-group .form-field .firm-input-group input:not([type="radio"]):not([type="checkbox"]),
.firm-form-group .form-field-inline .firm-input-group input:not([type="radio"]):not([type="checkbox"]) {
    flex: 1;
    min-width: 0;
    width: auto;
}

/* Input after prefix (prefix + input) - flat left, rounded right */
.firm-input-group .firm-input-prefix + input,
.firm-form-group .firm-input-group .firm-input-prefix + input {
    border-radius: 0 6px 6px 0 !important;
    border-left: none !important;
}

/* Input before suffix (input + suffix) - rounded left, flat right */
.firm-input-group input:first-child:has(+ .firm-input-suffix),
.firm-form-group .firm-input-group input:first-child:has(+ .firm-input-suffix) {
    border-radius: 6px 0 0 6px !important;
    border-right: none !important;
    border-left: 1px solid var(--color-border, #e2e8f0) !important;
}

/* Input with no prefix or suffix */
.firm-input-group input:only-child {
    border-radius: 6px;
}

.firm-input-prefix,
.firm-input-suffix {
    padding: var(--space-3, 12px) var(--space-3, 12px);
    font-size: var(--font-size-base, 14px);
    color: var(--color-text-secondary, #64748b);
    background: var(--color-surface-hover, #f8fafc);
    border: 1px solid var(--color-border, #e2e8f0);
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.firm-input-prefix {
    border-right: none;
    border-radius: 6px 0 0 6px;
}

.firm-input-suffix {
    border-left: none;
    border-radius: 0 6px 6px 0;
}

/* ============================================
   RADIO BUTTONS
   ============================================ */
.firm-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4, 16px) var(--space-6, 24px);
}

.firm-radio {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2, 8px);
    cursor: pointer;
    font-size: var(--font-size-base, 14px);
    font-weight: var(--font-weight-medium, 500);
    color: var(--color-text-secondary, #475569);
    line-height: 1;
}

.firm-radio input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--color-primary, #1e3a5f);
    cursor: pointer;
}

.firm-radio span {
    line-height: 1.2;
}

/* ============================================
   CHECKBOXES
   ============================================ */
.firm-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4, 16px) var(--space-6, 24px);
}

.firm-checkbox {
    display: flex;
    align-items: flex-start;  /* Top-align for multi-line labels */
    gap: var(--space-2, 8px);
    cursor: pointer;
    font-size: var(--font-size-base, 14px);
    color: var(--color-text, #1e293b);
}

.firm-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    margin-top: 2px;  /* Align with first line of text */
    flex-shrink: 0;   /* Don't squash the checkbox */
    accent-color: var(--color-primary, #1e3a5f);
    cursor: pointer;
}

/* ============================================
   TOGGLE BUTTONS (Segmented control)
   ============================================ */
.firm-toggle-group {
    display: inline-flex;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: var(--radius-md, 6px);
    overflow: hidden;
}

.firm-toggle-btn {
    padding: var(--space-2, 8px) var(--space-4, 16px);
    font-size: var(--font-size-sm, 13px);
    font-weight: var(--font-weight-medium, 500);
    background: var(--color-surface, white);
    border: none;
    border-right: 1px solid var(--color-border, #e2e8f0);
    color: var(--color-text-secondary, #64748b);
    cursor: pointer;
    transition: all var(--transition-normal, 0.15s ease);
}

.firm-toggle-btn:last-child {
    border-right: none;
}

.firm-toggle-btn:hover {
    background: var(--color-surface-hover, #f8fafc);
}

.firm-toggle-btn.active {
    background: var(--color-primary, #1e3a5f);
    color: var(--color-text-inverse, white);
}

.firm-toggle-group.small .firm-toggle-btn {
    padding: var(--space-1, 4px) var(--space-3, 12px);
    font-size: var(--font-size-sm, 12px);
}

/* ============================================
   HELPER TEXT
   ============================================ */
.firm-form-hint {
    font-size: var(--font-size-sm, 12px);
    color: var(--color-text-tertiary, #94a3b8);
    margin-top: var(--space-1, 4px);
}

.firm-form-error {
    font-size: var(--font-size-sm, 12px);
    color: var(--color-error-text, #dc2626);
    margin-top: var(--space-1, 4px);
}

/* ============================================
   SECTION HEADERS (for form sections)
   ============================================ */
.firm-form-section {
    margin-bottom: var(--space-6, 24px);
}

.firm-form-section:last-child {
    margin-bottom: 0;
}

.firm-form-section-title {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
    font-size: var(--font-size-xs, 11px);
    font-weight: var(--font-weight-semibold, 600);
    color: var(--color-text-secondary, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-4, 16px);
    padding-bottom: var(--space-2, 8px);
    border-bottom: 1px solid var(--color-border-light, #f1f5f9);
}

.firm-form-section-title i {
    font-size: var(--font-size-xs, 11px);
    color: var(--color-text-tertiary, #94a3b8);
}

/* ============================================
   REVIEW SECTIONS (SmartCapture & SmartWizard)
   Used for displaying data in read-only review format
   ============================================ */

/* Container for review content - centers and limits width */
.firm-review-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Info banner at top of review */
.firm-review-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    margin-bottom: 32px;
    color: #0369a1;
    font-size: 15px;
}

.firm-review-banner i {
    font-size: 18px;
    flex-shrink: 0;
}

/* Section with header */
.firm-review-section {
    background: white;
    border: 1px solid var(--color-border-light, #f1f5f9);
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.firm-review-section:last-child {
    margin-bottom: 0;
}

/* Section header with icon - supports icon + title + optional edit button */
.firm-review-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--color-surface-hover, #f8fafc);
    border-bottom: 1px solid var(--color-border-light, #f1f5f9);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text, #1e293b);
}

.firm-review-section-header i {
    color: var(--color-text-tertiary, #94a3b8);
    font-size: 14px;
    width: 18px;
    text-align: center;
}

/* Header with h3 and edit button pattern (used in SmartCapture edit mode) */
.firm-review-section-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text, #1e293b);
    flex: 1;
}

/* Edit link in header */
.firm-review-section-header .edit-link {
    background: none;
    border: none;
    color: var(--color-info, #3b82f6);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
}

.firm-review-section-header .edit-link:hover {
    text-decoration: underline;
}

/* Rows go directly under section - no content wrapper */
.firm-review-section > .firm-review-row {
    padding: 12px 20px;
}

.firm-review-section > .firm-review-row:first-of-type {
    padding-top: 16px;
}

.firm-review-section > .firm-review-row:last-of-type {
    padding-bottom: 16px;
}

/* Label-value row */
.firm-review-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border-light, #f1f5f9);
    font-size: 14px;
}

.firm-review-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.firm-review-row:first-child {
    padding-top: 0;
}

.firm-review-label {
    flex: 0 0 180px;
    color: var(--color-text-secondary, #64748b);
    font-weight: 500;
}

.firm-review-value {
    flex: 1;
    color: var(--color-text, #1e293b);
    font-weight: 500;
}

/* Empty/not set value styling */
.firm-review-value.empty {
    color: var(--color-text-tertiary, #94a3b8);
    font-style: italic;
}

/* Changed row styling - highlights modified fields in review mode */
.firm-review-row.changed {
    position: relative;
    background: #fefce8;
    border-left: 3px solid #eab308;
    margin: 8px 0;
    padding: 12px 90px 12px 16px;
    border-radius: 4px;
}

.firm-review-row.changed .firm-review-label {
    color: #92400e;
}

.firm-review-row.changed .firm-review-value {
    color: #a16207;
    font-weight: 600;
}

/* MODIFIED badge - positioned on right */
.firm-review-row.changed::after {
    content: "MODIFIED";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    padding: 2px 6px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #a16207;
    background: #fef08a;
    border-radius: 3px;
}

/* Old value → New value display for changed fields */
.old-value {
    color: #94a3b8;
    text-decoration: line-through;
    font-weight: 400;
}

.change-arrow {
    color: #a16207;
    margin: 0 6px;
    font-weight: 600;
}

/* Grid layout for multiple columns */
.firm-review-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

/* ============================================
   WIZARD STEP CONTENT
   Styles for step content inside SmartWizard
   ============================================ */

/* Step section - main container for step content */
.step-section {
    max-width: 700px;
}

.step-section h2 {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text, #1e293b);
}

.step-intro {
    margin: 0 0 24px 0;
    font-size: 15px;
    color: var(--color-text-secondary, #64748b);
    line-height: 1.5;
}

/* Form fields container */
.form-fields {
    display: flex;
    flex-direction: column;
    gap: 0; /* firm-form-group has its own margin */
}

/* Help/info banner */
.help-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    margin-bottom: 24px;
    color: #0369a1;
    font-size: 14px;
    line-height: 1.5;
}

.help-banner i {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
    color: #0ea5e9;
}

.help-banner strong {
    color: #0c4a6e;
}

/* ============================================
   WRAPPER CARDS - Selection cards in wizards
   ============================================ */

.wrapper-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wrapper-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: white;
    border: 2px solid var(--color-border, #e2e8f0);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.wrapper-card:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.wrapper-card.selected {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.wrapper-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 12px;
    flex-shrink: 0;
}

.wrapper-icon i {
    font-size: 22px;
    color: #64748b;
}

.wrapper-card.selected .wrapper-icon {
    background: #dbeafe;
}

.wrapper-card.selected .wrapper-icon i {
    color: #3b82f6;
}

/* ISA specific icon color */
.wrapper-icon.isa {
    background: #fef3c7;
}

.wrapper-icon.isa i {
    color: #f59e0b;
}

.wrapper-card.selected .wrapper-icon.isa {
    background: #fef3c7;
}

.wrapper-card.selected .wrapper-icon.isa i {
    color: #d97706;
}

/* Pension specific icon color */
.wrapper-icon.pension {
    background: #d1fae5;
}

.wrapper-icon.pension i {
    color: #10b981;
}

.wrapper-card.selected .wrapper-icon.pension {
    background: #d1fae5;
}

.wrapper-card.selected .wrapper-icon.pension i {
    color: #059669;
}

.wrapper-info {
    flex: 1;
}

.wrapper-info h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text, #1e293b);
}

.wrapper-info p {
    margin: 0;
    font-size: 14px;
    color: var(--color-text-secondary, #64748b);
    line-height: 1.4;
}

.selected-check {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3b82f6;
    border-radius: 50%;
    flex-shrink: 0;
}

.selected-check i {
    color: white;
    font-size: 14px;
}

/* Model select with preview button */
.model-select-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.model-select-row select {
    flex: 1;
    min-width: 0;
}

.preview-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    background: white;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.15s;
}

.preview-btn:hover {
    background: #f8fafc;
    color: #3b82f6;
    border-color: #3b82f6;
}

/* Readonly input styling */
.readonly-input {
    background: #f8fafc !important;
    color: #64748b !important;
    cursor: not-allowed;
}

/* Loading inline */
.loading-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    color: #64748b;
    font-size: 14px;
}

.loading-inline i {
    color: #3b82f6;
}

/* Toggle aliases (use firm-toggle-* classes in new code) */
.toggle-group {
    display: inline-flex;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 6px;
    overflow: hidden;
}

.toggle-btn {
    padding: 10px 20px;
    background: white;
    border: none;
    border-right: 1px solid var(--color-border, #e2e8f0);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    transition: all 0.15s;
}

.toggle-btn:last-child {
    border-right: none;
}

.toggle-btn:hover {
    background: #f8fafc;
}

.toggle-btn.active {
    background: #3b82f6;
    color: white;
}

/* ============================================
   BENEFICIARY LIST (Pension wizards)
   ============================================ */

.beneficiary-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.beneficiary-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: white;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 8px;
}

.beneficiary-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.beneficiary-fields input,
.beneficiary-fields select {
    padding: 10px 12px;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.beneficiary-fields input:focus,
.beneficiary-fields select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.beneficiary-fields .name-input {
    flex: 1;
    min-width: 120px;
}

.beneficiary-fields select {
    flex: 1;
    min-width: 140px;
}

.percentage-input {
    display: flex;
    align-items: center;
    width: 90px;
}

.percentage-input input {
    width: 60px;
    text-align: right;
    border-radius: 6px 0 0 6px;
}

.percentage-suffix {
    padding: 10px 12px;
    background: #f1f5f9;
    border: 1px solid var(--color-border, #e2e8f0);
    border-left: none;
    border-radius: 0 6px 6px 0;
    font-size: 14px;
    color: #64748b;
}

.percentage-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    color: #0369a1;
    font-size: 14px;
    margin-bottom: 16px;
}

.percentage-warning.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.percentage-warning.highlighted {
    animation: pulse 0.3s ease-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.remove-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 6px;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.15s;
}

.remove-btn:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.add-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: white;
    border: 1px dashed var(--color-border, #e2e8f0);
    border-radius: 8px;
    cursor: pointer;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.add-btn:hover {
    background: #f8fafc;
    border-color: #3b82f6;
    color: #3b82f6;
}

/* Field validation error */
.field-error {
    border-color: #dc2626 !important;
    background: #fef2f2 !important;
}

/* Warning banner variant */
.help-banner.warning {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}

.help-banner.warning i {
    color: #f59e0b;
}

.help-banner.warning strong {
    color: #78350f;
}

.help-banner.error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

.help-banner.error i {
    color: #dc2626;
}

.help-banner.error strong {
    color: #7f1d1d;
}

.help-banner.error p {
    margin: 4px 0 8px 0;
}

.banner-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #dc2626;
    font-weight: 500;
    text-decoration: none;
}

.banner-link:hover {
    text-decoration: underline;
}

/* Eligibility Summary Panel */
.eligibility-summary {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.eligibility-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #166534;
    margin-bottom: 12px;
}

.eligibility-header i {
    color: #22c55e;
}

.eligibility-items {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 32px;
}

.eligibility-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.eligibility-label {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.eligibility-value {
    font-size: 14px;
    color: #1f2937;
    font-weight: 500;
}

/* No schemes warning */
.no-schemes-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    color: #92400e;
    font-size: 14px;
}

/* ============================================
   PAGE STATE STYLES (Loading, Error, Success)
   ============================================ */

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 200px;
    color: #64748b;
    font-size: 15px;
}

.loading-state i {
    color: #3b82f6;
    font-size: 20px;
}

.error-page {
    padding: 48px;
}

.error-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 15px;
}

.error-banner i {
    font-size: 18px;
}

.success-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 48px;
}

.success-content {
    text-align: center;
    max-width: 400px;
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #d1fae5;
    border-radius: 50%;
}

.success-icon i {
    font-size: 40px;
    color: #10b981;
}

.success-content h1 {
    margin: 0 0 12px;
    font-size: 24px;
    font-weight: 600;
    color: #1e293b;
}

.success-content p {
    margin: 0 0 32px;
    font-size: 15px;
    color: #64748b;
    line-height: 1.5;
}

.success-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* Submit error styling */
.submit-error {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    margin-bottom: 24px;
}

.submit-error i {
    color: #dc2626;
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.submit-error .error-content strong {
    display: block;
    color: #dc2626;
    margin-bottom: 8px;
}

.submit-error .error-message {
    margin: 0;
    font-size: 12px;
    color: #64748b;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 4px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.submit-error .error-status {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    color: #94a3b8;
}

/* ============================================
   MODAL STYLES
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.modal-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    border-radius: 6px;
    transition: all 0.15s;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #64748b;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.modal-body h3 {
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
}

.modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px;
    color: #64748b;
}

.modal-loading i {
    color: #3b82f6;
    font-size: 20px;
}

/* Volatility badge */
.volatility-badge {
    padding: 4px 10px;
    background: #f1f5f9;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
}

/* Holdings table */
.holdings-table {
    width: 100%;
    border-collapse: collapse;
}

.holdings-table th,
.holdings-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

.holdings-table th {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.holdings-table td {
    font-size: 14px;
    color: #1e293b;
}

.holdings-table .allocation-col {
    width: 180px;
}

.asset-link {
    background: none;
    border: none;
    padding: 0;
    color: #3b82f6;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.asset-link:hover {
    text-decoration: underline;
}

.asset-link i {
    font-size: 10px;
    opacity: 0.7;
}

.allocation-bar-wrapper {
    width: 100px;
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.allocation-bar {
    height: 100%;
    background: #3b82f6;
    border-radius: 4px;
}

.allocation-pct {
    font-size: 13px;
    color: #64748b;
}

.no-holdings {
    text-align: center;
    padding: 32px;
    color: #94a3b8;
    font-style: italic;
}

/* Back button in header */
.back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.15s;
}

.back-btn:hover {
    background: #f8fafc;
    color: #1e293b;
}

/* Primary/Secondary buttons (wizard variants) */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: white;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    color: #475569;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* Modal form buttons - uses tokens for theming */
.btn-save {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-save:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-cancel {
    padding: 10px 20px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-cancel:hover {
    background: var(--color-surface-hover);
}

.btn-delete {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--color-error-light);
    background: var(--color-error-light);
    color: var(--color-error-text);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-delete:hover:not(:disabled) {
    background: var(--color-error);
    border-color: var(--color-error);
    color: var(--color-text-inverse);
}

.btn-delete:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Required field marker */
.required {
    color: var(--color-error-text);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 500px) {
    .firm-form-row {
        flex-direction: column;
    }

    /* Inline form groups stack on mobile */
    .firm-form-group-inline {
        flex-direction: column;
        gap: var(--space-2, 8px);
    }

    .firm-form-group-inline > label {
        flex: none;
        padding-top: 0;
    }

    .firm-form-group-inline .form-field-inline {
        flex-wrap: wrap;
    }

    .firm-radio-group,
    .firm-checkbox-group {
        flex-direction: column;
        gap: var(--space-3, 12px);
    }

    .firm-toggle-group {
        width: 100%;
    }

    .firm-toggle-btn {
        flex: 1;
    }

    .firm-form-inline {
        flex-wrap: wrap;
    }

    /* Review sections stack on mobile */
    .firm-review-row {
        flex-direction: column;
        gap: 4px;
    }

    .firm-review-label {
        flex: none;
    }

    .firm-review-grid {
        grid-template-columns: 1fr;
    }
}
