/* ===========================================
   AI Lightning - Web Client Styles
   =========================================== */

/* ---- Dark theme (default) ---- */
:root {
    --primary: #fdb499;
    --primary-dark: #e55a2b;
    --secondary: #94c5f9;
    --background: #1a1a2e;
    --background-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --surface: #2d2d44;
    --surface-light: #3a3a52;
    --text: #e0e0e0;
    --text-muted: #888;
    --success: #4caf50;
    --warning: #ff9800;
    --error: #f44336;
    --border-radius: 12px;
    --input-bg: var(--surface-light);
    --input-text: var(--text);
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
    --card-border: var(--surface-light);
}

/* ---- Light theme ---- */
[data-theme="light"] {
    --primary: #e55a2b;
    --primary-dark: #c9461a;
    --secondary: #2b7de5;
    --background: #f0f2f5;
    --background-gradient: linear-gradient(135deg, #f0f2f5 0%, #e4e8ee 100%);
    --surface: #ffffff;
    --surface-light: #e8eaed;
    --text: #1a1a2e;
    --text-muted: #5f6368;
    --success: #2e7d32;
    --warning: #e65100;
    --error: #c62828;
    --input-bg: #f0f2f5;
    --input-text: #1a1a2e;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --card-border: #d1d5db;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background-gradient);
    color: var(--text);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* ===========================================
   Header
   =========================================== */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--surface-light);
}

.header-main h1 {
    font-size: 2.5em;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header .tagline {
    color: var(--text-muted);
    margin: 5px 0 15px;
}

.header-nav {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin: 15px 0;
}

.header-nav a {
    color: var(--text);
    text-decoration: none;
    font-size: 0.95em;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s;
}

.header-nav a:hover {
    background: var(--surface);
    color: var(--primary);
}

#network-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--error);
    transition: background 0.3s;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

/* ===========================================
   Auth Section
   =========================================== */
#auth-section {
    max-width: 400px;
    margin: 0 auto;
}

.auth-form {
    background: var(--surface);
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
}

.auth-form h2 {
    margin-top: 0;
    color: var(--primary);
}

.auth-form input {
    width: 100%;
    padding: 12px 15px;
    margin: 10px 0;
    border: none;
    border-radius: 8px;
    background: var(--surface-light);
    color: var(--text);
    font-size: 1em;
}

.auth-form input:focus {
    outline: 2px solid var(--primary);
}

.auth-form button {
    width: 100%;
    margin-top: 15px;
}

.auth-form p {
    margin-top: 20px;
    color: var(--text-muted);
}

.auth-form .form-hint {
    margin: 10px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.auth-form a {
    color: var(--primary);
    text-decoration: none;
}

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

/* Guest Banner */
.guest-banner {
    background: linear-gradient(135deg, var(--primary) 0%, #f59e0b 100%);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.guest-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 15px;
    flex-wrap: wrap;
}

.guest-banner-content span {
    color: #1a1a2e;
    font-size: 0.95em;
}

.guest-banner-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.guest-banner-actions .btn-small {
    background: rgba(0, 0, 0, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 16px;
    font-weight: 600;
}

.guest-banner-actions .btn-primary {
    background: #1a1a2e;
    color: var(--primary);
    border: none;
}

/* Auth Prompt Modal */
.auth-prompt-content {
    text-align: center;
    max-width: 450px !important;
}

.auth-prompt-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.auth-prompt-content h3 {
    color: var(--primary);
    font-size: 1.4em;
    margin-bottom: 5px;
}

.auth-prompt-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 20px 0;
    text-align: left;
}

.auth-prompt-feature {
    padding: 8px 12px;
    background: var(--surface-light);
    border-radius: 8px;
    font-size: 0.95em;
}

.auth-prompt-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.auth-prompt-buttons .btn-large {
    padding: 14px 24px;
    font-size: 1.1em;
}

.auth-prompt-buttons .btn-secondary {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 10px 20px;
}

.auth-prompt-buttons .btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Email verification error message */
.error-message {
    background: var(--surface);
    border: 1px solid var(--error);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 15px;
    text-align: center;
}

.error-message p {
    margin: 5px 0;
    color: var(--text);
}

.error-message .btn-secondary {
    background: var(--primary);
    color: var(--background);
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
}

.error-message .btn-secondary:hover {
    background: var(--primary-light);
}

/* ===========================================
   Main Section
   =========================================== */
#user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.user-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

#user-info {
    color: var(--text-muted);
}

/* Balance Display */
.balance-display {
    background: var(--surface-light);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.3s;
}

.balance-display.low {
    color: var(--error);
    background: rgba(244, 67, 54, 0.15);
}

.balance-display.ok {
    color: var(--warning);
    background: rgba(255, 152, 0, 0.15);
}

.balance-display.good {
    color: var(--success);
    background: rgba(76, 175, 80, 0.15);
}

.btn-balance {
    padding: 6px 10px !important;
    font-size: 0.85em !important;
    background: var(--surface-light) !important;
}

.btn-balance:hover {
    background: var(--secondary) !important;
}

/* ===========================================
   Buttons
   =========================================== */
button {
    background: var(--primary);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.2s;
}

button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
}

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

.btn-secondary {
    background: var(--surface-light);
}

.btn-secondary:hover {
    background: #4a4a62;
}

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

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

.btn-stop {
    background: var(--warning);
    color: #1a1a2e;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95em;
    transition: all 0.3s;
    margin-left: 10px;
}

.btn-stop:hover {
    background: #ff7b00;
    transform: scale(1.05);
}

.btn-stop:active {
    transform: scale(0.95);
}

.btn-refresh {
    background: var(--surface-light);
    margin-top: 15px;
}

.btn-back {
    background: transparent;
    border: 1px solid var(--surface-light);
    color: var(--text-muted);
    padding: 8px 16px;
    margin-bottom: 15px;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: all 0.3s;
}

.btn-back:hover {
    background: var(--surface);
    color: var(--text);
}

.section-subtitle {
    color: var(--text-muted);
    margin-top: -5px;
    margin-bottom: 20px;
    font-size: 0.95em;
}

/* ===========================================
   Nodes Section
   =========================================== */
#nodes-section h3,
#models-section h3,
#session-config h3,
#invoice-section h3,
#network-panel h3 {
    color: var(--primary);
    margin-top: 0;
}

#nodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.node-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.node-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.node-card.node-busy {
    opacity: 0.6;
    cursor: not-allowed;
}

.node-card.node-busy:hover {
    border-color: transparent;
    transform: none;
}

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

