* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0f;
    color: #e2e8f0;
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* ── Auth Screen ─────────────────────────────── */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1025 50%, #0a0a1a 100%);
    padding: 20px;
}

.auth-card {
    background: rgba(20, 20, 35, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-logo {
    font-size: 56px;
    margin-bottom: 8px;
    filter: drop-shadow(0 4px 12px rgba(139, 92, 246, 0.3));
}

.auth-title {
    font-size: 28px;
    font-weight: 900;
    background: linear-gradient(135deg, #a78bfa, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.auth-subtitle {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    margin-bottom: 28px;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab.active {
    background: rgba(139, 92, 246, 0.3);
    color: white;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form input {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.auth-form input:focus {
    border-color: #8b5cf6;
    background: rgba(255, 255, 255, 0.1);
}

.auth-form input::placeholder { color: rgba(255, 255, 255, 0.35); }

.auth-submit {
    padding: 14px;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    margin-top: 4px;
}

.auth-submit:hover {
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.auth-submit:active { transform: scale(0.98); }

.auth-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    padding: 10px 14px;
    color: #fca5a5;
    font-size: 13px;
    margin-top: 12px;
    text-align: left;
}

/* ── Top Bar ─────────────────────────────────── */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-logo { font-size: 28px; }

.app-title {
    font-size: 20px;
    font-weight: 900;
    background: linear-gradient(135deg, #a78bfa, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.05);
}

.user-menu { position: relative; }

.user-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.user-btn:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.user-dropdown {
    position: absolute;
    top: 46px;
    right: 0;
    background: rgba(24, 24, 35, 0.97);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 8px;
    min-width: 180px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.user-dropdown-name {
    padding: 8px 12px;
    font-weight: 700;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 4px;
    color: #a78bfa;
}

.user-dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.user-dropdown-item:hover { background: rgba(255, 255, 255, 0.08); }
.user-dropdown-item.danger { color: #f87171; }
.user-dropdown-item.danger:hover { background: rgba(239, 68, 68, 0.15); }

/* ── Filter Bar ──────────────────────────────── */
.filter-bar {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0 14px;
    transition: border-color 0.2s;
}

.search-box:focus-within { border-color: #8b5cf6; }

.search-icon { font-size: 16px; opacity: 0.5; }

.search-box input {
    flex: 1;
    padding: 11px 0;
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    outline: none;
}

.search-box input::placeholder { color: rgba(255, 255, 255, 0.35); }

.tag-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag-filter {
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tag-filter:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    color: white;
}

.tag-filter.active {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.5);
    color: white;
}

.sort-controls select {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

.sort-controls select option {
    background: #1a1a2e;
    color: #e2e8f0;
}

/* ── Stats Panel ─────────────────────────────── */
.stats-panel {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    animation: slideDown 0.3s ease;
}

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-number {
    font-size: 28px;
    font-weight: 900;
    background: linear-gradient(135deg, #a78bfa, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* ── Events Panel ────────────────────────────── */
.events-panel {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    animation: slideDown 0.3s ease;
}

.events-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.events-panel-title {
    font-size: 16px;
    font-weight: 800;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
}

.events-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.events-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px;
    opacity: 0.45;
    font-size: 14px;
}

.event-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
}

.event-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(245, 158, 11, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.event-card-type {
    font-size: 24px;
    margin-bottom: 8px;
}

.event-card-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}

.event-card-date {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
}

.event-card-date strong {
    color: #fbbf24;
}

.event-card-invited {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.event-card-invited .avatar-stack {
    display: flex;
}

.event-card-invited .mini-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    border: 2px solid #0a0a0f;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 800;
    color: white;
    margin-left: -6px;
}

.event-card-invited .mini-avatar:first-child {
    margin-left: 0;
}

.event-card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.event-card:hover .event-card-actions {
    opacity: 1;
}

.event-card-location {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 6px;
}

/* ── Event Modal Extras ──────────────────────── */
.form-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 10px;
}

.event-tag-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.event-tag-option {
    padding: 5px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.event-tag-option:hover {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.3);
    color: white;
}

.event-tag-option.active {
    background: rgba(245, 158, 11, 0.25);
    border-color: rgba(245, 158, 11, 0.5);
    color: #fbbf24;
}

.event-friends-checklist {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.event-friend-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 13px;
}

.event-friend-option:hover {
    background: rgba(255, 255, 255, 0.07);
}

.event-friend-option input[type="checkbox"] {
    accent-color: #8b5cf6;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.event-friend-option .friend-option-name {
    flex: 1;
    font-weight: 600;
}

.event-friend-option .friend-option-tags {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.35);
}

.event-friend-option.auto-included {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.15);
}

.event-invited-summary {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.event-invited-summary strong {
    color: #a78bfa;
}

.event-detail-invited-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.event-detail-friend {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    font-size: 13px;
}

.event-detail-friend .mini-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

.event-detail-friend-name {
    font-weight: 600;
    flex: 1;
}

.event-detail-friend-tags {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.35);
}

/* ── Friends List ────────────────────────────── */
.friends-container {
    padding: 16px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    opacity: 0.7;
}

.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state h2 { font-size: 20px; margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: rgba(255,255,255,0.5); margin-bottom: 24px; }

.friends-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
}

/* ── Friend Card ─────────────────────────────── */
.friend-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 18px;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}

.friend-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.friend-card-top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
}

.friend-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* ── Avatar Upload ──────────────────────────── */
.avatar-upload-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar-preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.avatar-preview-initials {
    font-size: 28px;
    font-weight: 800;
    color: white;
}

.avatar-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}

.avatar-upload-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.avatar-upload-btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.avatar-remove-btn {
    font-size: 11px !important;
    padding: 4px 10px !important;
    color: #f87171 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.friend-avatar.overdue {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    animation: pulse 2s ease-in-out infinite;
}

.friend-avatar.birthday-soon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.friend-info { flex: 1; min-width: 0; }

.friend-name {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-nickname {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.friend-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.friend-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.friend-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.friend-tag {
    padding: 2px 8px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    color: #c4b5fd;
    white-space: nowrap;
}

.friend-cadence-bar {
    margin-top: 10px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.friend-cadence-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

.cadence-good { background: linear-gradient(90deg, #22c55e, #16a34a); }
.cadence-warn { background: linear-gradient(90deg, #f59e0b, #d97706); }
.cadence-overdue { background: linear-gradient(90deg, #ef4444, #dc2626); }

.friend-card-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.friend-card:hover .friend-card-actions { opacity: 1; }

.card-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.card-action-btn:hover { background: rgba(139, 92, 246, 0.4); }
.card-action-btn.danger:hover { background: rgba(239, 68, 68, 0.4); }

.friend-birthday-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    color: #fbbf24;
    margin-left: 6px;
}

/* ── Modals ───────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: rgba(18, 18, 30, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: modalIn 0.3s ease;
}

.modal-small { max-width: 440px; }
.modal-detail { max-width: 700px; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

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

.modal-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.modal-close:hover { background: rgba(255, 255, 255, 0.12); }

.modal-form { padding: 0; }

.form-section {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.form-section:last-of-type { border-bottom: none; }

.form-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 14px;
}

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

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #8b5cf6;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.form-group select option {
    background: #1a1a2e;
    color: #e2e8f0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Tag Input ───────────────────────────────── */
.tag-input-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    min-height: 42px;
    align-items: center;
    transition: border-color 0.2s;
}

.tag-input-container:focus-within { border-color: #8b5cf6; }

.selected-tags { display: contents; }

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: rgba(139, 92, 246, 0.25);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #c4b5fd;
    white-space: nowrap;
}

.selected-tag .remove-tag {
    cursor: pointer;
    opacity: 0.6;
    font-size: 14px;
    line-height: 1;
    transition: opacity 0.15s;
}

.selected-tag .remove-tag:hover { opacity: 1; }

.tag-input-container input {
    flex: 1;
    min-width: 100px;
    border: none !important;
    background: transparent !important;
    padding: 4px 0 !important;
    font-size: 13px;
}

.tag-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.tag-suggestion {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.15s;
}

.tag-suggestion:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.3);
    color: white;
}

.preset-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 10px;
    align-items: center;
}

.preset-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    margin-right: 4px;
}

.preset-tag {
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.15s;
}

.preset-tag:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    color: #c4b5fd;
}

/* ── Buttons ─────────────────────────────────── */
.btn-primary {
    padding: 10px 20px;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}

.btn-primary:hover { box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4); }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }

.btn-danger {
    padding: 10px 20px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    color: #f87171;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

/* ── Detail Modal Content ────────────────────── */
.detail-content { padding: 24px; }

.detail-section {
    margin-bottom: 20px;
}

.detail-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 10px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.detail-item {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
}

.detail-item-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 4px;
}

.detail-item-value {
    font-size: 14px;
    font-weight: 600;
    word-break: break-all;
}

.detail-item-value a {
    color: #818cf8;
    text-decoration: none;
    transition: color 0.15s;
}

.detail-item-value a:hover { color: #a78bfa; text-decoration: underline; }

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.detail-tag {
    padding: 4px 12px;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: #c4b5fd;
}

.detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.hangout-list { margin-top: 8px; }

.hangout-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    margin-bottom: 6px;
    font-size: 13px;
}

.hangout-date {
    font-weight: 700;
    color: #a78bfa;
    white-space: nowrap;
    min-width: 80px;
}

.hangout-activity {
    flex: 1;
    color: rgba(255, 255, 255, 0.8);
}

.hangout-delete {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-size: 14px;
    transition: color 0.15s;
    padding: 4px;
}

.hangout-delete:hover { color: #f87171; }

/* ── Toast ────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.toast {
    background: rgba(24, 24, 40, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 24px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: toastIn 0.3s ease forwards;
    pointer-events: auto;
    max-width: 90vw;
}

.toast.toast-out { animation: toastOut 0.3s ease forwards; }
.toast-success { border-color: rgba(34, 197, 94, 0.4); }
.toast-error { border-color: rgba(239, 68, 68, 0.4); }

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

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-10px) scale(0.95); }
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .friends-list { grid-template-columns: 1fr; }
    .events-list { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .top-bar { padding: 10px 14px; }
    .filter-bar { padding: 10px 14px; }
    .friends-container { padding: 12px 14px; }
    .events-panel { padding: 12px 14px; }
    .modal { margin: 10px; }
    .friend-card-actions { opacity: 1; }
    .event-card-actions { opacity: 1; }
}

@media (max-width: 480px) {
    .auth-card { padding: 28px 20px; }
    .app-title { font-size: 16px; }
    .modal-header h2 { font-size: 17px; }
}

/* ── Scrollbar ───────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
