/* ============================================================================
   MONEY MAP — COMPONENT STYLES
   File: css/components.css
   Description: Visual styles for all reusable UI components. Every screen
   in the application is assembled from these building blocks.
   Load order: tokens.css → reset.css → layout.css → components.css → views.css
   ============================================================================ */


/* ============================================================================
   1. BUTTONS
   Primary, secondary, danger, and ghost variants.
   All buttons meet the 44px minimum touch target requirement.
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-height: var(--touch-target);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.btn:disabled,
.btn--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Loading state */
.btn--loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn--loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: var(--radius-full);
    animation: spin 0.6s linear infinite;
    color: var(--text-inverse);
}

/* Primary button — main actions */
.btn--primary {
    background-color: var(--brand-primary);
    color: var(--text-inverse);
    border-color: var(--brand-primary);
}

.btn--primary:hover {
    background-color: var(--brand-primary-hover);
    border-color: var(--brand-primary-hover);
}

.btn--primary:active {
    background-color: var(--brand-primary-active);
}

/* Secondary button — secondary actions */
.btn--secondary {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-default);
}

.btn--secondary:hover {
    background-color: var(--bg-hover);
    border-color: var(--border-dark);
}

/* Danger button — destructive actions */
.btn--danger {
    background-color: var(--status-error-icon);
    color: var(--text-inverse);
    border-color: var(--status-error-icon);
}

.btn--danger:hover {
    background-color: #dc2626;
    border-color: #dc2626;
}

/* Ghost button — subtle, text-only actions */
.btn--ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn--ghost:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* Link button — looks like a link */
.btn--link {
    background: none;
    border: none;
    color: var(--brand-primary);
    padding: var(--space-xs) var(--space-sm);
    min-height: auto;
}

.btn--link:hover {
    color: var(--brand-primary-hover);
    text-decoration: underline;
}

/* Size variants */
.btn--sm {
    min-height: 36px;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
}

.btn--lg {
    min-height: 52px;
    padding: var(--space-md) var(--space-lg);
    font-size: var(--font-size-base);
}

/* Full width button */
.btn--full {
    width: 100%;
}

/* Icon-only button */
.btn--icon {
    width: var(--touch-target);
    height: var(--touch-target);
    padding: 0;
    border-radius: var(--radius-md);
}

.btn--icon.btn--sm {
    width: 36px;
    height: 36px;
}


/* ============================================================================
   2. CARDS
   Content containers with white background, border, and subtle shadow.
   Used for dashboard widgets, transaction items, settings panels, etc.
   ============================================================================ */

.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-md);
    border-bottom: 1px solid var(--border-light);
}

.card__title {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.card__subtitle {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: 2px;
}

.card__body {
    padding: var(--space-md);
}

.card__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--border-light);
    background-color: var(--bg-main);
}

/* Stat card — used for dashboard KPIs */
.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.stat-card__label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    margin-bottom: var(--space-xs);
}

.stat-card__value {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    font-family: var(--font-mono);
    letter-spacing: var(--letter-spacing-tight);
    line-height: var(--line-height-tight);
}

@media (min-width: 640px) {
    .stat-card__value {
        font-size: var(--font-size-3xl);
    }
}

.stat-card__change {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    margin-top: var(--space-xs);
}

.stat-card__change--up {
    color: var(--status-success-text);
}

.stat-card__change--down {
    color: var(--status-error-text);
}

.stat-card__icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-sm);
}

.stat-card__icon--primary {
    background-color: var(--brand-primary-light);
    color: var(--brand-primary);
}

.stat-card__icon--success {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
}

.stat-card__icon--warning {
    background-color: var(--status-warning-bg);
    color: var(--status-warning-text);
}

.stat-card__icon--error {
    background-color: var(--status-error-bg);
    color: var(--status-error-text);
}

/* Clickable card */
.card--clickable {
    cursor: pointer;
    transition: all var(--transition-fast);
}

.card--clickable:hover {
    border-color: var(--border-dark);
    box-shadow: var(--shadow-md);
}


/* ============================================================================
   3. FORM CONTROLS
   Inputs, selects, textareas, labels, and form groups.
   All inputs meet the 44px minimum touch target.
   ============================================================================ */

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.form-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

.form-label--required::after {
    content: ' *';
    color: var(--status-error-icon);
}