.node-name {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--text);
}

.node-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
}

.node-status.available {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success);
}

.node-status.busy {
    background: rgba(244, 67, 54, 0.2);
    color: var(--error);
}

/* Restricted node badge */
.node-restricted-badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: bold;
    background: rgba(156, 39, 176, 0.2);
    color: #9b59b6;
    margin-left: 8px;
}

/* Node version badge */
.node-version-badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: bold;
    background: rgba(0, 188, 212, 0.2);
    color: #00bcd4;
    margin-left: auto;
}

.node-card.node-restricted {
    border-color: rgba(156, 39, 176, 0.4);
}

/* Disabled HuggingFace input for restricted nodes */
.huggingface-input.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.huggingface-input.disabled input,
.huggingface-input.disabled button {
    cursor: not-allowed;
}

.node-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 152, 0, 0.15));
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
}

.node-price-icon {
    font-size: 1.2em;
}

.node-price-value {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--warning);
}

.node-specs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    font-size: 0.85em;
    color: var(--text-muted);
}

.node-spec {
    display: flex;
    align-items: center;
    gap: 6px;
}

.node-spec-icon {
    font-size: 1.1em;
}

.node-disk-bar {
    margin-top: 12px;
    background: var(--surface-light);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.node-disk-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

.node-disk-fill.warning {
    background: var(--warning);
}

.node-disk-fill.danger {
    background: var(--error);
}

.node-disk-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: var(--text-muted);
    margin-top: 4px;
}

.node-models-count {
    margin-top: 10px;
    font-size: 0.9em;
    color: var(--secondary);
}

.node-busy-timer {
    margin-top: 8px;
    font-size: 0.85em;
    color: var(--warning);
}

/* ===========================================
   HuggingFace Custom Model Section
   =========================================== */
.hf-custom-section {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px dashed var(--surface-light);
}

.hf-custom-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--secondary);
}

.hf-input-row {
    display: flex;
    gap: 10px;
}

.hf-input-row input {
    flex: 1;
    padding: 12px;
    background: var(--surface-light);
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    color: var(--text);
    font-size: 0.95em;
}

.hf-input-row input:focus {
    outline: none;
    border-color: var(--primary);
}

.hf-hint {
    margin-top: 8px;
    margin-bottom: 0;
    font-size: 0.8em;
    color: var(--text-muted);
}

/* ===========================================
   Models Section
   =========================================== */

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.no-models {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    background: var(--surface);
    border-radius: var(--border-radius);
}

#models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.model-card {
    background: var(--surface);
    padding: 25px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    min-height: 180px;
    overflow: hidden;
}

.model-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.model-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.model-name {
    font-weight: 400;
    font-size: 0.95em;
    margin-bottom: 10px;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
}

.model-info {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.model-info .param {
    background: var(--secondary);
    color: white;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 400;
}

.model-info .quant {
    background: var(--surface-light);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 400;
}

.model-specs {
    font-size: 0.8em;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    font-weight: 400;
}

.model-availability {
    margin-top: auto;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.badge-green {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success);
}

.badge-yellow {
    background: rgba(255, 152, 0, 0.2);
    color: var(--warning);
}

/* ===========================================
   Model Card - Busy State
   =========================================== */
.model-card.model-busy {
    position: relative;
    opacity: 0.6;
    filter: grayscale(70%);
    border: 2px solid var(--surface-light);
    pointer-events: none;
}

.model-card.model-busy:hover {
    transform: none;
    border-color: var(--surface-light);
    box-shadow: none;
}

/* ===========================================
   Model Card - Disabled (Restricted)
   =========================================== */
.model-card.model-disabled {
    position: relative;
    opacity: 0.5;
    filter: grayscale(50%);
    border: 2px dashed var(--surface-light);
    cursor: not-allowed;
}

.model-card.model-disabled:hover {
    transform: none;
    border-color: var(--error);
    box-shadow: none;
}

.model-restricted-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--error);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: 600;
}

.model-busy-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.model-busy-overlay .busy-icon {
    font-size: 2em;
    animation: pulse 2s infinite;
}

.model-busy-overlay .busy-text {
    font-weight: 600;
    color: var(--warning);
    font-size: 1.1em;
}

.model-busy-overlay .busy-timer {
    background: var(--surface);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    color: var(--text);
    font-family: 'Courier New', monospace;
}

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

/* ===========================================
   Session Config
   =========================================== */
#session-config {
    background: var(--surface);
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.config-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--surface-light);
}

.config-row:last-of-type {
    border-bottom: none;
    margin-bottom: 20px;
}

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

/* Node Price Display in Session Config */
.node-price-row .node-price-value {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 152, 0, 0.15));
    border: 1px solid rgba(255, 193, 7, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: bold;
    color: var(--warning);
}

/* Context Slider */
.context-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.context-row label {
    margin-bottom: 5px;
}

.context-slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.context-slider-container input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--surface-light);
    appearance: none;
    cursor: pointer;
}

.context-slider-container input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: transform 0.2s;
}

.context-slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.context-slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

.slider-value {
    min-width: 60px;
    text-align: center;
    font-weight: 600;
    color: var(--primary);
    font-family: 'Courier New', monospace;
    background: var(--surface-light);
    padding: 5px 10px;
    border-radius: 6px;
}

/* ===========================================
   Advanced LLM Parameters
   =========================================== */
.advanced-params {
    background: var(--surface-light);
    border-radius: var(--border-radius);
    padding: 15px;
    margin: 20px 0;
}

.advanced-params summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--secondary);
    padding: 5px;
    outline: none;
}

.advanced-params summary:hover {
    color: var(--primary);
}

.advanced-params[open] summary {
    margin-bottom: 15px;
    border-bottom: 1px solid var(--surface);
    padding-bottom: 10px;
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

.param-group {
    background: var(--surface);
    padding: 15px;
    border-radius: 8px;
}

.param-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
}

.param-group input[type="range"] {
    width: calc(100% - 50px);
    margin-right: 10px;
    accent-color: var(--primary);
    vertical-align: middle;
}

.param-group input[type="number"] {
    width: 100%;
    padding: 8px;
    background: var(--background);
    border: 1px solid var(--surface-light);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.95em;
}

.param-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
}

.param-value {
    display: inline-block;
    min-width: 40px;
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary);
}

.param-group small {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.8em;
    line-height: 1.4;
}

.config-row input {
    width: 100px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: var(--surface-light);
    color: var(--text);
    text-align: center;
}

.session-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.session-buttons button {
    margin: 0;
}

