/* ============================================
   CareFinIQ - Application Styles
   Built on Opzo Portal Design System
   ============================================ */

/* ============================================
   Base Reset & Typography
   ============================================ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); font-weight: 600; }
h6 { font-size: var(--text-sm); font-weight: 600; }

p { color: var(--text-secondary); }

a {
    color: var(--color-primary-500);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover { color: var(--color-primary-400); }

code, pre, .monospace { font-family: var(--font-mono); }

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-primary-600) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 102, 230, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-400) 0%, var(--color-primary-500) 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 102, 230, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--color-primary-500);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-accent {
    background: linear-gradient(135deg, var(--color-accent-500) 0%, var(--color-accent-600) 100%);
    color: #0a0f1a;
    box-shadow: 0 4px 12px rgba(0, 230, 173, 0.3);
}

.btn-accent:hover {
    background: linear-gradient(135deg, var(--color-accent-400) 0%, var(--color-accent-500) 100%);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--color-error);
    color: white;
}

.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: var(--space-2) var(--space-3); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-base); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ============================================
   Cards
   ============================================ */

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.card:hover {
    border-color: var(--border-color);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body { padding: var(--space-6); }

.card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
}

/* ============================================
   Forms
   ============================================ */

.form-group { margin-bottom: var(--space-5); }

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: var(--text-base);
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 3px rgba(0, 102, 230, 0.1);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.form-textarea { min-height: 120px; resize: vertical; }
.form-hint { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-1); }
.form-error { font-size: var(--text-xs); color: var(--color-error); margin-top: var(--space-1); }

/* ============================================
   Tables
   ============================================ */

.table-container { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }

.table th {
    text-align: left;
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
}

.table td {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.table tr:hover td { background: var(--bg-tertiary); }

/* ============================================
   Badges
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
}

.badge-success { background: var(--color-success-light); color: var(--color-success); }
.badge-warning { background: var(--color-warning-light); color: var(--color-warning); }
.badge-error { background: var(--color-error-light); color: var(--color-error); }
.badge-info { background: var(--color-info-light); color: var(--color-info); }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-secondary); }

/* ============================================
   Alerts
   ============================================ */

.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.alert-success { background: rgba(16, 185, 129, 0.1); border: 1px solid var(--color-success); color: var(--color-success); }
.alert-warning { background: rgba(245, 158, 11, 0.1); border: 1px solid var(--color-warning); color: var(--color-warning); }
.alert-error { background: rgba(239, 68, 68, 0.1); border: 1px solid var(--color-error); color: var(--color-error); }
.alert-info { background: rgba(59, 130, 246, 0.1); border: 1px solid var(--color-info); color: var(--color-info); }

.alert-close {
    margin-left: auto;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.alert-close:hover { opacity: 1; }

/* ============================================
   Modal
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-4);
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.2s ease-out;
}

.modal-content.modal-lg {
    max-width: 680px;
}

.modal-content.modal-xl {
    max-width: 900px;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-header h2,
.modal-header h3 {
    margin: 0;
    font-size: var(--text-lg);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: var(--space-1);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-5);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* ============================================
   App Layout
   ============================================ */

.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-slow), width var(--transition-slow);
}

.sidebar-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
}

.sidebar-close-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: var(--text-lg);
    transition: all var(--transition-fast);
}

.sidebar-close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-logo-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.35));
    transition: transform var(--transition-fast), filter var(--transition-fast);
}

.sidebar-logo:hover .sidebar-logo-icon {
    transform: scale(1.05);
    filter: drop-shadow(0 6px 16px rgba(99, 102, 241, 0.45));
}

.sidebar-logo-text {
    font-size: var(--text-xl);
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--color-primary-300) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Legacy logo support */
.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo-text {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) var(--space-3);
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: var(--space-1);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(0, 102, 230, 0.15) 0%, rgba(0, 230, 173, 0.1) 100%);
    color: var(--color-primary-400);
    border: 1px solid rgba(0, 102, 230, 0.2);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: linear-gradient(180deg, var(--color-primary-500) 0%, var(--color-accent-500) 100%);
    border-radius: var(--radius-full);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
}

