/* ============================================
   Constitutional AGI - Governance Portal
   shadcn/Vercel-inspired Design System
   ============================================ */

/* CSS Variables - Dark Theme */
:root {
    /* Colors */
    --background: #000000;
    --background-secondary: #0a0a0a;
    --foreground: #fafafa;
    --foreground-muted: #a1a1aa;
    --foreground-subtle: #71717a;
    
    /* Borders */
    --border: #27272a;
    --border-hover: #3f3f46;
    --border-focus: #52525b;
    
    /* Accent Colors */
    --accent: #18181b;
    --accent-hover: #27272a;
    --accent-foreground: #fafafa;
    
    /* Primary (Brand) */
    --primary: #fafafa;
    --primary-foreground: #18181b;
    
    /* Semantic Colors */
    --success: #22c55e;
    --success-muted: rgba(34, 197, 94, 0.15);
    --warning: #f59e0b;
    --warning-muted: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-muted: rgba(239, 68, 68, 0.15);
    --info: #3b82f6;
    --info-muted: rgba(59, 130, 246, 0.15);
    
    /* Purple accent for stars */
    --star-color: #a855f7;
    --star-glow: rgba(168, 85, 247, 0.4);
    
    /* Card */
    --card: #09090b;
    --card-hover: #18181b;
    
    /* Sizing */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    
    /* Layout */
    --header-height: 56px;
    --sidebar-width: 240px;
    
    /* Font */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, monospace;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--foreground);
    background-color: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Star Field Background - PRESERVED
   ============================================ */
.star-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--foreground);
    border-radius: 50%;
    opacity: 0.6;
    animation: twinkle var(--twinkle-duration, 3s) ease-in-out infinite;
}

.star.bright {
    width: 3px;
    height: 3px;
    box-shadow: 0 0 6px 2px rgba(255, 255, 255, 0.3);
    opacity: 0.9;
}

.secret-star {
    position: absolute;
    width: 4px !important;
    height: 4px !important;
    background: #ffffff !important;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto !important;
    opacity: 0.7;
    transition: all 0.3s ease;
    animation: twinkle 3s ease-in-out infinite;
    z-index: 5 !important;
    box-shadow: 0 0 6px 2px rgba(255, 255, 255, 0.5);
}

.secret-star:hover {
    opacity: 1 !important;
    transform: scale(2);
    background: var(--star-color) !important;
    box-shadow: 0 0 15px 5px var(--star-glow);
}

.secret-star.activated {
    background: var(--star-color) !important;
    box-shadow: 0 0 12px 4px var(--star-glow);
    opacity: 1 !important;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.9; }
}

@keyframes secret-pulse {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.3; }
}

/* Gradient Orbs - subtle background accents */
.gradient-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(88, 28, 135, 0.15) 0%, transparent 70%);
    top: -200px;
    right: -200px;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(30, 64, 175, 0.1) 0%, transparent 70%);
    bottom: -150px;
    left: -150px;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ============================================
   Screens
   ============================================ */
.screen {
    display: none;
    height: 100vh;
    width: 100vw;
}

.screen.active {
    display: flex;
}

/* ============================================
   Login Screen
   ============================================ */
#login-screen {
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 32px;
    position: relative;
    z-index: 3;
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
    position: relative;
}

.logo-icon {
    font-size: 48px;
    filter: drop-shadow(0 0 30px rgba(168, 85, 247, 0.3));
}

.logo-glow {
    position: absolute;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.2), transparent);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #fff 0%, #a1a1aa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    font-size: 16px;
    color: var(--foreground-muted);
    text-align: center;
    margin-bottom: 24px;
}

.security-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--foreground-muted);
    margin-bottom: 24px;
}

.security-badge svg {
    color: var(--success);
    flex-shrink: 0;
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 24px;
}

.tab {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--foreground-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.tab:hover {
    color: var(--foreground);
}

.tab.active {
    background: var(--accent);
    color: var(--foreground);
}

/* Forms */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-mode {
    display: none;
}

.login-mode.active {
    display: block;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--foreground);
}

.input-wrapper {
    position: relative;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--foreground);
    font-size: 14px;
    font-family: var(--font-sans);
    transition: all 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

input::placeholder,
textarea::placeholder {
    color: var(--foreground-subtle);
}