.btn-settings {
    background: var(--secondary);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-settings:hover {
    background: #3a7bc8;
    transform: translateY(-1px);
}

/* ===========================================
   LLM Settings Modal
   =========================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--surface);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
}

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

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

.modal-header h3 {
    margin: 0;
    color: var(--primary);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8em;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--error);
    transform: none;
    background: transparent;
}

.modal-body {
    padding: 20px 25px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--surface-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Settings Sections */
.settings-section {
    margin-bottom: 25px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h4 {
    color: var(--secondary);
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--surface-light);
    font-size: 1em;
}

/* Gear Button */
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    margin-left: 10px;
}

.btn-icon:hover {
    color: var(--primary);
    background: var(--surface-light);
    transform: rotate(30deg);
}

/* Full width param group */
.param-group.full-width {
    grid-column: 1 / -1;
}

.text-input-wide {
    width: 100%;
    padding: 10px;
    background: var(--background);
    border: 1px solid var(--surface-light);
    border-radius: 6px;
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.text-input-wide:focus {
    outline: none;
    border-color: var(--primary);
}

/* ===========================================
   RAG Panel Styles
   =========================================== */
.modal-small .modal-content {
    max-width: 500px;
}

.rag-description {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 20px;
    line-height: 1.5;
}

.rag-toggle {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--surface);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

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

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--surface-light);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text);
    transition: 0.3s;
    border-radius: 50%;
}

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

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

.rag-topk-label {
    margin-left: auto;
    color: var(--text-muted);
}

.rag-toggle select {
    padding: 5px 10px;
    background: var(--background);
    border: 1px solid var(--surface-light);
    border-radius: 4px;
    color: var(--text);
}

.rag-add-section {
    margin-bottom: 20px;
}

.rag-add-section h4,
.rag-documents-section h4 {
    color: var(--secondary);
    margin: 0 0 10px 0;
    font-size: 0.95em;
}

.rag-add-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.rag-status {
    color: var(--primary);
    font-size: 0.9em;
    min-height: 20px;
}

.rag-docs-list {
    background: var(--background);
    border-radius: var(--border-radius);
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
}

.rag-empty {
    color: var(--text-muted);
    text-align: center;
    font-size: 0.9em;
    padding: 20px;
}

.rag-doc-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 8px;
}

.rag-doc-item:last-child {
    margin-bottom: 0;
}

.rag-doc-icon {
    font-size: 1.5em;
    margin-right: 10px;
}

.rag-doc-info {
    flex: 1;
}

.rag-doc-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.rag-doc-meta {
    font-size: 0.8em;
    color: var(--text-muted);
}

.rag-doc-remove {
    background: transparent;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.rag-doc-remove:hover {
    opacity: 1;
}

.rag-stats {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85em;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--surface-light);
}

#rag-text-content {
    width: 100%;
    padding: 10px;
    background: var(--background);
    border: 1px solid var(--surface-light);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    resize: vertical;
}

#rag-text-content:focus {
    outline: none;
    border-color: var(--primary);
}

.text-input {
    width: 100%;
    padding: 10px;
    background: var(--background);
    border: 1px solid var(--surface-light);
    border-radius: 6px;
    color: var(--text);
    margin-bottom: 15px;
}

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

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 0.9em;
}

/* ===========================================
   Invoice Section
   =========================================== */
#invoice-section {
    background: var(--surface);
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
}

/* QR Code Container */
#qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    width: fit-content;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#qr-code {
    display: flex;
    justify-content: center;
    align-items: center;
}

#qr-code canvas,
#qr-code img {
    display: block;
    margin: 0 auto;
}

.qr-hint {
    text-align: center;
    color: var(--text-secondary);
    margin: 10px 0 15px 0;
    font-size: 0.9em;
}

/* Wallet Payment Option */
.wallet-pay-box {
    background: linear-gradient(135deg, var(--surface-light), var(--surface));
    border: 2px solid var(--primary);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.wallet-pay-box p {
    margin: 10px 0;
}

.wallet-pay-box .btn-large {
    padding: 15px 40px;
    font-size: 1.2em;
    margin: 15px 0;
}

.or-divider {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-top: 15px !important;
}

.payment-auto-check {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9em;
    animation: pulse 2s infinite;
}

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

#invoice-container {
    position: relative;
    margin: 20px 0;
}

#invoice {
    background: var(--surface-light);
    padding: 15px;
    border-radius: 8px;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: 'Consolas', monospace;
    font-size: 0.8em;
    max-height: 100px;
    overflow-y: auto;
    text-align: left;
    margin-bottom: 10px;
}

.invoice-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.btn-lightning {
    background: linear-gradient(135deg, #f7931a, #ffb347) !important;
    color: #1a1a2e !important;
    font-weight: 600;
}

.btn-lightning:hover {
    background: linear-gradient(135deg, #ffb347, #f7931a) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(247, 147, 26, 0.4);
}

.invoice-amount {
    font-size: 1.3em;
    margin: 15px 0;
}

.invoice-amount span {
    color: var(--primary);
    font-weight: 600;
}

.invoice-hint {
    color: var(--text-muted);
    font-size: 0.9em;
    margin: 10px 0;
}

.payment-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}
}

/* ===========================================
   Chat Section
   =========================================== */
#session-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
}

#session-model {
    font-weight: 500;
}

#session-expires {
    color: var(--text-muted);
    font-size: 0.9em;
}

.chat-container {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 20px;
    height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    line-height: 1.5;
}

.message.you {
    background: var(--surface-light);
    margin-left: 20%;
    border-bottom-right-radius: 4px;
}

.message.ai {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    margin-right: 20%;
    border-bottom-left-radius: 4px;
}

.message.system {
    background: transparent;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.9em;
    max-width: 100%;
    padding: 8px;
}

.message strong {
    display: block;
    margin-bottom: 5px;
    opacity: 0.8;
    font-size: 0.85em;
}

.input-area {
    display: flex;
    gap: 10px;
}

#prompt {
    flex-grow: 1;
    padding: 14px 18px;
    border: none;
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 1em;
}

#prompt:focus {
    outline: 2px solid var(--primary);
}

#prompt:disabled {
    opacity: 0.5;
}

/* Typing indicator */
.message.loading {
    background: var(--surface-light);
    margin-right: 20%;
}

/* Streaming message cursor */
.message.streaming .cursor {
    display: inline-block;
    color: var(--primary);
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.message.streaming {
    border-left: 3px solid var(--primary);
}

.message.streaming .content {
    display: inline;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 5px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-8px);
    }
}