.nav-badge {
    margin-left: auto;
    background: var(--color-primary-500);
    color: white;
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.nav-section {
    margin-bottom: var(--space-6);
}

.nav-section-title {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
}

.nav-section-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: var(--space-4) var(--space-3);
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.user-menu:hover {
    background: var(--bg-elevated);
}

.credit-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
}

.credit-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.credit-value {
    font-family: var(--font-mono);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-accent-500);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2);
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-accent-500) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.user-details { flex: 1; min-width: 0; }

.user-name {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.user-org {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    z-index: 50;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.org-switcher-btn {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.org-switcher-btn:hover { border-color: var(--color-primary-500); }

.org-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-accent-500) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-sm);
    color: white;
    flex-shrink: 0;
}

.org-name {
    font-weight: 500;
    color: var(--text-primary);
    text-align: left;
    white-space: nowrap;
}

.role-badge {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-badge.role-admin {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid var(--color-error);
}

.role-badge.role-editor {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid var(--color-warning);
}

.role-badge.role-user {
    background: var(--color-primary-50);
    color: var(--color-primary-600);
    border: 1px solid var(--color-primary-500);
}

.role-badge.role-viewer {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.role-badge.role-noaccess {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    border: 1px solid var(--border-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.header-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.header-btn svg { width: 18px; height: 18px; }

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--color-error);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-primary);
}

/* Header Search */
.header-search {
    position: relative;
}

.search-input {
    width: 280px;
    padding: var(--space-2) var(--space-4);
    padding-left: 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 3px rgba(0, 102, 230, 0.1);
}

/* Organization Tier Badge */
.org-tier {
    font-size: var(--text-xs);
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(0, 230, 173, 0.15);
    color: var(--color-accent-400);
    margin-left: var(--space-2);
}

html[data-theme="light"] .org-tier {
    background: rgba(0, 179, 135, 0.15);
    color: var(--color-accent-700);
}

/* Page Content */
.page-content {
    flex: 1;
    padding: var(--space-8);
}

.page-header { margin-bottom: var(--space-8); }

.page-title {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 var(--space-2) 0;
}

.page-subtitle {
    font-size: var(--text-base);
    color: var(--text-muted);
    margin: 0;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 0;
    margin-right: var(--space-3);
    transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--color-primary-500);
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   Stats Dashboard
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-fast);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary-500) 0%, var(--color-accent-500) 100%);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    margin-bottom: var(--space-4);
}

.stat-icon.primary { background: rgba(0, 102, 230, 0.1); color: var(--color-primary-500); }
.stat-icon.accent { background: rgba(0, 230, 173, 0.1); color: var(--color-accent-500); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.1); color: var(--color-warning); }
.stat-icon.success { background: rgba(16, 185, 129, 0.1); color: var(--color-success); }

.stat-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.stat-value {
    font-size: var(--text-3xl);
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

/* ============================================
   Progress Bars
   ============================================ */

.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary-500), var(--color-accent-500));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

/* ============================================
   Upload Zone
   ============================================ */

.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-12);
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.upload-zone:hover {
    border-color: var(--color-primary-500);
    background: rgba(0, 102, 230, 0.05);
}

.upload-zone.dragging {
    border-color: var(--color-primary-500);
    background: rgba(0, 102, 230, 0.1);
}

.upload-zone-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    color: var(--text-muted);
}

.upload-zone-title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.upload-zone-subtitle {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

/* ============================================
   Loading States
   ============================================ */

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--color-primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-elevated) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ============================================
   Animations
   ============================================ */

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

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in { animation: fadeIn var(--transition-slow) ease-out; }
.animate-slide-up { animation: slideUp var(--transition-slow) ease-out; }
.animate-slide-in { animation: slideIn var(--transition-slow) ease-out; }

/* Staggered animations */
.stagger-1 { animation-delay: 50ms; }
.stagger-2 { animation-delay: 100ms; }
.stagger-3 { animation-delay: 150ms; }
.stagger-4 { animation-delay: 200ms; }
.stagger-5 { animation-delay: 250ms; }

/* ============================================
   Scrollbar
   ============================================ */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================
   Utilities
   ============================================ */

