:root {
    --primary-blue: #0078D4;
    --primary-dark: #004578;
    --primary-light: #50B0FF;
    --accent-cyan: #00D4FF;
    --accent-purple: #8B5CF6;
    --success-green: #10B981;
    --success-light: #D1FAE5;
    --warning-orange: #F59E0B;
    --warning-light: #FEF3C7;
    --error-red: #EF4444;
    --error-light: #FEE2E2;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --text-muted: #9CA3AF;
    --bg-white: #FFFFFF;
    --bg-light: #F9FAFB;
    --bg-gray: #F3F4F6;
    --border-light: #E5E7EB;
    --border-medium: #D1D5DB;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 20px rgba(0, 120, 212, 0.3);
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Utility class for initially hidden elements */
.hidden {
    display: none !important;
}

/* Landing page specific styles */
.landing-header {
    padding: 0;
    background: transparent;
    position: relative;
}

.landing-banner {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark) 50%, #002855 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
}

/* Subtle background pattern overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.03) 0%, transparent 50%),
                      radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    transition: all var(--transition-base);
    animation: containerFadeIn 0.5s ease-out;
}

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

.container:hover {
    box-shadow: var(--shadow-2xl);
}

header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 28px 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

.env-indicator {
    position: absolute;
    top: 16px;
    right: 20px;
    padding: 6px 12px;
    background: rgba(245, 158, 11, 0.95);
    color: white;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
    animation: fadeIn 0.3s ease-in;
}

.env-indicator.local {
    background: rgba(139, 92, 246, 0.95);
}

.version-badge {
    position: fixed;
    bottom: 16px;
    right: 20px;
    padding: 6px 10px;
    background: rgba(31, 41, 55, 0.85);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    font-size: 0.65em;
    font-weight: 500;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0.6;
    transition: opacity 0.2s ease, background 0.2s ease;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    cursor: default;
}

.version-badge:hover {
    opacity: 1;
    background: rgba(31, 41, 55, 0.95);
}

.version-badge .version-number {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

.version-badge .version-commit {
    color: rgba(100, 200, 255, 0.8);
    margin-left: 4px;
}

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

h1 {
    font-size: 2.25em;
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.subtitle {
    opacity: 0.9;
    font-size: 1.05em;
    font-weight: 400;
}

.content {
    padding: 28px 36px 36px;
    background: var(--bg-white);
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.toolbar-left {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ============================================
   Persistent Navigation Bar
   ============================================ */
.main-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
}

.nav-brand:hover {
    color: var(--primary-blue);
}