/* Code formatting */
.message code {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.message pre {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.message pre code {
    background: none;
    padding: 0;
}

/* LaTeX/KaTeX styling */
.message .katex {
    font-size: 1.1em;
}

.message .katex-display {
    margin: 1em 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5em 0;
}

.message .katex-display > .katex {
    text-align: center;
}

.math-display {
    display: block;
    text-align: center;
    margin: 1em 0;
    padding: 0.5em;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow-x: auto;
}

.math-inline {
    display: inline;
}

.latex-error {
    color: var(--error);
    background: rgba(244, 67, 54, 0.1);
    padding: 2px 4px;
    border-radius: 2px;
}

/* ===========================================
   Network Panel
   =========================================== */
#network-panel {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-top: 20px;
}

#network-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item .label {
    font-size: 0.85em;
    color: var(--text-muted);
}

.info-item span:not(.label) {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--primary);
}

/* ===========================================
   Modal
   =========================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface);
    padding: 30px;
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-content h3 {
    margin-top: 0;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--text-muted);
}

.close:hover {
    color: var(--text);
}

.node-card {
    background: var(--surface-light);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.node-name {
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 8px;
}

.node-info {
    font-size: 0.9em;
    color: var(--text-muted);
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.node-gpus {
    margin-bottom: 8px;
}

.gpu-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 10px;
    background: var(--surface);
    border-radius: 4px;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.gpu-vram {
    color: var(--primary);
}

.node-models {
    font-size: 0.85em;
    color: var(--text-muted);
}

/* ===========================================
   Notifications
   =========================================== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s;
    z-index: 2000;
    max-width: 400px;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.success {
    background: var(--success);
}

.notification.error {
    background: var(--error);
}

.notification.info {
    background: var(--secondary);
}

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    #models-grid {
        grid-template-columns: 1fr;
    }
    
    .message {
        max-width: 90%;
    }
    
    .message.you {
        margin-left: 10%;
    }
    
    .message.ai {
        margin-right: 10%;
    }
    
    #session-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    #network-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .config-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ===========================================
   Loading Overlay
   =========================================== */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    padding: 40px;
    background: var(--surface);
    border-radius: var(--border-radius);
    max-width: 400px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--surface-light);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-message {
    font-size: 1.1em;
    color: var(--text);
    margin-bottom: 10px;
}

.loading-status {
    font-size: 0.95em;
    color: var(--primary);
    margin-bottom: 10px;
    min-height: 1.2em;
    word-break: break-word;
    max-width: 350px;
}

.loading-timer {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 20px;
}

.loading-content .btn {
    margin-top: 10px;
}
/* ===========================================
   Footer
   =========================================== */
#footer {
    background: var(--surface);
    margin-top: 60px;
    padding: 40px 20px 20px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    max-width: 1000px;
    margin: 0 auto;
}

.footer-section h4 {
    color: var(--primary);
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.footer-section p {
    color: var(--text-muted);
    font-size: 0.9em;
    line-height: 1.6;
    margin: 0;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.3s;
}

.footer-section ul li a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--surface-light);
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 0.85em;
    margin: 5px 0;
}

.footer-tagline {
    color: var(--text) !important;
    font-size: 0.9em !important;
}

/* ===========================================
   Info Modals (About, How it Works, etc.)
   =========================================== */
.modal-info {
    max-width: 600px;
}

.modal-info .modal-body {
    text-align: left;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-info h4 {
    color: var(--primary);
    margin-top: 25px;
    margin-bottom: 10px;
}

.modal-info p {
    line-height: 1.7;
    color: var(--text);
}

.modal-info ul, .modal-info ol {
    padding-left: 20px;
    margin: 10px 0;
}

.modal-info li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.modal-info a {
    color: var(--primary);
}

.modal-info a:hover {
    text-decoration: underline;
}

/* Contact Modal */
.contact-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 25px 0;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--surface-light);
    padding: 20px;
    border-radius: var(--border-radius);
}

.contact-icon {
    font-size: 2rem;
}

.contact-item strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.contact-item p {
    margin: 0;
    color: var(--text-secondary);
}

.contact-item a {
    color: var(--primary);
    text-decoration: none;
    font-size: 1.1rem;
}

.contact-item a:hover {
    text-decoration: underline;
}

.contact-note {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

/* How it Works Steps */
.steps {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.step {
    background: var(--surface-light);
    padding: 20px;
    border-radius: var(--border-radius);
    position: relative;
}

.step-num {
    position: absolute;
    top: -10px;
    left: 20px;
    background: var(--primary);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.step h4 {
    margin-top: 10px;
    margin-bottom: 8px;
}

.step p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95em;
}

/* CTA Box */
.cta-box {
    margin-top: 25px;
    text-align: center;
    padding: 20px;
    background: var(--surface-light);
    border-radius: var(--border-radius);
}

.cta-box .btn-primary {
    display: inline-block;
    padding: 12px 30px;
    font-size: 1em;
    text-decoration: none;
}

/* Test Credentials Box */
.test-credentials {
    background: var(--surface-light);
    border: 2px solid var(--primary);
    border-radius: var(--border-radius);
    padding: 15px 20px;
    margin: 15px 0;
}

.credential-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.credential-label {
    color: var(--text-muted);
    font-weight: 600;
    min-width: 90px;
}

.credential-value {
    background: var(--bg);
    padding: 4px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 1em;
    color: var(--primary);
    user-select: all;
}

.test-note {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(255, 165, 0, 0.1);
    border-radius: 6px;
    border-left: 3px solid orange;
}

/* ===========================================
   Tab Navigation
   =========================================== */
.main-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--surface-light);
    padding-bottom: 5px;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1em;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: var(--surface);
    color: var(--text);
}

.tab-btn.active {
    background: var(--surface);
    color: var(--primary);
    font-weight: bold;
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

/* ===========================================
   Wallet Styles
   =========================================== */
.wallet-container {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 30px;
}

.wallet-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--surface-light);
}

.wallet-header h3 {
    margin: 0 0 15px 0;
    font-size: 1.5em;
}

.wallet-balance-big {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
}

.wallet-balance-big .balance-amount {
    font-size: 3em;
    font-weight: bold;
    color: var(--primary);
}

.wallet-balance-big .balance-unit {
    font-size: 1.2em;
    color: var(--text-muted);
}

.wallet-balance-btc {
    color: var(--text-muted);
    margin-top: 5px;
}

.wallet-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.wallet-actions button {
    min-width: 150px;
    padding: 15px 30px;
    font-size: 1.1em;
}