.text-primary { color: var(--color-primary-500); }
.text-accent { color: var(--color-accent-500); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

.bg-primary { background: var(--color-primary-500); }
.bg-accent { background: var(--color-accent-500); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   Organization Switcher
   ============================================ */

.org-switcher {
    position: relative;
}

.org-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: var(--space-2);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 200;
    overflow: hidden;
}

.org-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.org-dropdown-item:hover {
    background: var(--bg-tertiary);
}

.org-dropdown-item.active {
    background: rgba(0, 102, 230, 0.1);
}

/* ============================================
   Page-Specific Responsive Styles
   ============================================ */

/* Responsive Tables */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 1024px) {
    .table th,
    .table td {
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-sm);
    }
}

@media (max-width: 768px) {
    .table th:nth-child(n+5),
    .table td:nth-child(n+5) {
        display: none;
    }
    
    .table th:last-child,
    .table td:last-child {
        display: table-cell;
    }
}

/* Responsive Page Headers with Actions */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: var(--space-4);
    }
    
    .page-header .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Responsive Two-Column Grids */
.grid-2-col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
}

@media (max-width: 768px) {
    .grid-2-col {
        grid-template-columns: 1fr;
    }
}

/* Responsive Modals */
@media (max-width: 480px) {
    .modal-content {
        margin: var(--space-2);
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--space-3) var(--space-4);
    }
    
    .modal-footer {
        flex-direction: column;
        gap: var(--space-2);
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* Responsive Cards with Actions */
@media (max-width: 768px) {
    .card-footer {
        flex-direction: column;
        gap: var(--space-3);
        text-align: center;
    }
    
    .card-footer .btn {
        width: 100%;
    }
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar-overlay {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform var(--transition-base);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close-btn {
        display: flex;
    }

    .main-content {
        margin-left: 0;
    }

    .header-search {
        display: none;
    }

    .org-name {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header {
        padding: 0 var(--space-4);
    }

    .page-content {
        padding: var(--space-4);
    }

    .header-actions {
        gap: var(--space-1);
    }

    .header-btn {
        width: 36px;
        height: 36px;
    }

    .org-switcher-btn {
        padding: var(--space-2);
    }

    .org-avatar {
        width: 32px;
        height: 32px;
        font-size: var(--text-sm);
    }

    .org-tier {
        display: none;
    }

    .page-title {
        font-size: var(--text-2xl);
    }
}

@media (max-width: 480px) {
    .header-left {
        flex: 1;
    }

    .org-name {
        display: none;
    }

    .header-right {
        gap: var(--space-2);
    }

    .page-header {
        margin-bottom: var(--space-4);
    }

    .page-title {
        font-size: var(--text-xl);
    }

    .page-subtitle {
        font-size: var(--text-sm);
    }
}

@media (min-width: 1025px) {
    .sidebar { transform: translateX(0) !important; }
    .mobile-menu-btn { display: none !important; }
    .sidebar-overlay { display: none !important; }
}

/* ============================================
   WageGuard Specific Components
   ============================================ */

/* Compliance Domain Badge */
.domain-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
}

.domain-badge.mod-slavery { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.domain-badge.esg { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.domain-badge.cyber { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.domain-badge.whs { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.domain-badge.insurance { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.domain-badge.privacy { background: rgba(99, 102, 241, 0.15); color: #6366f1; }

/* Compliance Score Ring */
.score-ring {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(
        var(--color-accent-500) calc(var(--score, 0) * 3.6deg),
        var(--bg-tertiary) calc(var(--score, 0) * 3.6deg)
    );
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.score-ring::before {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: var(--bg-secondary);
    border-radius: 50%;
}

.score-value {
    position: relative;
    font-size: var(--text-2xl);
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* Obligation Item */
.obligation-item {
    padding: var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
}

.obligation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.obligation-text {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
}

/* Evidence Card */
.evidence-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: all var(--transition-fast);
}

.evidence-card:hover {
    border-color: var(--color-primary-500);
}

.evidence-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.evidence-status.valid { color: var(--color-success); }
.evidence-status.expired { color: var(--color-error); }
.evidence-status.expiring { color: var(--color-warning); }

/* Theme Toggle */
.theme-toggle-container {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.theme-icon {
    font-size: 16px;
    line-height: 1;
}

.header-btn.theme-btn.active {
    background: var(--color-primary-500);
    border-color: var(--color-primary-500);
    color: white;
}

.header-btn.theme-btn:first-child.active {
    background: var(--color-warning);
    border-color: var(--color-warning);
    color: #1a1a2e;
}

.header-btn.theme-btn:last-child.active {
    background: var(--color-primary-600);
    border-color: var(--color-primary-600);
    color: white;
}

/* Hamburger Icon Animation */
.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    position: relative;
}

.hamburger-icon span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: all var(--transition-fast);
    position: absolute;
}

.hamburger-icon span:nth-child(1) { top: 6px; }
.hamburger-icon span:nth-child(2) { top: 11px; }
.hamburger-icon span:nth-child(3) { top: 16px; }

.hamburger-icon.active span:nth-child(1) { top: 11px; transform: rotate(45deg); }
.hamburger-icon.active span:nth-child(2) { opacity: 0; }
.hamburger-icon.active span:nth-child(3) { top: 11px; transform: rotate(-45deg); }

/* Blazor Error UI */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-4);
    background: var(--color-error);
    color: white;
    text-align: center;
    z-index: 9999;
}

#blazor-error-ui .dismiss,
#blazor-error-ui .reload {
    color: white;
    text-decoration: underline;
    margin-left: var(--space-4);
}

.blazor-error-boundary {
    background: var(--color-error-light);
    border: 1px solid var(--color-error);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
    color: var(--color-error);
}

/* ============================================
   Login Page (Unauthenticated)
   ============================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-primary) 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(0, 102, 230, 0.08) 0%, transparent 50%);
    animation: pulse 8s ease-in-out infinite;
}

.login-container {
    text-align: center;
    padding: var(--space-12);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    backdrop-filter: blur(20px);
    position: relative;
    z-index: 1;
    max-width: 420px;
    width: 90%;
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.login-logo .logo-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-accent-500) 100%);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-4xl);
    font-weight: 800;
    color: white;
    box-shadow: 0 8px 32px rgba(0, 102, 230, 0.35);
}

.login-logo h1 {
    font-size: var(--text-3xl);
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--color-primary-300) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: var(--text-base);
    margin-bottom: var(--space-8);
}

.login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-8);
    background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-primary-600) 100%);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-xl);
    font-weight: 600;
    font-size: var(--text-lg);
    transition: all var(--transition-fast);
    box-shadow: 0 4px 20px rgba(0, 102, 230, 0.4);
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 102, 230, 0.5);
}

/* ============================================
   App Launcher Grid
   ============================================ */

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-6);
}

.app-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    transition: all var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.app-card:hover {
    border-color: var(--color-primary-500);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.app-card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-accent-500) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-2xl);
    margin-bottom: var(--space-4);
}

.app-icon-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

.app-card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.app-card-description {
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.5;
}

/* ============================================
   Documents Page
   ============================================ */

.documents-page {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.documents-page .page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-4);
}

