@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --accent: #2563eb;
    --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --gradient-hover: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    --gradient-card: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
    --radius: 20px;
    --radius-sm: 12px;
    --radius-pill: 9999px;

    /* Design Intelligence Shadow Elevation System */
    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --shadow-btn-primary: 0 4px 12px -2px rgba(79, 70, 229, 0.35), 0 2px 4px -2px rgba(79, 70, 229, 0.2);
    --shadow-btn-primary-hover: 0 8px 20px -4px rgba(79, 70, 229, 0.45), 0 4px 6px -2px rgba(79, 70, 229, 0.25);
    --shadow-fab: 0 10px 20px -3px rgba(79, 70, 229, 0.38), 0 4px 6px -2px rgba(79, 70, 229, 0.22);
    --shadow-fab-hover: 0 14px 28px -4px rgba(79, 70, 229, 0.48), 0 6px 10px -3px rgba(79, 70, 229, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    touch-action: pan-x pan-y;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    padding-bottom: max(90px, calc(env(safe-area-inset-bottom, 0px) + 80px));
    overflow-x: hidden;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    margin-top: 6px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    background: var(--card-bg);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.icon-btn:active {
    transform: scale(0.92);
}

.user-badge-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    padding: 6px 12px 6px 6px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gradient);
    color: white;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-name-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Cloud Banner */
.cloud-sync-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 20px;
    font-size: 12.5px;
    color: var(--primary-dark);
}

.cloud-sync-bar.hidden {
    display: none;
}

.cloud-sync-bar .btn-link {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 12.5px;
    cursor: pointer;
    text-decoration: underline;
}

/* Dashboard Card */
.dashboard {
    background: var(--gradient);
    border-radius: var(--radius);
    padding: 24px;
    color: white;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.dashboard:active {
    transform: scale(0.99);
}

.dash-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.dash-filter-pill {
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11.5px;
    font-weight: 600;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    user-select: none;
}

.dash-filter-pill:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}

.dash-pill-close {
    opacity: 0.75;
    font-size: 10px;
    margin-left: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
}

.dash-pill-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.35);
}

.dash-label {
    font-size: 13.5px;
    opacity: 0.9;
    margin-bottom: 0;
    font-weight: 500;
}

.dash-total {
    font-size: 38px;
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -1px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.dash-footer {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 14px;
}

/* Filters & Categories Section */
.filter-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 22px;
    position: relative;
    z-index: 5;
}

/* Freq Switch: Segmented Pill Style */
.freq-switch {
    display: flex;
    background: #e2e8f0;
    padding: 4px;
    border-radius: var(--radius-pill);
    gap: 4px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 2;
}

.freq-switch .filter-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    text-align: center;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    -webkit-tap-highlight-color: transparent;
}

.freq-switch .filter-btn:hover:not(.active) {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.5);
}

.freq-switch .filter-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 8px -1px rgba(15, 23, 42, 0.12), 0 1px 3px 0 rgba(15, 23, 42, 0.08);
}

/* Category Filter Chips Bar - With breathing room so shadows never get clipped */
.category-filters-wrapper {
    position: relative;
    margin: 0 -20px;
    padding: 0;
    z-index: 1;
}

.category-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 20px 12px 20px;
    margin-top: -4px;
    margin-bottom: -4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.category-filters::-webkit-scrollbar { display: none; }

.cat-chip {
    background: var(--card-bg);
    border: 1px solid #e2e8f0;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.cat-chip:hover {
    border-color: #cbd5e1;
    color: var(--text-main);
    transform: translateY(-1.5px);
    box-shadow: 0 4px 12px -1px rgba(15, 23, 42, 0.12);
}

.cat-chip:active {
    transform: scale(0.96);
}

.cat-chip.active {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
    box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.25);
}

.cat-chip .cat-count {
    background: rgba(148, 163, 184, 0.2);
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.cat-chip.active .cat-count {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

/* Subscriptions List */
.subs-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card-swipe-container {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.02);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
    opacity: 0;
    transform: translateY(16px);
    animation: fadeInUp 0.45s forwards ease-out;
}

.card-swipe-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.08), 0 3px 6px -1px rgba(15, 23, 42, 0.04);
}

.card-swipe-container:active {
    transform: scale(0.995);
}

.swipe-action {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    opacity: 0;
    transform: scale(0.72);
    transition: opacity 0.14s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
    z-index: 1;
}

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

.swipe-action-freeze {
    right: 0;
    background: #3b82f6;
}

.card-swipe-container.swiping-left .swipe-action-delete,
.card-swipe-container.swiping-right .swipe-action-freeze {
    opacity: 1;
    transform: scale(1);
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    align-items: center;
    box-shadow: none;
    cursor: pointer;
    touch-action: pan-y;
    user-select: none;
    position: relative;
    z-index: 2;
    transition: background-color 0.2s ease;
}

.card.frozen {
    opacity: 0.6;
    filter: grayscale(0.5);
}

.card.frozen .price-amount {
    color: var(--text-muted);
}