.wallet-transactions {
    background: var(--surface-light);
    border-radius: var(--border-radius);
    padding: 20px;
}

.wallet-transactions h4 {
    margin: 0 0 15px 0;
}

#transactions-list {
    max-height: 400px;
    overflow-y: auto;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--surface);
}

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

.transaction-info {
    flex: 1;
}

.transaction-type {
    font-weight: bold;
    text-transform: capitalize;
}

.transaction-type.deposit { color: var(--success); }
.transaction-type.session_payment { color: var(--error); }
.transaction-type.node_earning { color: var(--success); }
.transaction-type.commission { color: var(--warning); }
.transaction-type.refund { color: #9b59b6; } /* Purple for refunds */

.transaction-desc {
    font-size: 0.9em;
    color: var(--text-muted);
}

.transaction-amount {
    font-weight: bold;
    font-size: 1.1em;
}

.transaction-amount.positive { color: var(--success); }
.transaction-amount.negative { color: var(--error); }

.transaction-date {
    font-size: 0.8em;
    color: var(--text-muted);
}

/* Deposit Modal */
#deposit-modal .modal-content {
    max-width: 500px;
    width: 95%;
    margin: auto;
}

#deposit-modal .modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
}

#deposit-invoice {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#deposit-qr-code {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#deposit-qr-code canvas,
#deposit-qr-code img,
#deposit-qr-code svg {
    display: block;
    max-width: 100%;
    height: auto;
}

.invoice-text {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 400px;
    margin: 15px auto;
}

.invoice-text input {
    flex: 1;
    padding: 12px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text);
    font-family: 'Consolas', monospace;
    font-size: 0.8em;
}

.invoice-text .btn-copy {
    padding: 12px 15px;
    white-space: nowrap;
}

.deposit-amount-select {
    margin-bottom: 20px;
    width: 100%;
}

/* Hide spinner arrows so value cannot exceed max=100000 */
#deposit-amount::-webkit-inner-spin-button,
#deposit-amount::-webkit-outer-spin-button { display: none; }
#deposit-amount { -moz-appearance: textfield; appearance: textfield; }

.amount-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 15px 0;
}

.amount-btn {
    padding: 12px;
    background: var(--surface-light);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.amount-btn:hover {
    border-color: var(--primary);
}

.amount-btn.active {
    border-color: var(--primary);
    background: rgba(255, 107, 53, 0.1);
}

.custom-amount {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.custom-amount input {
    width: 150px;
}

.deposit-status {
    margin: 20px 0;
    padding: 15px;
    background: var(--surface-light);
    border-radius: var(--border-radius);
    text-align: center;
}

/* Withdraw Modal */
#withdraw-modal .modal-content {
    max-width: 500px;
    width: 95%;
    margin: auto;
}

#withdraw-modal .modal-body {
    padding: 20px;
}

.withdraw-balance {
    text-align: center;
    font-size: 1.1em;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--surface-light);
    border-radius: var(--border-radius);
}

.withdraw-balance strong {
    color: var(--primary);
}

.withdraw-input {
    margin-bottom: 15px;
}

.withdraw-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.withdraw-input textarea {
    width: 100%;
    padding: 12px;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text);
    font-family: 'Consolas', monospace;
    font-size: 0.85em;
    resize: vertical;
}

.withdraw-input textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.withdraw-note {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 20px;
    text-align: center;
}

#withdraw-form .btn-primary {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
}

.withdraw-success {
    text-align: center;
    padding: 30px 20px;
}

.withdraw-success .success-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
}

.withdraw-success h4 {
    color: var(--success);
    margin-bottom: 15px;
}

.withdraw-success p {
    margin: 10px 0;
}

#withdraw-result .btn-secondary {
    width: 100%;
    margin-top: 20px;
}

.deposit-amount-display {
    text-align: center;
    font-size: 1.2em;
    margin: 15px 0;
}

/* ===========================================
   Admin Dashboard
   =========================================== */
.admin-container {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 30px;
}

.admin-container h3 {
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--warning);
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface-light);
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-top: 5px;
}

.admin-section {
    background: var(--surface-light);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.admin-section h4 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--surface);
}

#admin-users-list, #admin-transactions-list {
    max-height: 300px;
    overflow-y: auto;
}

.admin-user-item, .admin-tx-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--surface);
}

.admin-user-item:last-child, .admin-tx-item:last-child {
    border-bottom: none;
}

.user-info-admin {
    flex: 1;
}

.user-name {
    font-weight: bold;
}

.user-meta {
    font-size: 0.85em;
    color: var(--text-muted);
}

.user-btc-addr {
    color: #4caf50;
    font-family: 'Fira Code', monospace;
    font-size: 0.78em;
    word-break: break-all;
}

.user-btc-pending {
    color: #ff9800;
    font-family: 'Fira Code', monospace;
    font-size: 0.78em;
    word-break: break-all;
}

.user-admin-actions {
    display: flex;
    gap: 6px;
    margin-left: 10px;
}

.user-balance {
    font-weight: bold;
    color: var(--primary);
}

/* Commission Chart (simple bar chart) */
#admin-commissions-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.commission-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.commission-date {
    min-width: 80px;
    font-size: 0.85em;
    color: var(--text-muted);
}

.commission-fill {
    height: 20px;
    background: linear-gradient(90deg, var(--primary), var(--warning));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.commission-value {
    font-size: 0.9em;
    min-width: 80px;
}

/* ===== Activity Chart (logins + page views, 7 days) ===== */
.activity-legend {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.activity-legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: middle;
}
.login-dot  { background: var(--secondary); }
.pv-dot     { background: var(--primary); }

.activity-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.activity-row {
    display: grid;
    grid-template-columns: 52px 1fr 1fr 80px;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
}

.activity-date {
    color: var(--text-muted);
    font-size: 0.9em;
    white-space: nowrap;
}

.activity-bar-wrap {
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    height: 16px;
    overflow: hidden;
}

.activity-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
    min-width: 2px;
}

.activity-bar-fill.bar-login { background: var(--secondary); }
.activity-bar-fill.bar-pv    { background: var(--primary); }

.activity-counts {
    color: var(--text-muted);
    font-size: 0.82em;
    white-space: nowrap;
    text-align: right;
}

/* Pagination */
#transactions-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.pagination-btn {
    padding: 8px 15px;
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    color: var(--text);
    cursor: pointer;
}

.pagination-btn:hover {
    background: var(--surface-light);
}

.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
}

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