.documents-page .subtitle {
    color: var(--text-secondary);
    margin: var(--space-1) 0 0 0;
}

.documents-page .header-actions {
    display: flex;
    gap: var(--space-3);
}

/* Breadcrumb */
.breadcrumb-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
    gap: var(--space-3);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.breadcrumb-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.breadcrumb-separator {
    color: var(--text-muted);
}

.breadcrumb-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.view-toggle {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 2px;
}

.view-btn {
    background: transparent;
    border: none;
    padding: var(--space-2);
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.view-btn:hover {
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--bg-elevated);
    color: var(--color-primary-500);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: var(--space-3);
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    padding: var(--space-2) var(--space-4);
    padding-left: var(--space-8);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-sm);
    min-width: 200px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary-500);
}

.search-clear {
    position: absolute;
    right: var(--space-2);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-1);
    line-height: 1;
    font-size: 1.2rem;
}

.search-clear:hover {
    color: var(--text-primary);
}

/* Storage Info */
.storage-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
}

.storage-bar {
    flex: 1;
    max-width: 200px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.storage-used {
    height: 100%;
    background: var(--color-primary-500);
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}

.storage-info.near-quota .storage-used {
    background: var(--color-warning);
}

.storage-info.at-quota .storage-used {
    background: var(--color-error);
}

.storage-text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.storage-warning {
    font-size: var(--text-xs);
    color: var(--color-warning);
    font-weight: 600;
}

.storage-info.at-quota .storage-warning {
    color: var(--color-error);
}

/* Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
}

.content-area.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-4);
}

.content-area.list-view {
    display: flex;
    flex-direction: column;
}

/* Empty State */
.documents-page .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12);
    text-align: center;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
}