.form-hint {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

.form-input {
    width: 100%;
    min-height: var(--touch-target);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:hover {
    border-color: var(--border-dark);
}

.form-input:focus {
    background-color: var(--bg-input-focus);
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
    outline: none;
}

/* Validation states */
.form-input--error {
    border-color: var(--border-error);
    background-color: var(--status-error-bg);
}

.form-input--error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.form-input--success {
    border-color: var(--border-success);
}

.form-error {
    font-size: var(--font-size-xs);
    color: var(--status-error-text);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

/* Select dropdown */
.form-select {
    width: 100%;
    min-height: var(--touch-target);
    padding: var(--space-sm) var(--space-md);
    padding-right: var(--space-xl);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.form-select:focus {
    background-color: var(--bg-input-focus);
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
    outline: none;
}

/* Textarea */
.form-textarea {
    width: 100%;
    min-height: 100px;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    resize: vertical;
    transition: all var(--transition-fast);
    line-height: var(--line-height-normal);
}

.form-textarea:focus {
    background-color: var(--bg-input-focus);
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
    outline: none;
}

/* Checkbox and Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: var(--touch-target);
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--brand-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.form-check__label {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

/* Currency input wrapper */
.currency-input {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-input__symbol {
    position: absolute;
    left: var(--space-md);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 1;
}

.currency-input .form-input {
    padding-left: var(--space-xl);
    font-family: var(--font-mono);
    font-weight: var(--font-weight-medium);
}

/* Form row — side-by-side inputs */
.form-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

@media (min-width: 640px) {
    .form-row {
        flex-direction: row;
    }

    .form-row > .form-group {
        flex: 1;
    }
}


/* ============================================================================
   4. MODALS & DIALOGS
   Overlay popups for confirmations, forms, and detail views.
   ============================================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-overlay);
    padding: var(--space-md);
    animation: modalOverlayIn var(--transition-fast) ease;
}

.modal-overlay--active {
    display: flex;
}

@keyframes modalOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn var(--transition-base) ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
}

.modal__title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.modal__close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: none;
    border: none;
    font-size: var(--font-size-lg);
}

.modal__close:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.modal__body {
    padding: var(--space-lg);
    overflow-y: auto;
    flex: 1;
}

.modal__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-default);
    flex-shrink: 0;
}

/* Full-screen modal on mobile */
@media (max-width: 639px) {
    .modal {
        max-width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        height: 100%;
        border-radius: 0;
    }
}

/* Confirm dialog variant */
.confirm-dialog__message {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    line-height: var(--line-height-relaxed);
}

.confirm-dialog__warning {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
    background-color: var(--status-warning-bg);
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
}

.confirm-dialog__warning i {
    color: var(--status-warning-text);
    margin-top: 2px;
}

.confirm-dialog__warning p {
    font-size: var(--font-size-sm);
    color: var(--status-warning-text);
}


/* ============================================================================
   5. TOAST NOTIFICATIONS
   Temporary feedback messages that appear at the top of the screen.
   Auto-dismiss after 4 seconds. Manual dismiss available.
   ============================================================================ */

.toast-container {
    position: fixed;
    top: var(--space-md);
    right: var(--space-md);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-width: 400px;
    width: calc(100% - var(--space-xl));
    pointer-events: none;
}

@media (max-width: 639px) {
    .toast-container {
        left: var(--space-md);
        right: var(--space-md);
        max-width: none;
    }
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toastSlideIn var(--transition-slide) ease;
}

.toast--removing {
    animation: toastSlideOut var(--transition-fast) ease forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast__icon {
    font-size: var(--font-size-lg);
    flex-shrink: 0;
    margin-top: 1px;
}

.toast__content {
    flex: 1;
    min-width: 0;
}

.toast__title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.toast__message {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: 2px;
}

.toast__dismiss {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: var(--font-size-sm);
}

.toast__dismiss:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* Toast variants */
.toast--success {
    border-left: 4px solid var(--status-success-icon);
}

.toast--success .toast__icon {
    color: var(--status-success-icon);
}

.toast--error {
    border-left: 4px solid var(--status-error-icon);
}

.toast--error .toast__icon {
    color: var(--status-error-icon);
}

.toast--warning {
    border-left: 4px solid var(--status-warning-icon);
}

.toast--warning .toast__icon {
    color: var(--status-warning-icon);
}

.toast--info {
    border-left: 4px solid var(--status-info-icon);
}

.toast--info .toast__icon {
    color: var(--status-info-icon);
}


/* ============================================================================
   6. BADGES & TAGS
   Small status indicators and labels.
   ============================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 2px var(--space-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-full);
    white-space: nowrap;
    line-height: 1.5;
}

.badge--success {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
}

.badge--warning {
    background-color: var(--status-warning-bg);
    color: var(--status-warning-text);
}

.badge--error {
    background-color: var(--status-error-bg);
    color: var(--status-error-text);
}

.badge--info {
    background-color: var(--status-info-bg);
    color: var(--status-info-text);
}

.badge--neutral {
    background-color: var(--bg-hover);
    color: var(--text-secondary);
}

/* Dot indicator */
.badge__dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background-color: currentColor;
}


/* ============================================================================
   7. ALERTS & BANNERS
   Inline messages for warnings, tips, and important information.
   ============================================================================ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
}

.alert__icon {
    font-size: var(--font-size-lg);
    flex-shrink: 0;
    margin-top: 1px;
}

.alert__content {
    flex: 1;
    min-width: 0;
}

.alert__title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 2px;
}

.alert__message {
    font-size: var(--font-size-sm);
    line-height: var(--line-height-relaxed);
}

.alert--success {
    background-color: var(--status-success-bg);
    border-color: var(--status-success-border);
    color: var(--status-success-text);
}

.alert--warning {
    background-color: var(--status-warning-bg);
    border-color: var(--status-warning-border);
    color: var(--status-warning-text);
}

.alert--error {
    background-color: var(--status-error-bg);
    border-color: var(--status-error-border);
    color: var(--status-error-text);
}

.alert--info {
    background-color: var(--status-info-bg);
    border-color: var(--status-info-border);
    color: var(--status-info-text);
}


/* ============================================================================
   8. TABLES
   Responsive data tables with horizontal scroll on mobile.
   ============================================================================ */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background-color: var(--bg-surface);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.table th {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    background-color: var(--bg-main);
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.table td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background-color: var(--bg-hover);
}

/* Numeric columns — right-aligned for financial data */
.table td.text-right,
.table th.text-right {
    text-align: right;
}

.table .amount {
    font-family: var(--font-mono);
    font-weight: var(--font-weight-medium);
}

.table .amount--income {
    color: var(--text-income);
}

.table .amount--expense {
    color: var(--text-expense);
}


/* ============================================================================
   9. TABS
   Tab navigation for switching between related views.
   ============================================================================ */

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-default);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: var(--touch-target);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover {
    color: var(--text-primary);
}

.tab--active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
    font-weight: var(--font-weight-semibold);
}


/* ============================================================================
   10. PROGRESS BARS
   Visual indicators for goals, budgets, and loading states.
   ============================================================================ */

.progress {
    width: 100%;
    height: 8px;
    background-color: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress__bar {
    height: 100%;
    border-radius: var(--radius-full);
    background-color: var(--brand-primary);
    transition: width var(--transition-slow);
    min-width: 0;
}

.progress__bar--success {
    background-color: var(--status-success-icon);
}

.progress__bar--warning {
    background-color: var(--status-warning-icon);
}

.progress__bar--error {
    background-color: var(--status-error-icon);
}

.progress--lg {
    height: 12px;
}

.progress--sm {
    height: 4px;
}

/* Progress label row */
.progress-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.progress-label__text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.progress-label__value {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    font-family: var(--font-mono);
}


/* ============================================================================
   11. LISTS
   Styled lists for transactions, items, and menu options.
   ============================================================================ */

.list {
    display: flex;
    flex-direction: column;
}

.list-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-light);
    transition: background-color var(--transition-fast);
    min-height: var(--touch-target);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background-color: var(--bg-hover);
}

.list-item__icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    flex-shrink: 0;
}

.list-item__content {
    flex: 1;
    min-width: 0;
}

.list-item__title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item__subtitle {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 1px;
}

.list-item__amount {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    flex-shrink: 0;
}

.list-item__amount--income {
    color: var(--text-income);
}

.list-item__amount--expense {
    color: var(--text-expense);
}


/* ============================================================================
   12. AVATARS & ICONS
   ============================================================================ */

.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    flex-shrink: 0;
}