/* Admin Settings Section */
.admin-settings-section {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 100, 0, 0.05));
    border: 1px solid var(--warning);
}

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

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setting-item label {
    color: var(--text-muted);
    font-size: 0.9em;
}

.setting-value {
    color: var(--text);
    font-weight: bold;
    font-size: 1.1em;
}

.setting-input-group {
    display: flex;
    gap: 10px;
}

.setting-input-group input {
    flex: 1;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    color: var(--text);
}

/* Admin Nodes Grid */
.admin-nodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.admin-node-card {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    padding: 15px;
    transition: border-color 0.2s;
}

.admin-node-card.node-outdated {
    border-color: var(--error);
    background: rgba(255, 82, 82, 0.1);
}

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

.node-name {
    font-weight: bold;
    font-size: 1.1em;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75em;
}

.badge-busy {
    background: rgba(255, 82, 82, 0.2);
    color: var(--error);
}

.badge-free {
    background: rgba(0, 230, 118, 0.2);
    color: var(--success);
}

.node-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.node-detail {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
}

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

.version-ok {
    color: var(--success);
}

.version-outdated {
    color: var(--error);
    font-weight: bold;
}

.node-id {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--surface-light);
    font-size: 0.75em;
    color: var(--text-muted);
    font-family: monospace;
    word-break: break-all;
}

/* ===========================================
   Responsive - Large Screens (Full HD, 4K)
   =========================================== */
@media (min-width: 1920px) {
    #deposit-modal .modal-content {
        max-width: 550px;
    }
    
    #deposit-qr-code {
        padding: 25px;
    }
    
    #deposit-qr-code canvas,
    #deposit-qr-code img,
    #deposit-qr-code svg {
        width: 280px !important;
        height: 280px !important;
    }
    
    .invoice-text {
        max-width: 450px;
    }
    
    .deposit-amount-display {
        font-size: 1.4em;
    }
}

/* 4K Screens */
@media (min-width: 2560px) {
    #deposit-modal .modal-content {
        max-width: 650px;
    }
    
    #deposit-qr-code {
        padding: 30px;
    }
    
    #deposit-qr-code canvas,
    #deposit-qr-code img,
    #deposit-qr-code svg {
        width: 320px !important;
        height: 320px !important;
    }
    
    .invoice-text {
        max-width: 550px;
    }
    
    .deposit-amount-display {
        font-size: 1.6em;
    }
    
    .amount-btn {
        padding: 16px;
        font-size: 1.1em;
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #deposit-modal .modal-content {
        width: 98%;
        max-height: 90vh;
    }
    
    #deposit-qr-code {
        padding: 15px;
    }
    
    .invoice-text {
        flex-direction: column;
    }
    
    .amount-buttons {
        grid-template-columns: 1fr;
    }
}

/* ===========================================
   Stripe EUR Deposit & Converter
   =========================================== */

.btn-stripe {
    background: linear-gradient(135deg, #635bff, #7a73ff) !important;
    color: #fff !important;
    border: none;
}
.btn-stripe:hover {
    background: linear-gradient(135deg, #5046e5, #635bff) !important;
}

/* Stripe penalty banner */
.stripe-penalty-banner {
    display: flex;
    gap: 12px;
    background: rgba(255, 152, 0, 0.12);
    border: 1px solid rgba(255, 152, 0, 0.35);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 20px;
}
.stripe-penalty-banner .penalty-icon {
    font-size: 1.8em;
    flex-shrink: 0;
}
.stripe-penalty-banner .penalty-text {
    font-size: 0.9em;
    line-height: 1.55;
}
.stripe-penalty-banner .penalty-text strong {
    color: var(--warning);
}
.stripe-penalty-banner .penalty-text p {
    margin: 4px 0;
}
.stripe-penalty-banner .penalty-tip {
    color: var(--success);
    font-weight: 500;
    margin-top: 8px !important;
}

/* Stripe conversion preview */
.stripe-conversion-preview {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 16px;
    margin: 16px 0;
}
.stripe-conversion-preview .preview-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.95em;
}
.stripe-conversion-preview .preview-row span:first-child {
    color: var(--text-muted);
}
.stripe-conversion-preview .preview-credited {
    border-top: 1px solid var(--surface-light);
    padding-top: 10px;
    margin-top: 6px;
}
.stripe-conversion-preview .preview-credited strong {
    color: var(--success);
    font-size: 1.15em;
}
.stripe-conversion-preview .preview-rate {
    border-top: 1px solid var(--surface-light);
    padding-top: 8px;
    margin-top: 4px;
    font-size: 0.85em;
}

.btn-stripe-pay {
    width: 100%;
    padding: 14px;
    font-size: 1.1em;
    background: linear-gradient(135deg, #635bff, #7a73ff) !important;
    margin-top: 12px;
}
.btn-stripe-pay:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    width: 100%;
    padding: 10px;
    font-size: 0.95em;
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s;
}
.btn-secondary:hover {
    background: var(--surface);
    border-color: var(--primary);
}

.stripe-card-summary {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 14px 18px;
    margin-bottom: 18px;
    text-align: center;
}
.stripe-card-summary p {
    margin: 4px 0;
    font-size: 0.95em;
}

.stripe-card-form {
    margin-bottom: 16px;
}
.stripe-card-form label {
    display: block;
    font-size: 0.9em;
    margin-bottom: 8px;
    color: var(--text-muted);
}
.stripe-card-element {
    background: var(--background);
    border: 2px solid var(--surface-light);
    border-radius: 10px;
    padding: 14px 16px;
    transition: border-color 0.2s;
}
.stripe-card-element:focus-within,
.stripe-card-element.StripeElement--focus {
    border-color: #635bff;
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.2);
}
.stripe-card-element.StripeElement--invalid {
    border-color: var(--error);
}
.stripe-card-errors {
    color: var(--error);
    font-size: 0.85em;
    margin-top: 6px;
    min-height: 20px;
}

.stripe-success {
    text-align: center;
    padding: 30px 20px;
}
.stripe-success .success-icon {
    font-size: 3em;
    display: block;
    margin-bottom: 12px;
}
.stripe-success h4 {
    color: var(--success);
    margin: 8px 0 16px;
}
.stripe-success p {
    margin: 6px 0;
    font-size: 0.95em;
}

.stripe-note {
    text-align: center;
    font-size: 0.8em;
    color: var(--text-muted);
    margin-top: 8px;
}

