/* 2026 Modern Variables */
:root {
    --surface-elevated: #ffffff;
    --surface-base: #fafafa;
    --surface-sunken: #f5f5f5;
    --accent-gradient: linear-gradient(135deg, #CF2030 0%, #E63946 100%);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(207, 32, 48, 0.08);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
}

/* Safe area padding utilities */
.pt-safe { padding-top: var(--safe-top); }
.pb-safe { padding-bottom: var(--safe-bottom); }

/* Animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-2px); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 5px rgba(207, 32, 48, 0.2); } 50% { box-shadow: 0 0 20px rgba(207, 32, 48, 0.4); } }
@keyframes slide-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-out { from { opacity: 1; } to { opacity: 0; } }

.animate-rise { animation: rise-in 420ms ease both; }
.animate-rise-delay { animation: rise-in 420ms ease 60ms both; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-glow { animation: glow 2s ease-in-out infinite; }

/* Hover effects */
.hover-lift { transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.hover-lift:hover { transform: translateY(-1px); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); }
.hover-scale { transition: transform 0.15s ease; }
.hover-scale:hover { transform: scale(1.02); }

.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,0.34); border-top-color: #fff; border-radius: 50%; animation: spin 0.65s linear infinite; flex-shrink: 0; }

/* Card styles */
.card-glass { background: var(--glass-bg); border: 1px solid var(--glass-border); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.card-elevated { background: var(--surface-elevated); border: 1px solid rgba(0, 0, 0, 0.06); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); }
.card-primary { background: var(--accent-gradient); border: none; color: white; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; position: relative; }
.status-dot::after { content: ''; position: absolute; top: -2px; left: -2px; right: -2px; bottom: -2px; border-radius: 50%; background: inherit; opacity: 0.3; animation: float 2s ease-in-out infinite; }