.nav-brand-icon {
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

.nav-links-bar {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.nav-link:hover {
    background: var(--bg-light);
    color: var(--primary-blue);
}

.nav-link.active {
    background: rgba(0, 120, 212, 0.1);
    color: var(--primary-blue);
}

.nav-link-icon {
    font-size: 1rem;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-user-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.nav-logout-btn:hover {
    background: var(--bg-light);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

/* Mobile responsive nav */
@media (max-width: 768px) {
    .main-nav {
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px 16px;
    }

    .nav-links-bar {
        order: 3;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px;
        padding-top: 12px;
        border-top: 1px solid var(--border-light);
    }

    .nav-link {
        padding: 8px 12px;
        font-size: 0.8125rem;
    }

    .nav-link span:last-child {
        display: none;
    }

    .nav-user-name {
        display: none;
    }
}

.btn-icon {
    font-size: 1.1em;
    line-height: 1;
}

.refresh-btn.secondary {
    background: var(--bg-white);
    color: var(--text-primary);
    border: 2px solid var(--border-medium);
    box-shadow: var(--shadow-xs);
}

.refresh-btn.secondary:hover {
    background: var(--bg-light);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    box-shadow: var(--shadow-sm);
}

.refresh-btn.secondary:active {
    background: var(--bg-gray);
    box-shadow: var(--shadow-inner);
}

.loading {
    text-align: center;
    padding: 60px 40px;
    color: #333;
}

.loading .spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

.loading .message {
    font-size: 1.125em;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.loading .submessage {
    font-size: 0.9375em;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 400px;
    margin: 0 auto;
}

.error {
    background: linear-gradient(135deg, var(--error-light) 0%, #FEF2F2 100%);
    border: 2px solid var(--error-red);
    border-left-width: 6px;
    color: #991B1B;
    padding: 20px 24px;
    border-radius: var(--radius-md);
    margin: 24px 0;
    box-shadow: var(--shadow-sm);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}

.error::before {
    content: '⚠️';
    font-size: 1.5em;
}

.tree {
    margin: 20px 0;
}

.tree-node {
    margin: 10px 0;
    padding: 16px 20px;
    border-left: 4px solid var(--primary-blue);
    background: var(--bg-white);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
    border-left-width: 4px;
    position: relative;
}

.tree-node::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
    box-shadow: var(--shadow-glow);
}

.tree-node:hover {
    background: var(--bg-light);
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-blue);
}

.tree-node:hover::after {
    opacity: 0.3;
}

.tree-node.category {
    background: linear-gradient(135deg, rgba(0, 120, 212, 0.08) 0%, rgba(0, 69, 120, 0.08) 100%);
    border-left: 5px solid var(--primary-blue);
    font-weight: 600;
    font-size: 1.25em;
    box-shadow: var(--shadow-md);
}

.tree-node.category:hover {
    background: linear-gradient(135deg, rgba(0, 120, 212, 0.12) 0%, rgba(0, 69, 120, 0.12) 100%);
}

.tree-node.directory {
    border-left-color: var(--warning-orange);
}

.tree-node.directory:hover {
    border-color: var(--warning-orange);
    box-shadow: var(--shadow-md), 0 0 0 1px var(--warning-orange);
}

.tree-node.survey {
    border-left-color: var(--success-green);
}

.tree-node.survey:hover {
    border-color: var(--success-green);
    box-shadow: var(--shadow-md), 0 0 0 1px var(--success-green);
}

.tree-node.library {
    border-left-color: var(--accent-cyan);
}

.tree-node.library:hover {
    border-color: var(--accent-cyan);
    box-shadow: var(--shadow-md), 0 0 0 1px var(--accent-cyan);
}

.tree-node-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.tree-node-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.tree-node-icon {
    font-size: 1.5em;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    transition: transform var(--transition-fast);
}

.tree-node:hover .tree-node-icon {
    transform: scale(1.1);
}

.tree-node-badge {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.875em;
    font-weight: 600;
    letter-spacing: 0.025em;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.tree-node-badge:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.tree-node-metadata {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid var(--border-light);
    font-size: 0.9375em;
    color: var(--text-secondary);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.metadata-item {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.metadata-item:hover {
    background: var(--bg-gray);
    transform: translateX(2px);
}

.metadata-label {
    font-weight: 600;
    color: var(--text-primary);
}

.tree-children {
    margin-left: 36px;
    margin-top: 12px;
    padding-left: 12px;
    border-left: 2px solid var(--border-light);
    transition: border-color var(--transition-base);
}

.tree-children:hover {
    border-left-color: var(--primary-blue);
}

.expand-toggle {
    background: var(--bg-light);
    border: 2px solid var(--border-light);
    font-size: 1.2em;
    cursor: pointer;
    padding: 6px 8px;
    color: var(--primary-blue);
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.expand-toggle:hover {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
    box-shadow: var(--shadow-sm);
}

.expand-toggle.expanded {
    transform: rotate(90deg);
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}



.refresh-btn {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 0.875em;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin: 0;
    height: 40px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

.refresh-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-xs);
}

.refresh-btn:focus-visible {
    outline: 3px solid rgba(0, 120, 212, 0.5);
    outline-offset: 2px;
}

.logout-btn {
    background: var(--bg-white);
    color: var(--text-secondary);
    border: 2px solid var(--border-medium);
    padding: 14px 24px;
    font-size: 0.9375em;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    margin: 0;
    height: 48px;
    box-shadow: var(--shadow-xs);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.logout-btn:hover {
    background: var(--bg-light);
    border-color: var(--text-secondary);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.logout-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-inner);
    background: var(--bg-gray);
}

.logout-btn:focus-visible {
    outline: 3px solid rgba(107, 114, 128, 0.3);
    outline-offset: 2px;
}

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

.spinning {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* Professional Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    animation: fadeIn var(--transition-base);
}

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

.loading-content {
    background: var(--bg-white);
    padding: 48px 72px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    text-align: center;
    max-width: 440px;
    animation: slideUp var(--transition-slow);
}

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

.loading-spinner {
    width: 64px;
    height: 64px;
    border: 5px solid var(--border-light);
    border-top-color: var(--primary-blue);
    border-right-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.7s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    margin: 0 auto 24px;
}

.loading-message {
    font-size: 1.25em;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.loading-submessage {
    font-size: 0.9375em;
    color: var(--text-secondary);
    line-height: 1.5;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Keyboard Navigation Focus Styles */
button:focus,
.expand-toggle:focus {
    outline: 3px solid var(--primary-blue);
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(0, 120, 212, 0.2);
}

.distribution-row:focus {
    outline: 3px solid var(--primary-blue) !important;
    outline-offset: -3px;
    box-shadow: 0 0 0 4px rgba(0, 120, 212, 0.25);
}

select:focus {
    outline: 3px solid var(--primary-blue);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 120, 212, 0.2);
}

/* Cross-Month Attribution Indicator */
.cross-month-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 1px solid #ffb74d;
    color: #e65100;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
    box-shadow: 0 1px 2px rgba(255, 152, 0, 0.2);
    cursor: help;
}

.cross-month-badge:hover {
    background: linear-gradient(135deg, #ffe0b2 0%, #ffcc80 100%);
    box-shadow: 0 2px 4px rgba(255, 152, 0, 0.3);
}

.cross-month-icon {
    font-size: 11px;
}

/* Collapsible Reminder Rows */
.reminder-row {
    transition: all 0.2s ease;
}

.reminder-row.collapsed {
    display: none;
}

.reminder-row td:first-child {
    padding-left: 40px !important;
    position: relative;
}

.reminder-row td:first-child::before {
    content: '↳';
    position: absolute;
    left: 20px;
    color: #f57c00;
    font-size: 14px;
}

.parent-invite-row {
    position: relative;
}

.reminder-toggle {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 8px;
    border: 1px solid #f57c00;
    border-radius: 3px;
    background: #fff3e0;
    font-size: 10px;
    font-weight: bold;
    color: #f57c00;
    transition: all 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
}

.reminder-toggle:hover {
    background: #ffe0b2;
    border-color: #ff9800;
    transform: scale(1.1);
}

.reminder-toggle.collapsed::after {
    content: '▼';
}

.reminder-toggle.expanded::after {
    content: '▲';
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 8px;
    }

    h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 1em;
    }

    .stats-panel {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-value {
        font-size: 2.5em;
    }

    .tree-node-metadata {
        grid-template-columns: 1fr;
    }

    .distribution-table-container {
        overflow-x: auto;
    }

    .distribution-table {
        font-size: 11px !important;
        min-width: 800px;
    }

    .distribution-table th,
    .distribution-table td {
        padding: 6px 4px !important;
    }

    .filter-container {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .filter-container label,
    .filter-container select,
    .filter-container button {
        width: 100% !important;
        margin: 0 !important;
    }

    .filter-container button {
        margin-top: 10px !important;
    }

    .error-toast {
        max-width: calc(100vw - 40px) !important;
        right: 10px !important;
        left: 10px !important;
    }

    .tree-children {
        margin-left: 15px;
    }

    .refresh-btn {
        width: 100%;
        margin-bottom: 10px !important;
    }
}

/* Tablet breakpoint */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 100%;
    }



    .distribution-table {
        font-size: 12px;
    }
}

/* Touch-friendly enhancements */
@media (hover: none) and (pointer: coarse) {
    button,
    .expand-toggle,
    .distribution-row {
        min-height: 44px; /* iOS recommended minimum touch target */
    }

    .expand-toggle {
        padding: 8px;
        font-size: 1.4em;
    }
}

/* ============================================
   NOTIFICATIONS & SHARED COMPONENTS
   ============================================ */

.header-content {
    position: relative;
    z-index: 1;
}

.header-content h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.nav-links {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}

.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    min-height: 44px;
    min-width: 44px;
    box-sizing: border-box;
    position: relative;
}

.back-link * {
    pointer-events: none;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.back-link:active {
    transform: translateY(0);
}

.main-content {
    padding: 36px;
}

.loading-state,
.error-state,
.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.loading-state {
    color: var(--text-secondary);
}

.error-state {
    color: var(--error-red);
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state {
    color: var(--text-muted);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

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

.section-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.global-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

.global-toggle label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.survey-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    transition: all var(--transition-base);
    position: relative;
}

.survey-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary-blue) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.survey-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.survey-card:hover::before {
    opacity: 1;
}

/* Notification Settings Card (shown when survey is selected) */
.notification-settings-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 28px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    position: relative;
}

.notification-settings-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-blue) 0%, var(--accent-cyan) 50%, var(--accent-purple) 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.settings-survey-info h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.settings-survey-info .survey-id {
    font-size: 13px;
    color: var(--text-muted);
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Notification status indicator in survey grid */
.notification-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--success-light);
    color: var(--success-green);
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-full);
    margin-bottom: 4px;
}

.survey-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.survey-info h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.survey-id {
    font-size: 13px;
    color: var(--text-muted);
    font-family: 'Consolas', 'Monaco', monospace;
}

.notification-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-toggle label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-medium);
    border-radius: 28px;
    transition: all var(--transition-base);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background: white;
    border-radius: 50%;
    transition: all var(--transition-base);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--success-green);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.notification-rules {
    display: none;
    padding-top: 20px;
}