.processing-spinner {
    text-align: center;
    padding: 40px 20px;
}
.processing-spinner .spinner-icon {
    font-size: 2.5em;
    display: block;
    margin-bottom: 16px;
    animation: spin 1.5s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* EUR ↔ Sats Converter Widget */
.converter-widget {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 20px;
}
.converter-widget h4 {
    margin: 0 0 14px 0;
    color: var(--primary);
}
.converter-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.converter-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.converter-input-group label {
    font-size: 0.85em;
    color: var(--text-muted);
}
.converter-input-group input {
    width: 120px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--surface-light);
    background: var(--background);
    color: var(--text);
    font-size: 1em;
}
.converter-input-group small {
    color: var(--text-muted);
    font-size: 0.85em;
}
.converter-arrow {
    font-size: 1.5em;
    color: var(--primary);
    flex-shrink: 0;
}
.converter-result {
    flex: 1;
    min-width: 180px;
}
.converter-result-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}
.converter-result-row .converter-label {
    color: var(--text-muted);
    font-size: 0.9em;
    min-width: 100px;
}
.converter-result-row.converter-credited strong {
    color: var(--success);
    font-size: 1.1em;
}
.converter-rate {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--surface-light);
}
.converter-rate small {
    color: var(--text-muted);
}

/* Converter notice box */
.converter-notice {
    margin-top: 14px;
    padding: 14px;
    background: rgba(255, 152, 0, 0.08);
    border: 1px solid rgba(255, 152, 0, 0.2);
    border-radius: 8px;
    font-size: 0.88em;
    line-height: 1.6;
}
.converter-notice p {
    margin: 4px 0;
}
.converter-notice ul {
    margin: 6px 0;
    padding-left: 20px;
}
.converter-notice li {
    margin: 3px 0;
}
.converter-tip {
    color: var(--success) !important;
    margin-top: 8px !important;
}

/* ===========================================
   User Settings Tab
   =========================================== */
.settings-container {
    max-width: 700px;
    margin: 0 auto;
}
.settings-container h3 {
    margin-bottom: 24px;
}
.settings-section {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 20px 24px;
    margin-bottom: 18px;
}
.settings-section h4 {
    margin: 0 0 16px 0;
    color: var(--primary);
    font-size: 1.05em;
}
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.form-group label {
    font-size: 0.9em;
    color: var(--text-muted);
    font-weight: 500;
}
.form-input {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--surface-light);
    background: var(--background);
    color: var(--text);
    font-size: 0.95em;
    transition: border-color 0.2s;
}
.form-input:focus {
    outline: none;
    border-color: var(--primary);
}
.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.form-hint {
    font-size: 0.8em;
    color: var(--text-muted);
}
.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95em !important;
    color: var(--text) !important;
}
.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}
.settings-actions {
    margin-bottom: 18px;
}
.settings-actions .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 1.05em;
}

/* ===========================================
   Model Router (Admin)
   =========================================== */
