/* ============================================
   PrioStack - CSS Styles
   ============================================ */

:root {
    /* Dark Mode (Default) */
    --bg-body: #0f172a;
    --bg-panel: #1e293b;
    --bg-darker: #0b1120;
    --bg-input: #334155;
    --bg-hover: #2d3a4f;
    --border: #334155;
    --border-light: #475569;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-inverse: #0f172a;
    --accent-blue: #3b82f6;
    --accent-orange: #f97316;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    --font-ui: 'Segoe UI', Inter, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

/* ============================================
   Light Mode Theme
   ============================================ */
[data-theme="light"],
.theme-light,
body.light-mode {
    /* Main style.css variables */
    --bg-body: #f1f5f9;
    --bg-panel: #ffffff;
    --bg-darker: #e2e8f0;
    --bg-input: #f8fafc;
    --bg-hover: #f1f5f9;
    --border: #cbd5e1;
    --border-light: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-inverse: #f8fafc;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    
    /* Design system ps-* variables for web components */
    --ps-bg-body: #f8fafc;
    --ps-bg-surface: #ffffff;
    --ps-bg-elevated: #f1f5f9;
    --ps-border-default: #e2e8f0;
    --ps-border-subtle: #f1f5f9;
    --ps-border-strong: #cbd5e1;
    --ps-text-primary: #0f172a;
    --ps-text-secondary: #475569;
    --ps-text-tertiary: #64748b;
    --ps-input-bg: #ffffff;
    --ps-input-border: #cbd5e1;
}

/* Light mode specific adjustments */
[data-theme="light"] .sidebar,
.theme-light .sidebar,
body.light-mode .sidebar {
    background: #ffffff;
    border-right-color: #e2e8f0;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .nav-item.active,
.theme-light .nav-item.active,
body.light-mode .nav-item.active {
    background: rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .stat-card,
[data-theme="light"] .card,
.theme-light .stat-card,
.theme-light .card,
body.light-mode .stat-card,
body.light-mode .card {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: var(--card-shadow);
}

[data-theme="light"] .header,
.theme-light .header,
body.light-mode .header {
    background: rgba(255, 255, 255, 0.95);
    border-bottom-color: #e2e8f0;
}

[data-theme="light"] .market-ticker,
.theme-light .market-ticker,
body.light-mode .market-ticker {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .wallet-card,
[data-theme="light"] .user-section,
.theme-light .wallet-card,
.theme-light .user-section,
body.light-mode .wallet-card,
body.light-mode .user-section {
    background: #f8fafc;
    border-color: #e2e8f0;
}

[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .form-group textarea,
.theme-light .form-group input,
.theme-light .form-group select,
.theme-light .form-group textarea,
body.light-mode .form-group input,
body.light-mode .form-group select,
body.light-mode .form-group textarea {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

[data-theme="light"] .btn-outline,
.theme-light .btn-outline,
body.light-mode .btn-outline {
    border-color: #cbd5e1;
    color: #0f172a;
}

[data-theme="light"] .btn-outline:hover,
.theme-light .btn-outline:hover,
body.light-mode .btn-outline:hover {
    background: #f1f5f9;
}

[data-theme="light"] .btn-ghost,
.theme-light .btn-ghost,
body.light-mode .btn-ghost {
    color: #64748b;
}

[data-theme="light"] .btn-ghost:hover,
.theme-light .btn-ghost:hover,
body.light-mode .btn-ghost:hover {
    background: #f1f5f9;
    color: #0f172a;
}

[data-theme="light"] .modal,
.theme-light .modal,
body.light-mode .modal {
    background: #ffffff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .tag,
.theme-light .tag,
body.light-mode .tag {
    background: #f1f5f9;
}

[data-theme="light"] .table tr:hover,
.theme-light .table tr:hover,
body.light-mode .table tr:hover {
    background: rgba(59, 130, 246, 0.04);
}

[data-theme="light"] .log-entry,
.theme-light .log-entry,
body.light-mode .log-entry {
    background: #f8fafc;
    border-color: #e2e8f0;
}

[data-theme="light"] .activity-log,
.theme-light .activity-log,
body.light-mode .activity-log {
    background: #f8fafc;
}

/* ============================================
   Base Styles
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-ui);
    min-height: 100vh;
}

/* Dashboard layout - fixed sidebar, scrollable content */
body.dashboard-layout {
    height: 100vh;
    overflow: hidden;
}

body.dashboard-layout #app {
    display: flex;
    height: 100vh;
}

/* Public pages - normal scrolling */
body.public-layout {
    overflow-y: auto;
    overflow-x: hidden;
}

#app {
    display: flex;
    height: 100vh;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: 260px;
    background: var(--bg-darker);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 2rem;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.3rem;
    margin-bottom: 2rem;
}

.logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.logo-icon {
    width: 24px;
    height: 24px;
    background: var(--accent-orange);
    clip-path: polygon(0 100%, 100% 100%, 100% 60%, 50% 0, 0 60%);
}

.nav {
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 6px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s;
    cursor: pointer;
}

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

.nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border-left: 3px solid var(--accent-blue);
    margin-left: -3px;
}

.nav-item .icon {
    font-size: 1.1rem;
}

.wallet-card {
    background: var(--bg-panel);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.wallet-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.wallet-amount {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-green);
    margin-top: 4px;
}

.wallet-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 1rem;
    background: var(--bg-panel);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info {
    flex: 1;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-status {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   Main Content
   ============================================ */
.main,
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0; /* Prevent flex item from overflowing */
}

.header,
.app-header {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header h1,
.app-header h1 {
    font-size: 1.4rem;
    font-weight: 600;
}

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.market-ticker {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-panel);
    border-radius: 6px;
    font-size: 0.85rem;
}

.ticker-label {
    color: var(--text-muted);
}

.ticker-value {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent-green);
}

.ticker-value.high {
    color: var(--accent-orange);
}

.ws-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ws-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.ws-status.connected .status-dot {
    background: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green);
}

.ws-status.error .status-dot {
    background: var(--accent-red);
}

.content,
#content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.dashboard-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.dashboard-row > * {
    flex: 1;
    min-width: 280px;
}

/* ============================================
   Gamification Widget
   ============================================ */
.gamif-widget {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--bg-input);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.gamif-level {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent-purple);
}

.gamif-xp-bar {
    width: 60px;
    height: 6px;
    background: var(--bg-darker);
    border-radius: 3px;
    overflow: hidden;
}

.gamif-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.gamif-streak {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Wallet Display */
.wallet-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-input);
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.wallet-display:hover {
    background: var(--bg-hover);
    border-color: var(--accent-green);
}

.wallet-icon {
    font-size: 1rem;
}

.wallet-credits {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent-green);
}