.input-hint {
    font-size: 12px;
    color: var(--foreground-subtle);
    margin-top: 4px;
}

.input-icon-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--foreground-subtle);
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s;
}

.input-icon-btn:hover {
    color: var(--foreground);
}

.input-icon-btn.textarea-btn {
    top: 12px;
    transform: none;
}

/* Buttons */
button {
    font-family: var(--font-sans);
    cursor: pointer;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s ease;
}

.btn-primary:hover {
    background: #e4e4e7;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-secondary:hover {
    background: var(--accent);
    border-color: var(--border-hover);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    color: var(--foreground-muted);
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-ghost:hover {
    background: var(--accent);
    color: var(--foreground);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s ease;
}

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

.btn-icon {
    padding: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

.btn-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-arrow {
    transition: transform 0.2s;
}

.btn-primary:hover .btn-arrow {
    transform: translateX(4px);
}

.spinner {
    animation: spin 1s linear infinite;
}

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

.error-message {
    color: var(--danger);
    font-size: 13px;
    padding: 8px 12px;
    background: var(--danger-muted);
    border-radius: var(--radius-md);
    display: none;
}

.error-message:not(:empty) {
    display: block;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--foreground-subtle);
}

/* ============================================
   Dashboard Layout
   ============================================ */
#dashboard-screen {
    flex-direction: column;
    position: relative;
    z-index: 10;
}

/* Header */
.header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 100;
}

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

.logo-mark {
    font-size: 24px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.brand {
    font-weight: 600;
    color: var(--foreground);
}

.divider {
    color: var(--border);
}

.page-title {
    color: var(--foreground-muted);
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--success-muted);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    color: var(--success);
}

.status-pill.disconnected {
    background: var(--danger-muted);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.status-dot {
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.user-name {
    font-weight: 500;
    color: var(--foreground);
}

.user-key {
    color: var(--foreground-subtle);
    font-family: var(--font-mono);
    font-size: 12px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--foreground-muted);
}

.creator-badge {
    background: linear-gradient(135deg, var(--star-color), #6366f1);
    color: white;
}

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.5);
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    display: block;
    padding: 0 12px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--foreground-subtle);
}

.nav-section.creator-only .nav-section-title {
    color: var(--star-color);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--foreground-muted);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-item:hover {
    background: var(--accent);
    color: var(--foreground);
}

.nav-item.active {
    background: var(--accent);
    color: var(--foreground);
}

.nav-item.danger {
    color: var(--danger);
}

.nav-item.danger:hover {
    background: var(--danger-muted);
}

.nav-badge {
    margin-left: auto;
    padding: 2px 8px;
    background: var(--accent);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    color: var(--foreground-muted);
}

.nav-badge.online {
    background: var(--success-muted);
    color: var(--success);
}

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

.online-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--foreground-muted);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

/* Content Area */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    position: relative;
}

/* Sections */
.section {
    display: none;
    animation: fadeIn 0.2s ease;
}

.section.active {
    display: block;
}

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

.section-header {
    margin-bottom: 24px;
}

.section-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 4px;
}

.section-desc {
    font-size: 14px;
    color: var(--foreground-muted);
}

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-warning {
    border-color: var(--warning);
    background: var(--warning-muted);
}

.card-danger {
    border-color: var(--danger);
    background: var(--danger-muted);
}

.card-success {
    border-color: var(--success);
    background: var(--success-muted);
}

.warning-text {
    font-size: 13px;
    color: var(--warning);
    margin-bottom: 16px;
}

/* Meta Card (Constitution) */
.meta-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 12px;
    color: var(--foreground-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--foreground);
}

.meta-hash {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--foreground-muted);
    word-break: break-all;
}

.meta-actions {
    display: flex;
    gap: 8px;
}

/* Constitution Grid */
.constitution-grid {
    display: grid;
    gap: 16px;
}

.principle-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: border-color 0.2s;
}

.principle-card:hover {
    border-color: var(--border-hover);
}

.principle-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.principle-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--star-color), #6366f1);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    color: white;
}

.principle-title {
    font-size: 16px;
    font-weight: 600;
}

.principle-description {
    font-size: 14px;
    color: var(--foreground-muted);
    line-height: 1.6;
}

/* Policies */
.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    padding: 4px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: fit-content;
}