.emoji-icon {
    width: 50px;
    height: 50px;
    background: #f8fafc;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
    flex-shrink: 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.card-content {
    flex-grow: 1;
    min-width: 0;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.mensile { background: #e0e7ff; color: #4338ca; }
.badge.annuale { background: #fef3c7; color: #b45309; }

.frozen-label {
    background: #e0f2fe;
    color: #0369a1;
    font-size: 10.5px;
    font-weight: 600;
    border-radius: 6px;
    padding: 2px 6px;
}

.card-price {
    text-align: right;
    margin-left: 12px;
    flex-shrink: 0;
}

.price-amount {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
}

.price-freq {
    font-size: 11px;
    color: var(--text-muted);
}

/* FAB */
.fab {
    position: fixed;
    bottom: max(25px, calc(env(safe-area-inset-bottom, 0px) + 20px));
    right: max(25px, calc(env(safe-area-inset-right, 0px) + 20px));
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient);
    color: #ffffff;
    border: none;
    box-shadow: var(--shadow-fab);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    line-height: 0;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background 0.2s ease;
    z-index: 100;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.fab-icon {
    width: 26px;
    height: 26px;
    stroke: currentColor;
    display: block;
    pointer-events: none;
    flex-shrink: 0;
}

.fab:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: var(--shadow-fab-hover);
}

.fab:active {
    transform: scale(0.92);
    box-shadow: var(--shadow-btn-primary);
}

/* Custom Category Selector in Modal */
.category-picker-container {
    position: relative;
    width: 100%;
}

.category-picker-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14.5px;
    font-family: inherit;
    color: var(--text-main);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    text-align: left;
    box-sizing: border-box;
}

.category-picker-trigger:focus,
.category-picker-trigger.open {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.category-picker-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
}

.cat-selected-emoji {
    font-size: 19px;
    line-height: 1;
    flex-shrink: 0;
}

.cat-selected-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}

.cat-selected-name.cat-selected-placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.cat-picker-arrow {
    font-size: 11px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    margin-left: 8px;
    flex-shrink: 0;
}

.category-picker-trigger.open .cat-picker-arrow {
    transform: rotate(180deg);
}

.category-picker-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
    z-index: 150;
    overflow: hidden;
    animation: dropdownFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.category-picker-search-wrap {
    padding: 10px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}

.category-picker-search-wrap input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 9px;
    font-size: 13.5px;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.category-picker-search-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12);
}

.category-picker-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.category-picker-list::-webkit-scrollbar {
    width: 6px;
}
.category-picker-list::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.cat-picker-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    user-select: none;
}

.cat-picker-option:hover {
    background: #f1f5f9;
}

.cat-picker-option.active {
    background: #eef2ff;
}

.cat-picker-option-emoji {
    font-size: 19px;
    flex-shrink: 0;
    line-height: 1;
}

.cat-picker-option-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cat-picker-option-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-picker-option.active .cat-picker-option-title {
    color: var(--primary);
}

.cat-picker-option-desc {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.cat-picker-custom-add {
    padding: 10px 12px;
    background: #f0fdf4;
    border: 1.5px dashed #86efac;
    border-radius: 9px;
    color: #166534;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    transition: background 0.15s, border-color 0.15s;
}

.cat-picker-custom-add:hover {
    background: #dcfce7;
    border-color: #4ade80;
}

/* Category Badge in Card */
.badge.cat-badge {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 95px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #0f172a;
    color: white;
    padding: 12px 22px;
    border-radius: 30px;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Modals & Overlays */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: white;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-radius: 28px 28px 0 0;
    padding: 26px 26px max(26px, calc(env(safe-area-inset-bottom, 0px) + 20px)) 26px;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@media (min-width: 601px) {
    .overlay {
        align-items: center;
        justify-content: center;
        padding: 24px;
    }
    .modal {
        border-radius: 24px;
        transform: translateY(24px) scale(0.96);
        box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    }
    .overlay.show .modal {
        transform: translateY(0) scale(1);
    }
}

.overlay.show .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.4px;
}

.modal-close {
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* Forms */
.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 13px 15px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    color: var(--text-main);
    background: #f8fafc;
    transition: all 0.2s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.row2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Password Input Wrapper & Eye Toggle */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-input-wrapper input {
    padding-right: 48px !important;
}

.password-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s ease, background-color 0.2s ease;
    padding: 0;
    margin: 0;
    -webkit-tap-highlight-color: transparent;
}

.password-toggle-btn:hover {
    color: var(--text-main);
    background: rgba(148, 163, 184, 0.15);
}

.password-toggle-btn:active {
    transform: translateY(-50%) scale(0.92);
}

.password-toggle-btn .eye-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    display: block;
    pointer-events: none;
}

/* Field Error Highlight */
.field input.field-error {
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
    animation: shakeError 0.35s ease-in-out;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* Emoji Picker */
.emoji-picker {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    max-height: 140px;
    overflow-y: auto;
    padding: 6px;
    background: #f8fafc;
    border-radius: 14px;
    border: 1.5px solid #e2e8f0;
}

.emoji-opt {
    font-size: 22px;
    text-align: center;
    padding: 6px 0;
    cursor: pointer;
    border-radius: 10px;
    transition: transform 0.15s ease, background 0.15s ease;
}

.emoji-opt:hover, .emoji-opt.active {
    background: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transform: scale(1.15);
}

/* Buttons */
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.btn {
    flex: 1;
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 700;
    font-size: 14.5px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: var(--shadow-btn-primary);
}

.btn-primary:hover {
    background: var(--gradient-hover);
    box-shadow: var(--shadow-btn-primary-hover);
}

.btn-secondary {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.btn-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.btn-danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
    box-shadow: 0 4px 12px -2px rgba(220, 38, 38, 0.2);
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.auth-tab-btn {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* Profile Modal Details */
.profile-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.profile-card-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--gradient);
    color: white;
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-card-info {
    flex-grow: 1;
    min-width: 0;
}

.profile-card-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-card-email {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Profile Data Management (Import / Export) */
.profile-data-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 14px;
}

.profile-data-header {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.profile-data-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.4;
}

.profile-data-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.profile-data-actions .btn {
    padding: 10px 12px;
    font-size: 13px;
    border-radius: 10px;
}

/* Loading Spinner & Empty State */
.loading-box {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.empty-state .e {
    font-size: 44px;
    display: block;
    margin-bottom: 12px;
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