/* ============================================
   Cards & Panels
   ============================================ */
.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

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

.card-title {
    font-weight: 600;
    font-size: 1rem;
}

.card-body {
    padding: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px var(--shadow-color);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-top: 0.5rem;
}

.stat-sub {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.stat-sub.up { color: var(--accent-green); }
.stat-sub.down { color: var(--accent-red); }

/* Equal height stats grid */
.stats-grid-equal {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: stretch;
}

.stats-grid-equal > ps-card {
    display: flex;
    flex-direction: column;
    --card-min-height: 220px;
}

.stat-card-fixed {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    height: 100%;
    --card-min-height: 220px;
}

.stat-card-fixed .stat-sub {
    flex-shrink: 0;
}

@media (max-width: 1200px) {
    .stats-grid-equal {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid-equal {
        grid-template-columns: 1fr;
    }
    .stat-card-fixed {
        min-height: auto;
    }
}

/* Storage Expansion */
.storage-expand-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.storage-gauge {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 4px;
    background: var(--bg-darker);
    outline: none;
    cursor: pointer;
}

.storage-gauge::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-orange);
    cursor: pointer;
    border: 2px solid var(--bg-panel);
    box-shadow: 0 2px 6px var(--shadow-color);
}

.storage-gauge::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-orange);
    cursor: pointer;
    border: 2px solid var(--bg-panel);
    box-shadow: 0 2px 6px var(--shadow-color);
}

.storage-price-preview {
    background: var(--bg-input);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    text-align: center;
}

/* ============================================
   Marketplace
   ============================================ */
.marketplace-search {
    padding: 10px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.9rem;
    min-width: 250px;
}

.marketplace-search:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.marketplace-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.marketplace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.marketplace-item {
    transition: transform 0.2s, box-shadow 0.2s;
}

.marketplace-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-color);
}

.mp-item-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.mp-item-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.mp-item-meta {
    flex: 1;
}

.mp-item-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
}

.mp-item-author {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.mp-item-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.mp-item-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.mp-rating {
    color: var(--accent-orange);
}

.mp-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.mp-price {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-green);
}

/* ============================================
   Settings Tabs
   ============================================ */
.settings-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: white;
}

/* ============================================
   Tables
   ============================================ */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

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

.btn-primary:hover {
    filter: brightness(1.1);
}

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

.btn-secondary:hover {
    filter: brightness(1.1);
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

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

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

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

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

.btn-outline:hover {
    background: var(--bg-panel);
}

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

.btn-ghost:hover {
    color: var(--text-main);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-input);
    color: var(--text-main);
}

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

.btn-xs {
    padding: 3px 8px;
    font-size: 0.75rem;
}

.btn-full {
    width: 100%;
}

.btn-oauth {
    background: var(--bg-input);
    color: var(--text-main);
    flex: 1;
}