/* Toast */
.toast { transform: translateY(-16px); opacity: 0; pointer-events: none; transition: transform 180ms ease, opacity 180ms ease; }
.toast.is-visible { transform: translateY(0); opacity: 1; }
.toast.is-success { background: #dcfce7; border-color: #86efac; color: #0f766e; }
.toast.is-error { background: #ffe4e6; border-color: #fda4af; color: #be123c; }

/* Inline success animation */
.inline-success-card { opacity: 0; transform: translateY(4px); transition: opacity 180ms ease, transform 180ms ease; }
.inline-success-card.is-visible { opacity: 1; transform: translateY(0); }
.inline-success-card.is-hiding { opacity: 0; transform: translateY(-2px); }

/* Auth collapse transition */
.auth-collapse { transition: opacity 200ms ease, max-height 200ms ease; overflow: hidden; }
.auth-collapse[hidden] { display: block !important; max-height: 0; opacity: 0; overflow: hidden; pointer-events: none; padding: 0; margin: 0; }

/* Form panel visibility with slide transition */
.form-panel { display: none; }
.form-panel.is-visible { display: block; animation: slide-in 250ms ease both; }

/* Loading state */
.is-loading { pointer-events: none; opacity: 0.75; }

/* Combobox — desktop: absolute dropdown, mobile: bottom sheet */
.member-combobox-options {
    z-index: 25; -webkit-overflow-scrolling: touch;
    /* Desktop: absolute dropdown */
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    margin: 0; padding: 6px; list-style: none;
    border: 1px solid #e5e5e5; border-radius: 8px;
    background: white; box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    max-height: 220px; overflow-y: auto;
}

@media (max-width: 1023px) {
    .member-combobox-options:not([hidden]) {
        position: fixed; top: auto; bottom: 0; left: 0; right: 0;
        max-height: 50vh; border-radius: 16px 16px 0 0;
        border: none; box-shadow: 0 -4px 30px rgba(0,0,0,0.15);
        padding: 8px 8px calc(8px + var(--safe-bottom));
        z-index: 50;
    }
}

.member-combobox-option { padding: 10px 12px; border-radius: 8px; font-size: 14px; cursor: pointer; min-height: 44px; display: flex; align-items: center; transition: background 150ms ease, color 150ms ease; }
.member-combobox-option:hover, .member-combobox-option.is-highlighted { background: #FEE2E5; color: #CF2030; }
.member-combobox-empty { padding: 10px 12px; border-radius: 8px; font-size: 14px; color: #73849b; text-align: center; }

/* Tab active state */
.tab-btn.is-active { background: var(--accent-gradient) !important; color: #fff !important; transform: scale(1.02); box-shadow: 0 4px 15px rgba(207, 32, 48, 0.3); }

/* Template pill applied state */
.template-pill.is-applied { border-color: #CF2030; background: #FEE2E5; color: #CF2030; }

/* Flow step states */
.flow-step.is-current { border-color: rgba(207, 32, 48, 0.2); background: linear-gradient(135deg, rgba(207, 32, 48, 0.05) 0%, rgba(207, 32, 48, 0.1) 100%); transform: translateY(-1px); }
.flow-step.is-current .step-dot { background: var(--accent-gradient); box-shadow: 0 0 10px rgba(207, 32, 48, 0.4); }
.flow-step.is-done { border-color: rgba(15, 118, 110, 0.2); background: linear-gradient(135deg, rgba(15, 118, 110, 0.05) 0%, rgba(15, 118, 110, 0.1) 100%); }
.flow-step.is-done .step-dot { background: #0f766e; box-shadow: 0 0 8px rgba(15, 118, 110, 0.3); }

/* Activity/retry items */
.activity-item { border: 1px solid #e5d8d8; border-radius: 10px; background: #fef7f7; padding: 8px 10px; }
.activity-item .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.activity-item .tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: #FEE2E5; color: #CF2030; font-size: 11px; font-weight: 700; }
.activity-item time { color: #73849b; font-size: 11px; }
.activity-item p { margin: 0; font-size: 12px; }
.activity-empty { margin: 0; font-size: 13px; color: #73849b; text-align: center; padding: 8px; border-radius: 10px; background: #fdf8f8; }

.retry-item { border: 1px solid #f5c8d2; border-radius: 10px; background: #fff7f8; padding: 9px 10px; }
.retry-item .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.retry-item .tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: #ffe4e6; color: #be123c; font-size: 11px; font-weight: 700; }
.retry-item .reason { margin: 0; color: #9f1239; font-size: 12px; font-weight: 700; }
.retry-item .detail { margin: 3px 0 0; color: #4d5f78; font-size: 12px; }
.retry-item .actions { margin-top: 8px; display: flex; gap: 7px; }
.mini-btn { border: 1px solid #e5d8d8; background: #fff; color: #162230; border-radius: 999px; font-size: 12px; font-weight: 700; padding: 4px 10px; cursor: pointer; transition: all 180ms ease; }
.mini-btn:hover { border-color: #CF2030; color: #CF2030; }
.mini-btn.is-danger:hover { border-color: #be123c; color: #be123c; }

/* Bottom Tab Bar */
.btm-tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    display: flex; align-items: stretch;
    background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0 4px calc(4px + var(--safe-bottom)) 4px;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.06);
}
.btm-tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 8px 4px 6px; border: none; background: none;
    color: #73849b; font-size: 11px; font-weight: 600;
    cursor: pointer; transition: all 200ms ease; position: relative;
    -webkit-tap-highlight-color: transparent;
}
.btm-tab:active { transform: scale(0.92); }
.btm-tab.is-active { color: #CF2030; }
.btm-tab.is-active::before {
    content: ''; position: absolute; top: 0; left: 20%; right: 20%;
    height: 2px; background: var(--accent-gradient); border-radius: 0 0 2px 2px;
}
.btm-tab-icon { width: 22px; height: 22px; }
.btm-tab-badge {
    position: absolute; top: 2px; right: calc(50% - 18px);
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 999px; background: #CF2030; color: white;
    font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}

/* Skip link */
.skip-link:focus-visible { top: 16px; }

/* Shortcut hint hidden state (overrides lg:block) */
#shortcut-hint[hidden] { display: none !important; }

/* Form area locked state (not logged in) */
#form-area { transition: opacity 200ms ease; }
#form-area.is-locked { opacity: 0.4; }

/* Flow guide collapsed state */
#flow-guide.is-collapsed ol { display: none; }
#flow-guide.is-collapsed #flow-guide-chevron { transform: rotate(-90deg); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