.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--foreground-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.tab-btn:hover {
    color: var(--foreground);
}

.tab-btn.active {
    background: var(--accent);
    color: var(--foreground);
}

.policies-grid {
    display: grid;
    gap: 12px;
}

.policy-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: start;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: border-color 0.2s;
}

.policy-card:hover {
    border-color: var(--border-hover);
}

.policy-priority {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    color: var(--foreground-muted);
}

.policy-content {
    min-width: 0;
}

.policy-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.policy-id {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--foreground-muted);
}

.policy-category {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    color: var(--foreground-muted);
}

.policy-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.policy-description {
    font-size: 13px;
    color: var(--foreground-muted);
}

.policy-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Compliance */
.compliance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.compliance-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    transition: border-color 0.2s;
}

.compliance-card:hover {
    border-color: var(--border-hover);
}

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

.compliance-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.progress-bar {
    height: 4px;
    background: var(--accent);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), #4ade80);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.compliance-stats {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.stat-value {
    font-weight: 600;
    color: var(--foreground);
}

.stat-detail {
    color: var(--foreground-subtle);
}

.checklist {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.checklist-status {
    font-size: 16px;
}

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

.checklist-req {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
}

.checklist-reg {
    font-size: 11px;
    color: var(--foreground-subtle);
}

.filter-row {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.filter-row select {
    padding: 6px 12px;
    font-size: 12px;
    min-width: 140px;
}

/* Members */
.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.member-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    gap: 16px;
    transition: border-color 0.2s;
    cursor: pointer;
}

.member-card:hover {
    border-color: var(--border-hover);
}

.member-card.creator {
    border-color: var(--star-color);
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), transparent);
}

.member-avatar {
    width: 48px;
    height: 48px;
    background: var(--accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--foreground-muted);
    flex-shrink: 0;
}

.member-card.creator .member-avatar {
    background: linear-gradient(135deg, var(--star-color), #6366f1);
    color: white;
}

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

.member-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.member-role {
    font-size: 12px;
    color: var(--foreground-subtle);
    margin-bottom: 8px;
}

.member-key {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--foreground-subtle);
    word-break: break-all;
}

.member-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--foreground-subtle);
}

.member-status-dot.online {
    background: var(--success);
}

.member-status-dot.inactive {
    background: var(--danger);
}

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    max-height: 600px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-messages.small {
    height: 200px;
    flex: none;
}

.chat-message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.2s ease;
}

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

.chat-message-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--foreground-muted);
    flex-shrink: 0;
}

.chat-message-content {
    flex: 1;
    min-width: 0;
}

.chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.chat-message-author {
    font-weight: 600;
    font-size: 13px;
}

.chat-message-time {
    font-size: 11px;
    color: var(--foreground-subtle);
}

.chat-message-text {
    font-size: 14px;
    color: var(--foreground-muted);
    line-height: 1.5;
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--border);
}

.chat-input-wrapper.small {
    padding: 8px;
}

.chat-input-wrapper input {
    flex: 1;
}

/* Proposals */
.proposals-grid {
    display: grid;
    gap: 16px;
}

.proposal-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.proposal-card:hover {
    border-color: var(--border-hover);
}

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

.proposal-title {
    font-size: 16px;
    font-weight: 600;
}

.proposal-status {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
}

.proposal-status.active {
    background: var(--info-muted);
    color: var(--info);
}

.proposal-status.passed {
    background: var(--success-muted);
    color: var(--success);
}

.proposal-status.rejected {
    background: var(--danger-muted);
    color: var(--danger);
}

.proposal-description {
    font-size: 14px;
    color: var(--foreground-muted);
    margin-bottom: 16px;
}

.proposal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.proposal-votes {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.vote-yes {
    color: var(--success);
}

.vote-no {
    color: var(--danger);
}

.proposal-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--foreground-subtle);
}