.empty-hint {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

/* Item Cards (Grid View) */
.item-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.item-card:hover {
    border-color: var(--color-primary-500);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.folder-card {
    background: var(--bg-tertiary);
}

.item-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-3);
}

.item-name {
    font-weight: 600;
    font-size: var(--text-sm);
    margin-bottom: var(--space-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-meta {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.item-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-color);
}

.action-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--color-primary-500);
}

.action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--color-error);
}

/* List View */
.list-header {
    display: grid;
    grid-template-columns: 1fr 120px 100px 120px;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.list-col {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.list-col:hover {
    color: var(--text-primary);
}

.sort-indicator {
    font-size: var(--text-xs);
}

.list-row {
    display: grid;
    grid-template-columns: 1fr 120px 100px 120px;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.list-row:last-child {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.list-row:hover {
    background: var(--bg-tertiary);
}

.folder-row {
    background: var(--bg-tertiary);
}

.item-icon-sm {
    font-size: 1.2rem;
}

.item-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-actions {
    cursor: default;
}

.action-btn-sm {
    background: transparent;
    border: none;
    padding: var(--space-1);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.action-btn-sm:hover {
    opacity: 1;
}

.action-btn-sm.danger:hover {
    color: var(--color-error);
}

.action-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Upload Dropzone */
.upload-dropzone {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    text-align: center;
    transition: all var(--transition-fast);
}

.upload-dropzone:hover,
.upload-dropzone.dragging {
    border-color: var(--color-primary-500);
    background: rgba(0, 102, 230, 0.05);
}

.upload-dropzone.has-files {
    border-color: var(--color-success);
    background: rgba(16, 185, 129, 0.05);
}

.upload-dropzone .file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.upload-icon {
    font-size: 3rem;
}

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

.upload-hint {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.selected-files {
    margin-top: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.selected-file {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.file-name {
    font-size: var(--text-sm);
    font-weight: 500;
}

.file-size {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.upload-actions {
    margin-top: var(--space-4);
    display: flex;
    justify-content: center;
}

.upload-progress-section {
    padding: var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    margin-top: var(--space-4);
}

.upload-progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
}

.upload-progress-bar-full {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-4);
}

.upload-progress {
    height: 100%;
    background: var(--color-primary-500);
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}

.upload-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    border-top: 1px solid var(--border-color);
}

.upload-name {
    font-size: var(--text-sm);
}

.upload-status {
    font-size: var(--text-xs);
    font-weight: 600;
}

.upload-status.success {
    color: var(--color-success);
}

.upload-status.error {
    color: var(--color-error);
}

/* Delete Warning */
.delete-warning {
    color: var(--color-error);
    font-size: var(--text-sm);
    margin-top: var(--space-2);
}

/* ============================================
   User Onboarding - Welcome Modal
   ============================================ */

.welcome-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--space-4);
    animation: fadeIn 0.3s ease-out;
}

.welcome-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
}

.welcome-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
}

.welcome-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.welcome-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-accent-500) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.welcome-logo-icon svg {
    width: 24px;
    height: 24px;
}

.welcome-logo-text {
    font-size: var(--text-lg);
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--color-primary-300) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.welcome-close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.welcome-modal-body {
    padding: var(--space-6);
}

.welcome-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 var(--space-3) 0;
    line-height: 1.3;
}

.welcome-subtitle {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin: 0 0 var(--space-6) 0;
    line-height: 1.6;
}

.welcome-subtitle strong {
    color: var(--color-accent-400);
}