/* ============================================
   Divider
   ============================================ */
.divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.divider span {
    padding: 0 1rem;
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent-blue);
}

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

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

/* ============================================
   Tags & Badges
   ============================================ */
.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-mono);
    background: var(--bg-input);
}

.tag-wasm { background: rgba(139, 92, 246, 0.2); color: var(--accent-purple); }
.tag-bpmn { background: rgba(59, 130, 246, 0.2); color: var(--accent-blue); }
.tag-static { background: rgba(34, 197, 94, 0.2); color: var(--accent-green); }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-running {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.status-stopped {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
}

.status-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.status-dot-inline {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
}

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

.modal-header h2 {
    font-size: 1.1rem;
}

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

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

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

/* ============================================
   Login Overlay (legacy - keep for compatibility)
   ============================================ */
.login-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.login-overlay.hidden {
    display: none;
}

/* ============================================
   Landing Page
   ============================================ */
.landing-page {
    position: fixed;
    inset: 0;
    background: var(--bg-body);
    z-index: 200;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.landing-page.hidden {
    display: none;
}

.particle-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.3;
    pointer-events: none;
}

.landing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    position: relative;
    z-index: 10;
}

.landing-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.3rem;
}

.landing-logo .logo-img {
    height: 40px;
    width: auto;
}

.landing-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.landing-nav a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.landing-nav a:hover {
    color: var(--text-main);
}

.landing-hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 3rem;
    position: relative;
    z-index: 10;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    max-width: 1200px;
    width: 100%;
    align-items: center;
}