.notification-rules.active {
    display: block;
}

.rule-group {
    margin-bottom: 20px;
}

.rule-group:last-child {
    margin-bottom: 0;
}

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

.rule-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.rule-icon {
    font-size: 18px;
}

.threshold-input {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-top: 8px;
}

.threshold-input label {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 120px;
}

.threshold-input input[type="number"] {
    width: 80px;
    padding: 6px 12px;
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    background: white;
    transition: all var(--transition-base);
}

.threshold-input input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.1);
}

.threshold-input input[type="number"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-gray);
}

.milestone-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.milestone-badge {
    padding: 6px 12px;
    background: var(--primary-light);
    color: white;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.rule-description {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 8px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
}

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

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

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    background: var(--bg-light);
    border-color: var(--text-secondary);
}

.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 20px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    z-index: 9999;
    animation: toastSlideIn 0.4s cubic-bezier(0.21, 1.02, 0.73, 1);
    max-width: 380px;
    min-width: 300px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(120%) scale(0.9);
        opacity: 0;
    }
    50% {
        transform: translateX(-5%) scale(1.02);
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.toast-icon {
    font-size: 24px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast.success {
    border-left: 4px solid var(--success-green);
}

.toast.error {
    border-left: 4px solid var(--error-red);
}

.toast.warning {
    border-left: 4px solid var(--warning-orange);
}

/* Welcome Panel - Homepage landing */
.welcome-panel {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 40px;
    margin-top: 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.welcome-panel h2 {
    color: var(--text-primary);
    margin-bottom: 16px;
    font-size: 1.5rem;
    font-weight: 600;
}

.welcome-panel p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.welcome-panel-cards {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.welcome-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 32px;
    background: var(--bg-gray);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition-fast);
    min-width: 180px;
}

.welcome-card:hover {
    background: var(--border-light);
    transform: translateY(-2px);
}

.welcome-card-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.welcome-card-title {
    font-weight: 600;
    color: var(--text-primary);
}

.welcome-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}