.welcome-features {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.welcome-feature {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-fast);
}

.welcome-feature:hover {
    border-color: var(--color-primary-500);
    transform: translateX(4px);
}

.welcome-feature-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.welcome-feature-icon svg {
    width: 24px;
    height: 24px;
}

.welcome-feature-icon.scan {
    background: rgba(59, 130, 246, 0.15);
    color: var(--color-info);
}

.welcome-feature-icon.passport {
    background: rgba(0, 230, 173, 0.15);
    color: var(--color-accent-400);
}

.welcome-feature-icon.declare {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.welcome-feature-content h3 {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-1) 0;
}

.welcome-feature-content p {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.welcome-value-prop {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: var(--space-4);
    background: linear-gradient(135deg, rgba(0, 102, 230, 0.1) 0%, rgba(0, 230, 173, 0.1) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 102, 230, 0.2);
}

.value-prop-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.value-prop-icon {
    font-size: var(--text-lg);
}

.welcome-modal-footer {
    padding: var(--space-5) var(--space-6);
    border-top: 1px solid var(--border-subtle);
    text-align: center;
}

.welcome-skip {
    margin: var(--space-3) 0 0 0;
    font-size: var(--text-sm);
}

.welcome-skip a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.welcome-skip a:hover {
    color: var(--text-primary);
}

/* Responsive - Welcome Modal for mobile */
@media (max-width: 768px) {
    .welcome-modal {
        max-width: 100%;
        margin: var(--space-4);
        max-height: calc(100vh - var(--space-8));
    }
    
    .welcome-title {
        font-size: var(--text-xl);
    }
    
    .welcome-value-prop {
        flex-direction: column;
    }
}

/* ============================================
   Share Modal Styles
   ============================================ */

.share-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--space-4);
    animation: fadeIn 0.2s ease-out;
}

.share-modal {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-2xl);
    animation: slideUp 0.3s ease-out;
}

.share-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.share-modal-header h2 {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 600;
}

.share-modal-header .close-btn {
    background: transparent;
    border: none;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.share-modal-header .close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.share-modal-body {
    padding: var(--space-5);
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.share-modal-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
}

.share-description {
    color: var(--text-secondary);
    margin-bottom: var(--space-5);
    line-height: 1.6;
}

.existing-link-section h3 {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.link-info {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

.share-link-display {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.share-link-input {
    flex: 1;
    padding: var(--space-3);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.qr-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-5);
}

.qr-section h4 {
    font-size: var(--text-sm);
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.qr-note {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}

.qr-image {
    width: 160px;
    height: 160px;
    border-radius: var(--radius-md);
    background: white;
    padding: var(--space-2);
}

.link-actions {
    display: flex;
    gap: var(--space-3);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

.form-section {
    margin-bottom: var(--space-5);
}

.form-section h4 {
    font-size: var(--text-sm);
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.form-note {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}

.domain-checkboxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
}

.domain-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.domain-checkbox:hover {
    background: var(--bg-tertiary);
}

.domain-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary-500);
}

.form-row {
    margin-bottom: var(--space-3);
}

.form-label {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.form-select {
    padding: var(--space-2) var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--color-danger-500);
    color: var(--color-danger-500);
}

.btn-danger-outline:hover {
    background: var(--color-danger-500);
    color: white;
}

/* Passport page share badge */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.shareable-link-badge {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: rgba(var(--color-success-rgb), 0.1);
    border: 1px solid var(--color-success);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    color: var(--color-success);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.shareable-link-badge:hover {
    background: rgba(var(--color-success-rgb), 0.2);
}

.shareable-link-badge .view-count {
    background: var(--color-success);
    color: white;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
}

/* ============================================
   Shared Passport Public Page Styles
   ============================================ */

.empty-layout {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.shared-passport-page {
    min-height: 100vh;
    padding: var(--space-6);
    max-width: 1000px;
    margin: 0 auto;
}

.shared-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: var(--space-4);
    color: var(--text-muted);
}

.shared-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: var(--space-8);
}

.shared-error .error-icon {
    color: var(--color-warning-500);
    margin-bottom: var(--space-4);
}

.shared-error h1 {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-3);
}

.shared-error p {
    color: var(--text-muted);
    max-width: 400px;
}

.shared-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border-color);
}