.avatar--sm {
    width: 32px;
    height: 32px;
    font-size: var(--font-size-xs);
}

.avatar--lg {
    width: 56px;
    height: 56px;
    font-size: var(--font-size-xl);
}

.avatar--primary {
    background-color: var(--brand-primary-light);
    color: var(--brand-primary);
}

.avatar--accent {
    background-color: var(--brand-accent-light);
    color: var(--brand-accent);
}

/* Icon circle */
.icon-circle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-base);
    flex-shrink: 0;
}

.icon-circle--sm {
    width: 32px;
    height: 32px;
    font-size: var(--font-size-sm);
}


/* ============================================================================
   13. DIVIDERS & SEPARATORS
   ============================================================================ */

.divider {
    height: 1px;
    background-color: var(--border-default);
    margin: var(--space-md) 0;
}

.divider--sm {
    margin: var(--space-sm) 0;
}

.divider--lg {
    margin: var(--space-lg) 0;
}


/* ============================================================================
   14. TOOLTIPS (CSS-only for simple cases)
   ============================================================================ */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-xs) var(--space-sm);
    background-color: var(--brand-dark);
    color: var(--text-inverse);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: var(--z-tooltip);
}

[data-tooltip]:hover::after {
    opacity: 1;
}


/* ============================================================================
   15. SKELETON LOADERS
   Placeholder animations while data is loading.
   ============================================================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-input) 25%,
        var(--bg-hover) 50%,
        var(--bg-input) 75%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton--text {
    height: 16px;
    width: 100%;
    margin-bottom: var(--space-sm);
}

.skeleton--text-sm {
    height: 12px;
    width: 60%;
}

.skeleton--heading {
    height: 24px;
    width: 40%;
    margin-bottom: var(--space-md);
}

.skeleton--avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.skeleton--card {
    height: 120px;
    border-radius: var(--radius-lg);
}


/* ============================================================================
   16. CONTEXT SWITCHER
   Toggle between Personal and Business views.
   ============================================================================ */