.model-router-controls {
    margin-bottom: 16px;
}
.router-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.router-filters .form-input {
    padding: 8px 12px;
    font-size: 0.9em;
    min-width: 140px;
}
.router-summary {
    font-size: 0.9em;
    color: var(--text-muted);
    padding: 6px 0;
}
.model-router-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.router-model-card {
    background: var(--surface);
    border-radius: 10px;
    padding: 14px 16px;
    border: 1px solid var(--surface-light);
    transition: all 0.2s;
}
.router-model-card:hover {
    border-color: var(--primary);
}
.router-model-busy {
    opacity: 0.55;
}
.router-model-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.router-model-name {
    font-weight: 600;
    font-size: 0.92em;
    word-break: break-word;
}
.router-model-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}
.router-tag {
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}
.tag-provider { background: rgba(99,91,255,0.2); color: #a5a0ff; }
.tag-params { background: rgba(76,175,80,0.2); color: #81c784; }
.tag-size { background: rgba(255,152,0,0.2); color: #ffb74d; }
.tag-openclaw { background: rgba(233,30,99,0.2); color: #f48fb1; }
.router-model-caps {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}
.router-cap {
    font-size: 0.7em;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(148,197,249,0.15);
    color: var(--secondary);
}
.router-model-details {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
    font-size: 0.82em;
    color: var(--text-muted);
}
.router-model-openclaw {
    border-left: 3px solid #e91e63;
}
.router-openclaw-badge {
    color: #f48fb1;
    font-weight: 600;
}
.router-model-node {
    color: var(--text-muted);
    font-size: 0.8em;
    border-top: 1px solid var(--surface-light);
    padding-top: 6px;
    margin-top: 4px;
}

/* ===========================================
   Models Tab Container
   =========================================== */
.models-container {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 30px;
}
.models-container h3 {
    margin-top: 0;
}

/* ===========================================
   Theme Toggle (Settings)
   =========================================== */
.theme-toggle-group {
    display: flex;
    gap: 8px;
}
.theme-btn {
    padding: 10px 20px;
    border: 2px solid var(--surface-light);
    border-radius: 8px;
    background: var(--surface-light);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.2s;
}
.theme-btn:hover {
    border-color: var(--primary);
    color: var(--text);
}
.theme-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

/* ===========================================
   Light Theme Overrides
   =========================================== */
[data-theme="light"] .header-main h1 {
    background: linear-gradient(135deg, #e55a2b, #2b7de5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="light"] .auth-form input,
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="email"],
[data-theme="light"] textarea,
[data-theme="light"] select {
    background: var(--input-bg);
    color: var(--input-text);
    border: 1px solid var(--card-border);
}

[data-theme="light"] .router-model-card,
[data-theme="light"] .stat-card,
[data-theme="light"] .admin-section,
[data-theme="light"] .wallet-container,
[data-theme="light"] .settings-container,
[data-theme="light"] .models-container,
[data-theme="light"] .modal-content {
    box-shadow: var(--shadow);
    border: 1px solid var(--card-border);
}

[data-theme="light"] .guest-banner {
    background: linear-gradient(135deg, #e55a2b 0%, #f59e0b 100%);
}

[data-theme="light"] .tag-provider { background: rgba(99,91,255,0.12); color: #4a3fd4; }
[data-theme="light"] .tag-params { background: rgba(46,125,50,0.12); color: #2e7d32; }
[data-theme="light"] .tag-size { background: rgba(230,81,0,0.12); color: #e65100; }
[data-theme="light"] .tag-openclaw { background: rgba(233,30,99,0.12); color: #c2185b; }

[data-theme="light"] .router-openclaw-badge { color: #c2185b; }
[data-theme="light"] .router-model-openclaw { border-left-color: #c2185b; }

[data-theme="light"] .router-cap {
    background: rgba(43,125,229,0.1);
}

[data-theme="light"] code,
[data-theme="light"] .credential-value {
    background: var(--input-bg);
    color: var(--text);
}

[data-theme="light"] .stripe-card-element {
    background: #fff;
    border: 1px solid var(--card-border);
}

[data-theme="light"] #network-status {
    border: 1px solid var(--card-border);
}

[data-theme="light"] .header-nav a:hover {
    background: var(--surface-light);
}

[data-theme="light"] .theme-btn.active {
    color: #fff;
}

/* ===========================================
   Withdraw Disabled
   =========================================== */
.btn-disabled {
    opacity: 0.7;
    cursor: pointer;
}
.btn-disabled:hover {
    opacity: 1;
}

.withdraw-disabled-notice {
    text-align: center;
    padding: 10px 0;
}
.withdraw-disabled-icon {
    font-size: 3em;
    margin-bottom: 16px;
}
.withdraw-disabled-notice p {
    margin: 10px 0;
    line-height: 1.6;
}
.withdraw-email-box {
    margin: 20px auto;
    padding: 14px 20px;
    background: var(--surface-light);
    border-radius: 10px;
    display: inline-block;
}
.withdraw-email-link {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}
.withdraw-email-link:hover {
    text-decoration: underline;
}
.withdraw-email-note {
    font-size: 0.85em;
    color: var(--text-muted);
}

/* ===========================================
   Model Router - API Section
   =========================================== */
.router-section {
    margin-bottom: 24px;
}
.router-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.router-section-header h4 {
    margin: 0;
}
.section-subtitle-sm {
    font-size: 0.85em;
    color: var(--text-muted);
    margin: 0 0 12px 0;
}

/* API keys list */
.router-keys-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.router-key-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface-light);
    border-radius: 8px;
    border: 1px solid transparent;
}
.router-key-card:hover {
    border-color: var(--primary);
}
.router-key-inactive {
    opacity: 0.5;
}
.router-key-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.router-key-prefix {
    font-family: monospace;
    font-size: 0.9em;
    color: var(--primary);
    font-weight: 600;
}
.router-key-name {
    font-weight: 500;
}
.tag-model {
    background: rgba(99,91,255,0.2);
    color: #a5a0ff;
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 12px;
}
.tag-nomodel {
    background: rgba(148,197,249,0.1);
    color: var(--text-muted);
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 12px;
}
.router-key-stats {
    display: flex;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.82em;
}
.router-key-actions {
    display: flex;
    gap: 6px;
}

/* OpenClaw config snippet */
.router-config-box {
    background: var(--surface-light);
    border-radius: 10px;
    padding: 16px 20px;
    margin-top: 12px;
}
.router-config-box h5 {
    margin: 0 0 6px 0;
}
.config-hint {
    font-size: 0.85em;
    color: var(--text-muted);
    margin: 0 0 10px 0;
}
.config-pre {
    background: var(--bg);
    border: 1px solid var(--surface-light);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 0.82em;
    overflow-x: auto;
    white-space: pre;
    font-family: 'Fira Code', 'Consolas', monospace;
    color: var(--text);
    margin-bottom: 10px;
    max-height: 400px;
}
.config-note {
    font-size: 0.85em;
    margin: 0 0 10px 0;
    line-height: 1.5;
}
.config-note-ok {
    color: #4caf50;
}
.config-note-warn {
    color: #ff9800;
}
.config-note-warn code {
    background: var(--surface-light);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}
.config-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

/* Config snippet tabs */
.config-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--surface-light);
    padding-bottom: 10px;
}
.config-tab {
    background: var(--surface-light);
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.82em;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s ease;
}
.config-tab:hover {
    background: var(--surface);
    color: var(--text);
}
.config-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.config-tab-content {
    display: none;
}
.config-tab-content.active {
    display: block;
}
.config-hint {
    font-size: 0.85em;
    color: var(--text-muted);
    margin: 0 0 8px 0;
}
.config-hint code {
    background: var(--surface-light);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Selected model highlight */
.router-model-selected {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(99,91,255,0.3);
}
.router-model-selected .router-model-header .router-model-status {
    font-size: 1.1em;
}

/* Guest prompt */
.router-guest-prompt {
    padding: 20px;
    text-align: center;
    background: var(--surface-light);
    border-radius: 10px;
    margin-bottom: 20px;
}

/* How it works */
.router-howto {
    background: var(--surface-light);
    border-radius: 10px;
    padding: 20px 24px;
}
.router-howto h4 {
    margin-top: 0;
}
.router-flow-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 16px 0;
    flex-wrap: wrap;
}
.flow-step {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: 10px;
    padding: 12px 18px;
    text-align: center;
    min-width: 110px;
}
.flow-step-highlight {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.flow-step-highlight small {
    color: rgba(255,255,255,0.8);
}
.flow-arrow {
    font-size: 0.78em;
    color: var(--text-muted);
    padding: 0 6px;
    white-space: nowrap;
}
.router-flow-return {
    text-align: center;
    color: var(--text-muted);
    margin: -4px 0 12px 0;
    font-size: 0.85em;
}
.router-steps {
    margin: 0;
    padding-left: 20px;
}
.router-steps li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* New key dialog */
.key-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-light);
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: 10px;
}
.key-display code {
    flex: 1;
    font-family: monospace;
    font-size: 0.88em;
    word-break: break-all;
}
.text-warning {
    color: #ffb74d;
}
.btn-danger {
    background: rgba(244,67,54,0.15);
    color: #ef5350;
    border: 1px solid rgba(244,67,54,0.3);
}
.btn-danger:hover {
    background: rgba(244,67,54,0.25);
}

/* Light theme overrides for new elements */
[data-theme="light"] .router-key-card {
    background: #f8f9fa;
    border: 1px solid var(--card-border);
}
[data-theme="light"] .router-config-box {
    background: #f8f9fa;
}
[data-theme="light"] .config-pre {
    background: #fff;
    border-color: var(--card-border);
}
[data-theme="light"] .router-guest-prompt {
    background: #f0f4f8;
}
[data-theme="light"] .router-howto {
    background: #f0f4f8;
}
[data-theme="light"] .tag-model {
    background: rgba(99,91,255,0.12);
    color: #4a3fd4;
}
[data-theme="light"] .text-warning {
    color: #e65100;
}
[data-theme="light"] .key-display {
    background: #f0f4f8;
}
[data-theme="light"] .router-model-selected {
    box-shadow: 0 0 0 2px rgba(43,125,229,0.3);
}