.shared-branding {
    display: flex;
    gap: var(--space-4);
    align-items: center;
}

.shared-logo {
    flex-shrink: 0;
}

.shared-logo svg rect {
    fill: url(#logoGradient);
}

.org-name {
    font-size: var(--text-2xl);
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.powered-by {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.share-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-1);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.shared-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.readiness-section {
    display: flex;
    justify-content: center;
    padding: var(--space-6) 0;
}

.readiness-badge {
    text-align: center;
}

.readiness-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-3);
    background: conic-gradient(
        var(--color-primary-500) calc(var(--score) * 360deg),
        var(--bg-tertiary) 0deg
    );
    position: relative;
}

.readiness-circle::before {
    content: '';
    position: absolute;
    width: 130px;
    height: 130px;
    background: var(--bg-primary);
    border-radius: 50%;
}

.readiness-value {
    position: relative;
    font-size: var(--text-4xl);
    font-weight: 700;
    color: var(--text-primary);
}

.readiness-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: 500;
}

.org-section h2,
.domains-section h2,
.evidence-section h2 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-subtle);
}

.org-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-4);
}

.org-detail {
    padding: var(--space-3);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.detail-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-1);
}

.detail-value {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-primary);
}

.domains-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
}

.domain-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    border: 1px solid var(--border-color);
}

.domain-card.active {
    border-color: var(--color-success);
}

.domain-card.expiring {
    border-color: var(--color-warning-500);
}

.domain-card.expired,
.domain-card.no-evidence {
    border-color: var(--border-subtle);
    opacity: 0.7;
}

.domain-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.domain-name {
    font-weight: 600;
    color: var(--text-primary);
}

.domain-badge {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-sm);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
}

.domain-badge.active {
    background: rgba(var(--color-success-rgb), 0.1);
    color: var(--color-success);
}

.domain-badge.expiring {
    background: rgba(var(--color-warning-rgb), 0.1);
    color: var(--color-warning-500);
}

.domain-badge.expired,
.domain-badge.no-evidence {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.domain-evidence-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.evidence-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--border-subtle);
}

.evidence-item:last-child {
    border-bottom: none;
}

.evidence-type-icon {
    font-size: var(--text-base);
}

.evidence-title {
    flex: 1;
    color: var(--text-primary);
}

.evidence-expiry {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.evidence-expiry.expiring {
    color: var(--color-warning-500);
}

.evidence-more {
    font-size: var(--text-xs);
    color: var(--text-muted);
    padding: var(--space-2) 0;
}

.evidence-section .evidence-note {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

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

.evidence-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.evidence-table th,
.evidence-table td {
    padding: var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.evidence-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.evidence-table tbody tr:hover {
    background: var(--bg-secondary);
}

.status-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
}

.status-badge.active {
    background: rgba(var(--color-success-rgb), 0.1);
    color: var(--color-success);
}

.status-badge.expiring {
    background: rgba(var(--color-warning-rgb), 0.1);
    color: var(--color-warning-500);
}

.status-badge.expired {
    background: rgba(var(--color-danger-rgb), 0.1);
    color: var(--color-danger-500);
}

.status-badge.pending {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.shared-footer {
    margin-top: var(--space-8);
    padding: var(--space-6);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    text-align: center;
}

.shared-footer p {
    margin: 0;
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.shared-footer strong {
    color: var(--color-primary-500);
}

.footer-link {
    margin-top: var(--space-2) !important;
}

.footer-link a {
    color: var(--color-primary-500);
    text-decoration: none;
}

.footer-link a:hover {
    text-decoration: underline;
}

/* Shared Passport Responsive */
@media (max-width: 768px) {
    .shared-passport-page {
        padding: var(--space-4);
    }
    
    .shared-header {
        flex-direction: column;
        gap: var(--space-4);
    }
    
    .share-meta {
        align-items: flex-start;
    }
    
    .domains-grid {
        grid-template-columns: 1fr;
    }
    
    .domain-checkboxes {
        grid-template-columns: 1fr;
    }
}