.hero-text h1 {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 2rem;
    max-width: 500px;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.hero-note {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.market-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
}

.market-card h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.market-price {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.price-value {
    font-size: 3rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.price-unit {
    color: var(--text-muted);
}

.price-trend {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.price-trend.up {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

.price-trend.down {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.price-trend.stable {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}

.price-bar {
    height: 8px;
    background: var(--bg-darker);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.price-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-orange), var(--accent-red));
    transition: width 0.5s ease;
    width: 50%;
}

.price-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.glow-orange {
    box-shadow: 0 0 60px rgba(249, 115, 22, 0.15);
}

.landing-features {
    padding: 4rem 3rem;
    position: relative;
    z-index: 10;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.feature-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.feature-icon.blue {
    background: rgba(59, 130, 246, 0.2);
}

.feature-icon.green {
    background: rgba(34, 197, 94, 0.2);
}

.feature-icon.orange {
    background: rgba(249, 115, 22, 0.2);
}

.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.landing-footer {
    border-top: 1px solid var(--border);
    padding: 2rem 3rem;
    position: relative;
    z-index: 10;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--text-main);
}

/* ============================================
   Auth Modal
   ============================================ */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.auth-modal-overlay.active {
    display: flex;
}

.auth-modal {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.5rem;
    width: 90%;
    max-width: 420px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.auth-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-modal-close:hover {
    background: var(--bg-input);
    color: var(--text-main);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-muted);
}

.oauth-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-oauth {
    background: var(--bg-input);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-decoration: none;
}

.btn-oauth:hover {
    background: var(--bg-darker);
}

.oauth-icon {
    font-size: 1.2rem;
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
}

.auth-switch {
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-switch a {
    color: var(--accent-blue);
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* Button variants */
.btn-orange {
    background: var(--accent-orange);
    color: white;
}

.btn-orange:hover {
    background: #ea580c;
}

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

/* Responsive */
@media (max-width: 900px) {
    .hero-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-text h1 {
        font-size: 2.5rem;
    }
    
    .landing-header {
        padding: 1rem 1.5rem;
    }
    
    .landing-nav {
        gap: 1rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* ============================================
   Logs
   ============================================ */
.log-container {
    background: var(--bg-darker);
    border-radius: 8px;
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    max-height: 400px;
    overflow-y: auto;
}

.log-entry {
    padding: 4px 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
    display: flex;
    gap: 1rem;
}

.log-time {
    color: var(--text-muted);
    flex-shrink: 0;
}

.log-level {
    width: 50px;
    flex-shrink: 0;
    font-weight: 600;
}

.log-level.info { color: var(--accent-blue); }
.log-level.warn { color: var(--accent-orange); }
.log-level.error { color: var(--accent-red); }
.log-level.success { color: var(--accent-green); }

.log-message {
    color: var(--text-main);
    word-break: break-word;
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* ============================================
   Utilities
   ============================================ */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--accent-green); }
.text-danger { color: var(--accent-red); }
.text-warning { color: var(--accent-orange); }
.text-mono { font-family: var(--font-mono); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-center { text-align: center; }

/* Progress Bar */
.progress-bar {
    height: 6px;
    background: var(--bg-darker);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.hidden { display: none !important; }

/* ============================================
   Animations
   ============================================ */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Tablet and smaller desktops */
@media (max-width: 1200px) {
    .sidebar {
        width: 220px;
        padding: 1rem;
    }
    
    .content {
        padding: 1.5rem;
    }
    
    .header {
        padding: 1rem 1.5rem;
    }
    
    .hero-content {
        gap: 2rem;
    }
    
    .hero-text h1 {
        font-size: 2.5rem;
    }
}

/* Tablet */
@media (max-width: 992px) {
    .sidebar {
        width: 200px;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-subtitle {
        margin-left: auto;
        margin-right: auto;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-row {
        flex-direction: column;
    }
    
    .dashboard-row > * {
        min-width: 100%;
    }
}

/* Mobile landscape / small tablet */
@media (max-width: 768px) {
    #app {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        flex-direction: row;
        padding: 0.75rem 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
    }
    
    .sidebar .logo {
        margin-bottom: 0;
        margin-right: 1rem;
    }
    
    .sidebar .nav {
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .sidebar .nav-item {
        margin-bottom: 0;
        white-space: nowrap;
        padding: 8px 12px;
    }
    
    .sidebar .wallet-card,
    .sidebar .user-section {
        display: none;
    }
    
    .content {
        padding: 1rem;
    }
    
    .header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .header h1 {
        font-size: 1.2rem;
    }
    
    .header-right {
        gap: 0.75rem;
    }
    
    .market-ticker {
        display: none;
    }
    
    .landing-header {
        padding: 1rem;
    }
    
    .landing-hero {
        padding: 1.5rem 1rem;
    }
    
    .hero-text h1 {
        font-size: 2rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .landing-features {
        padding: 2rem 1rem;
    }
    
    .modal {
        width: 95%;
        max-height: 85vh;
    }
}

/* Mobile portrait */
@media (max-width: 480px) {
    .hero-text h1 {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .price-value {
        font-size: 2rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }
}

/* Dark mode header background fix */
[data-theme="light"] .header,
body.light-mode .header {
    background: rgba(255, 255, 255, 0.95);
}

/* Ensure content doesn't overflow */
.content > * {
    max-width: 100%;
}

/* Fix for cards inside flex containers */
.card {
    min-width: 0;
    overflow: hidden;
}

/* Bidding control responsive */
.bidding-control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.bidding-control .control-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

/* Two column layout for quick actions and system status */
.two-column-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .two-column-row {
        grid-template-columns: 1fr;
    }
}

/* Activity log responsive */
.activity-log {
    max-height: 300px;
    overflow-y: auto;
}

/* Quick actions grid */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* System status items */
.system-status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

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

/* ==========================================
   QUEUE FORECAST CHART
   ========================================== */

.queue-forecast-chart {
    width: 100%;
    height: 50px;
    margin-top: 0.5rem;
    border-radius: 4px;
    background: var(--bg-secondary);
}

[data-theme="light"] .queue-forecast-chart {
    background: rgba(59, 130, 246, 0.05);
}

/* ==========================================
   CREDIT OPTIONS (Inline Buttons)
   ========================================== */

.credit-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.credit-options ps-button {
    font-size: 0.7rem;
}

/* ==========================================
   CREDIT NUDGES
   ========================================== */

.credit-nudges {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.nudge-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.nudge-item:hover {
    background: var(--primary);
    color: white;
}

[data-theme="light"] .nudge-item {
    background: rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .nudge-item:hover {
    background: var(--primary);
    color: white;
}

.nudge-icon {
    font-size: 1rem;
}

.nudge-text {
    flex: 1;
}

/* ==========================================
   PARTNERS VIEW
   ========================================== */

.partners-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.partner-filter.active {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

.partners-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
}

.partner-card {
    padding: 1.25rem;
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.partner-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.partner-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.partner-logo {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 10px;
}

[data-theme="light"] .partner-logo {
    background: rgba(59, 130, 246, 0.1);
}

.partner-info {
    flex: 1;
}

.partner-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.verified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
}

.partner-location {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.partner-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.partner-type-integration {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.partner-type-development {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.partner-type-consulting {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.partner-type-support {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.partner-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.partner-specialties {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.specialty-tag {
    padding: 0.2rem 0.6rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

[data-theme="light"] .specialty-tag {
    background: rgba(0, 0, 0, 0.05);
}

.partner-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.partner-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rating-stars {
    font-weight: 600;
    color: #f59e0b;
}

.rating-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Partner Modal */
.benefits-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.benefits-list li {
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

/* Share buttons grid */
.share-buttons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.invite-share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Responsive partners */
@media (max-width: 768px) {
    .partners-grid {
        grid-template-columns: 1fr;
    }
    
    .partner-footer {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .share-buttons-grid {
        grid-template-columns: 1fr;
    }
}