/* Empty States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: var(--foreground-subtle);
    text-align: center;
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-text {
    color: var(--foreground-subtle);
    font-size: 14px;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.form-section {
    margin-bottom: 24px;
}

.form-section h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--foreground);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.checkbox-label:hover {
    border-color: var(--border-hover);
}

.checkbox-label input {
    width: 16px;
    height: 16px;
    accent-color: var(--star-color);
}

.permissions-section,
.nl-section,
.custom-policies-section {
    margin-top: 20px;
}

.inline-input {
    display: flex;
    gap: 8px;
}

.inline-input input {
    flex: 1;
}

/* Key Display */
.key-display {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.key-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.key-field label {
    font-size: 12px;
    color: var(--foreground-subtle);
}

.code-copy {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 12px;
}

.code-copy code {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 12px;
    word-break: break-all;
}

.warning-box {
    padding: 12px;
    background: var(--warning-muted);
    border: 1px solid var(--warning);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--warning);
    margin-top: 16px;
}

/* Preset Row */
.preset-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--foreground-muted);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.stat-item .stat-value {
    font-size: 20px;
    font-weight: 700;
}

.stat-item .stat-label {
    font-size: 11px;
    color: var(--foreground-subtle);
}

/* Audit Log */
.audit-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 600px;
    overflow-y: auto;
}

.audit-item {
    display: grid;
    grid-template-columns: 140px 1fr auto;
    gap: 16px;
    padding: 12px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
}

.audit-time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--foreground-subtle);
}

.audit-action {
    font-weight: 500;
}

.audit-actor {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--foreground-subtle);
}

/* Table */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 12px;
    font-weight: 600;
    color: var(--foreground-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    font-size: 14px;
}

tr:hover {
    background: var(--accent);
}

/* NL Result */
.nl-result {
    margin-top: 12px;
    padding: 12px;
    background: var(--info-muted);
    border: 1px solid var(--info);
    border-radius: var(--radius-md);
    font-size: 13px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    animation: modalIn 0.2s ease;
}

.modal-content.modal-sm {
    max-width: 420px;
}

.modal-content.modal-md {
    max-width: 640px;
}

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

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--foreground-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--accent);
    color: var(--foreground);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Vote Section */
.vote-section {
    margin: 20px 0;
    padding: 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.vote-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.vote-buttons {
    display: flex;
    gap: 8px;
}

.vote-btn {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border);
    background: transparent;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.vote-btn.approve {
    color: var(--success);
}

.vote-btn.approve:hover,
.vote-btn.approve.active {
    background: var(--success-muted);
    border-color: var(--success);
}

.vote-btn.reject {
    color: var(--danger);
}

.vote-btn.reject:hover,
.vote-btn.reject.active {
    background: var(--danger-muted);
    border-color: var(--danger);
}

.vote-btn.abstain {
    color: var(--foreground-muted);
}

.vote-btn.abstain:hover,
.vote-btn.abstain.active {
    background: var(--accent);
    border-color: var(--border-hover);
}

.vote-results {
    margin: 20px 0;
}

.vote-results h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.vote-bar {
    display: flex;
    height: 8px;
    background: var(--accent);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 8px;
}

.vote-bar-yes {
    background: var(--success);
    transition: width 0.3s ease;
}

.vote-bar-no {
    background: var(--danger);
    transition: width 0.3s ease;
}

.vote-counts {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--foreground-muted);
}

.proposal-chat {
    margin-top: 20px;
}

.proposal-chat h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* Member Header (Modal) */
.member-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.member-header .member-avatar {
    width: 56px;
    height: 56px;
    font-size: 24px;
}

.member-header .member-info {
    flex: 1;
}

.member-header .member-info h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.member-header code {
    font-size: 11px;
    color: var(--foreground-subtle);
}

/* Toast Container */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    min-width: 300px;
}

.toast.success {
    border-color: var(--success);
    background: linear-gradient(135deg, var(--success-muted), var(--card));
}

.toast.error {
    border-color: var(--danger);
    background: linear-gradient(135deg, var(--danger-muted), var(--card));
}

.toast.warning {
    border-color: var(--warning);
    background: linear-gradient(135deg, var(--warning-muted), var(--card));
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

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

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--foreground-muted);
}

/* Star Hint */
.star-hint {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    background: var(--card);
    border: 1px solid var(--star-color);
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--star-color);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 1000;
}

.star-hint.visible {
    opacity: 1;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Selection */
::selection {
    background: rgba(168, 85, 247, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .content {
        padding: 16px;
    }
    
    .meta-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .compliance-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Text utilities */
.text-muted {
    color: var(--foreground-muted);
}

code {
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 2px 6px;
    background: var(--accent);
    border-radius: var(--radius-sm);
}