.context-switcher {
    display: inline-flex;
    background-color: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 2px;
}

.context-switcher__option {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.context-switcher__option--active {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-xs);
    font-weight: var(--font-weight-semibold);
}

.context-switcher__option:hover:not(.context-switcher__option--active) {
    color: var(--text-primary);
}


/* ============================================================================
   17. PERIOD SELECTOR
   Date range picker for dashboards and reports.
   ============================================================================ */

.period-selector {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.period-selector__btn {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    background: none;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 32px;
}

.period-selector__btn:hover {
    border-color: var(--border-dark);
    color: var(--text-primary);
}

.period-selector__btn--active {
    background-color: var(--brand-primary);
    color: var(--text-inverse);
    border-color: var(--brand-primary);
}


/* ============================================================================
   18. SEARCH BAR
   ============================================================================ */

.search-bar {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-bar__icon {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    pointer-events: none;
}

.search-bar .form-input {
    padding-left: var(--space-xl);
}


/* ============================================================================
   19. DROPDOWN MENU
   ============================================================================ */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown__menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: var(--z-dropdown);
    min-width: 180px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-xs) 0;
    display: none;
}

.dropdown__menu--open {
    display: block;
    animation: dropdownIn var(--transition-fast) ease;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown__item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color var(--transition-fast);
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    min-height: 40px;
}

.dropdown__item:hover {
    background-color: var(--bg-hover);
}

.dropdown__item--danger {
    color: var(--status-error-text);
}

.dropdown__item--danger:hover {
    background-color: var(--status-error-bg);
}

.dropdown__divider {
    height: 1px;
    background-color: var(--border-light);
    margin: var(--space-xs) 0;
}


/* ============================================================================
   20. CONNECTION STATUS BANNER
   Shows when the user is offline or reconnecting.
   ============================================================================ */

.connection-banner {
    display: none;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    text-align: center;
    z-index: var(--z-sticky);
}

.connection-banner--offline {
    display: flex;
    background-color: var(--status-error-bg);
    color: var(--status-error-text);
}

.connection-banner--reconnecting {
    display: flex;
    background-color: var(--status-warning-bg);
    color: var(--status-warning-text);
}