/* ══════════════════════════════════════════════════════════
   TokenCommand — CSS
   Layout: portfolio header → horizontal nav → sub-nav + content
   ══════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────── */

:root {
    --bg: #0c0c0c;
    --bg-secondary: #121212;
    --bg-tertiary: #1a1a1a;
    --surface: #1a1a1a;
    --surface-hover: #222222;
    --border: #2c2c2c;
    --border-hover: #383838;
    --text: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --accent: #a0584e;
    --accent-bright: #bb6e62;
    --accent-dim: #874a40;
    --accent-glow: rgba(0, 0, 0, 0.4);
    --accent-glow-subtle: rgba(0, 0, 0, 0.15);
    --success: #4a9e5c;
    --success-dim: #3d8a4e;
    --danger: #c0504a;
    --danger-dim: #a3423d;
    --warning: #d4a04a;
    --warning-dim: #b8893e;
    --purple: #9a7bb5;
    --orange: #d4a04a;
    --surface-inset: #101010;
    --radius: 6px;
    --radius-lg: 12px;
    --transition: 150ms ease;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-accent: 0 4px 20px rgba(0, 0, 0, 0.2);
    --shadow-accent-lg: 0 8px 32px rgba(0, 0, 0, 0.25);
    --header-h: 56px;
    --nav-h: 46px;
    --sub-nav-w: 180px;
}

/* ── Reset ─────────────────────────────────────────────────── */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ── App Layout ────────────────────────────────────────────── */

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ── Portfolio Header (top bar, full width) ────────────────── */

#portfolio-header {
    height: var(--header-h);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.ph-stats {
    display: flex;
    align-items: center;
    gap: 24px;
}

.ph-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 14px;
    transition: all 0.2s ease;
}
.ph-stat:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ph-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.ph-stat-body {
    display: flex;
    flex-direction: column;
}

.ph-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    line-height: 1;
}

.ph-value {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

.ph-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ws-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s ease;
    flex-shrink: 0;
}
.ws-dot.connected {
    background: var(--success);
    box-shadow: 0 0 6px rgba(74, 158, 92, 0.6);
}

.ph-refresh-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}
.ph-refresh-btn:hover { background: var(--accent-dim); }

/* ── Main Nav (horizontal tabs below header) ───────────────── */

#main-nav {
    height: var(--nav-h);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    padding: 0 16px;
    gap: 0;
    flex-shrink: 0;
}

.main-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 18px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.6px;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
    white-space: nowrap;
}

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

.main-tab.active {
    color: var(--accent-bright);
    border-bottom-color: var(--accent);
}

.main-tab-icon {
    font-size: 0.9rem;
}

/* ── Page Body (sub-nav + content) ─────────────────────────── */

#page-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* ── Sub Nav (vertical left sidebar) ───────────────────────── */

#sub-nav {
    width: var(--sub-nav-w);
    min-width: var(--sub-nav-w);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

#sub-nav.hidden {
    display: none;
}

.sub-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 18px;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

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

.sub-tab.active {
    color: var(--text);
    background: rgba(160, 88, 78, 0.08);
    border-left-color: var(--accent);
}

.sub-tab-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

/* ── Content Area ──────────────────────────────────────────── */

#content {
    flex: 1;
    padding: 24px 28px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}

/* ── Page Headers ──────────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 2px;
}

/* ── Cards ─────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

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

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

/* ── Stat Row / Stat Cards ─────────────────────────────────── */

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    transition: all 0.2s ease;
}
.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.stat-card .label,
.stat-card .stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-card .value,
.stat-card .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.stat-card .stat-icon {
    font-size: 1.1rem;
    margin-bottom: 6px;
}

.stat-card .stat-body {
    display: flex;
    flex-direction: column;
}

/* ── Buttons ───────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); }

.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-dim); border-color: var(--success-dim); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dim); border-color: var(--danger-dim); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); }

.btn-sm { padding: 5px 10px; font-size: 0.76rem; }
.btn-group { display: flex; gap: 8px; }

.btn-buy { background: var(--success); border-color: var(--success); color: #fff; font-weight: 700; }
.btn-buy:hover { background: var(--success-dim); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); }
.btn-sell { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 700; }
.btn-sell:hover { background: var(--danger-dim); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); }

/* ── Forms ─────────────────────────────────────────────────── */

.form-group { margin-bottom: 12px; }
.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color var(--transition);
}

input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.15); }
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 0.6; }

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

textarea { resize: vertical; min-height: 80px; }

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

input:disabled, select:disabled, textarea:disabled {
    opacity: 0.5; cursor: not-allowed; background: var(--surface);
}

/* ── Tables ────────────────────────────────────────────────── */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead { background: var(--surface); }
th {
    text-align: left;
    padding: 8px 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: var(--surface-hover); }
tbody tr:last-child td { border-bottom: none; }

.table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface);
}

/* ── Badges ────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success { background: rgba(74, 158, 92, 0.15); color: var(--success); }
.badge-danger  { background: rgba(192, 80, 74, 0.15); color: var(--danger); }
.badge-warning { background: rgba(234, 179, 8, 0.15); color: var(--warning); }
.badge-accent  { background: rgba(160, 88, 78, 0.15); color: var(--accent); }
.badge-muted   { background: rgba(136, 136, 136, 0.15); color: var(--text-muted); }

/* ── Toggle switch ─────────────────────────────────────────── */

.toggle { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
    position: absolute; inset: 0;
    background: var(--border); border-radius: 20px; cursor: pointer;
    transition: background var(--transition);
}
.toggle .slider::before {
    content: ""; position: absolute;
    width: 14px; height: 14px; left: 3px; bottom: 3px;
    background: var(--text); border-radius: 50%;
    transition: transform var(--transition);
}
.toggle input:checked + .slider { background: var(--accent); }
.toggle input:checked + .slider::before { transform: translateX(16px); }

/* ── Address / mono ────────────────────────────────────────── */

.mono { font-family: 'SF Mono', 'Consolas', 'Courier New', monospace; font-size: 0.8rem; }
.address { font-family: 'SF Mono', 'Consolas', 'Courier New', monospace; font-size: 0.78rem; color: var(--text-muted); }

/* ── Card Grid (dashboard token cards) ─────────────────────── */

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

.token-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    transition: all 0.2s ease;
}
.token-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-accent);
}

/* ── Empty state ───────────────────────────────────────────── */

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 0.85rem; margin-bottom: 16px; }

/* ── Loading spinner ───────────────────────────────────────── */

.loading { display: flex; align-items: center; justify-content: center; padding: 3rem; color: var(--text-muted); gap: 8px; }
.spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast notifications ───────────────────────────────────── */

.toast-container {
    position: fixed; top: 1rem; right: 1rem; z-index: 1000;
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px 14px; font-size: 0.85rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    pointer-events: auto; animation: toast-in 200ms ease; max-width: 360px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info    { border-left: 3px solid var(--accent); }
.toast-exit { animation: toast-out 200ms ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateX(20px); } }

/* ── Utility ───────────────────────────────────────────────── */

.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent  { color: var(--accent); }
.text-muted   { color: var(--text-muted); }
.hidden { display: none !important; }
.flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ── Scrollbar ─────────────────────────────────────────────── */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-bright); }

/* ── Focus ring ────────────────────────────────────────────── */

.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.main-tab:focus-visible, .sub-tab:focus-visible, .token-tab:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

/* Volume bot toggle focus */
.btn-volume-toggle:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 768px) {
    #sub-nav { width: 100%; min-width: 100%; border-right: none; border-bottom: 1px solid var(--border); flex-direction: row; padding: 6px; gap: 4px; overflow-x: auto; }
    .sub-tab { padding: 8px 12px; border-left: none; border-bottom: 2px solid transparent; white-space: nowrap; }
    .sub-tab.active { border-left-color: transparent; border-bottom-color: var(--accent); }
    #page-body { flex-direction: column; }
    #content { padding: 16px; }
    .ph-stats { gap: 10px; overflow-x: auto; }
    .form-row { grid-template-columns: 1fr; }
    .stat-row { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════════════════════════
   Wallet Pool Manager (Dashboard > Wallets)
   ══════════════════════════════════════════════════════════ */

.wpm {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-accent-lg);
}

/* ── Header ────────────────────────────────────────────────── */

.wpm-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(160,88,78,0.18) 0%, rgba(160,88,78,0.04) 100%);
    border-bottom: 2px solid var(--accent);
}
.wpm-title { display: flex; align-items: center; gap: 12px; }
.wpm-title-icon { font-size: 1.8rem; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4)); }
.wpm-title h2 { font-size: 1.15rem; font-weight: 800; letter-spacing: 1px; color: var(--accent-bright); }

/* ── Stats Chips ───────────────────────────────────────────── */

.wpm-stats {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 20px; border-bottom: 1px solid var(--border);
    overflow-x: auto;
    background: var(--surface-inset);
}
.wpm-stat-chip {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface-inset); border: 1px solid var(--border);
    border-radius: 20px; padding: 6px 14px;
    font-size: 0.78rem; font-weight: 600;
    cursor: pointer; white-space: nowrap;
    transition: all 0.2s ease;
    color: var(--text);
}
.wpm-stat-chip:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.wpm-stat-chip.active { border-color: var(--accent); background: rgba(160,88,78,0.12); box-shadow: 0 0 10px rgba(0,0,0,0.25); }
.wpm-stat-chip:disabled { opacity: 0.4; cursor: default; }
.wpm-stat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.wpm-stat-label { color: var(--text-muted); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.5px; }
.wpm-stat-val { font-weight: 700; font-size: 0.85rem; }
.wpm-stat-balance { cursor: default; }

/* ── 2-col Grid ────────────────────────────────────────────── */

.wpm-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 500px;
}
.wpm-left {
    border-right: 2px solid var(--border);
    display: flex; flex-direction: column;
    overflow-y: auto;
    background: var(--bg);
    padding: 8px;
    gap: 8px;
}
.wpm-right {
    display: flex; flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
    background: var(--bg);
    padding: 8px;
    gap: 8px;
}

/* ── Panel Sections ────────────────────────────────────────── */

.wpm-panel {
    padding: 16px 18px;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.wpm-panel h3 {
    font-size: 0.85rem; font-weight: 700;
    margin-bottom: 12px; display: flex; align-items: center; gap: 6px;
    color: var(--text);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ── Pool List ─────────────────────────────────────────────── */

.wpm-pool-list { max-height: 200px; overflow-y: auto; margin-bottom: 10px; }
.wpm-pool-card {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 8px 10px;
    margin-bottom: 6px; cursor: pointer; font-size: 0.8rem;
    transition: all 0.2s ease;
}
.wpm-pool-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.wpm-pool-card.selected { border-color: var(--accent); box-shadow: 0 0 12px rgba(0,0,0,0.35); }
.wpm-pool-actions { display: flex; flex-direction: column; gap: 6px; }
.wpm-pool-btn { width: 100%; justify-content: center; }

/* ── Pool Operations Grid ──────────────────────────────────── */

.wpm-ops-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 6px; margin-bottom: 8px;
}
.wpm-op-btn {
    display: flex; flex-direction: column; align-items: center;
    gap: 2px; padding: 12px 4px;
    border: none; border-radius: 10px;
    color: #fff; font-size: 0.72rem; font-weight: 700;
    cursor: pointer; transition: all 0.2s ease;
}
.wpm-op-icon { font-size: 1.2rem; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.wpm-op-btn:hover { filter: brightness(1.15); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
.wpm-op-btn:active { transform: translateY(0) scale(0.98); }

/* Permanently colored backgrounds matching old UI */
.wpm-op-blue { background: var(--accent); }
.wpm-op-red  { background: var(--accent); }
.wpm-op-danger { background: var(--accent); }
.wpm-op-muted { background: var(--accent); }
.wpm-op-muted:hover { filter: brightness(1.15); }

.wpm-full-btn { width: 100%; justify-content: center; margin-top: 4px; }

/* ── Address Book ─────────────────────────────────────────── */

.wpm-addr-list { max-height: 150px; overflow-y: auto; margin-bottom: 8px; }
.wpm-addr-item {
    display: flex; flex-direction: column; gap: 2px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 6px 8px;
    margin-bottom: 4px; cursor: pointer;
    transition: all 0.2s ease;
}
.wpm-addr-item:hover { border-color: var(--accent); transform: translateX(2px); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.wpm-addr-name { font-size: 0.78rem; font-weight: 600; color: var(--text); }
.wpm-addr-value { font-size: 0.7rem; color: var(--text-muted); word-break: break-all; }

/* ── Wallet Tags ──────────────────────────────────────────── */

.wpm-tag-list {
    display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px;
}
.wpm-tag-chip {
    display: inline-block; padding: 4px 12px;
    font-size: 0.72rem; font-weight: 700;
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--bg); color: var(--text);
    cursor: pointer; transition: all 0.2s ease;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.wpm-tag-chip:hover { background: rgba(160,88,78,0.1); transform: translateY(-1px); }
.wpm-tag-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.3); }

/* ── Trade Controls (full form) ───────────────────────────── */

.wpm-trade-panel h3 { margin-bottom: 12px; }
.wpm-form-group { margin-bottom: 10px; }
.wpm-form-label {
    display: block; font-size: 0.72rem; font-weight: 600;
    color: var(--text-muted); margin-bottom: 3px;
}
.wpm-select {
    width: 100%; padding: 6px 8px; font-size: 0.82rem;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center; padding-right: 28px;
}
.wpm-select:focus { border-color: var(--accent); outline: none; }

.wpm-input-row {
    display: flex; align-items: center; gap: 0;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg); overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.wpm-input-row:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.15);
}
.wpm-input-prefix, .wpm-input-suffix {
    padding: 0 8px; font-size: 0.82rem; font-weight: 600;
    color: var(--text-muted); white-space: nowrap; flex-shrink: 0;
}
.wpm-trade-input {
    flex: 1; border: none; background: none; color: var(--text);
    padding: 6px 8px; font-size: 0.82rem; outline: none;
    width: auto; min-width: 0;
}
.wpm-input-adj {
    display: flex; flex-direction: column; border-left: 1px solid var(--border);
}
.wpm-adj-btn {
    padding: 0 8px; background: var(--surface); color: var(--text-muted);
    border: none; cursor: pointer; font-size: 0.72rem; line-height: 1.4;
    transition: background var(--transition);
}
.wpm-adj-btn:hover { background: var(--surface-hover); color: var(--text); }
.wpm-adj-btn:first-child { border-bottom: 1px solid var(--border); }

/* ── Trade Queue ──────────────────────────────────────────── */

.wpm-queue-panel { border: 1px solid var(--border); border-radius: 8px; margin: 8px 0; }
.wpm-queue-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 6px;
}
.wpm-queue-list { max-height: 200px; overflow-y: auto; }
.wpm-queue-item {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 8px; margin-bottom: 4px;
}
.wpm-queue-item-head {
    display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.wpm-queue-num { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); }
.wpm-queue-dir { font-size: 0.78rem; font-weight: 700; flex: 1; }
.wpm-queue-remove { padding: 2px 6px; font-size: 0.68rem; }
.wpm-queue-details { font-size: 0.72rem; color: var(--text-secondary); line-height: 1.6; }

/* ── Select an Operation Panel ─────────────────────────────── */

.wpm-op-panel { min-height: 120px; }
.wpm-op-content { min-height: 80px; }
.wpm-op-placeholder {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 8px;
    color: var(--text-muted); padding: 24px; min-height: 100px;
    border: 1px dashed var(--border); border-radius: var(--radius);
    margin: 4px 0;
}
.wpm-op-placeholder p { font-size: 0.82rem; }
.wpm-op-active h4 { font-size: 0.92rem; font-weight: 700; margin-bottom: 4px; color: var(--accent-bright); }

/* ── Wallet Inventory ──────────────────────────────────────── */

.wpm-inventory-panel { flex: 1; display: flex; flex-direction: column; }
.wpm-inv-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px; flex-wrap: wrap; gap: 8px;
}
.wpm-inv-actions { display: flex; align-items: center; gap: 6px; }
.wpm-search-box {
    display: flex; align-items: center; gap: 4px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 3px 8px;
}
.wpm-search-box span { font-size: 0.8rem; }
.wpm-search-box input {
    border: none; background: none; color: var(--text);
    font-size: 0.8rem; width: 120px; outline: none;
}
.wpm-table-wrap {
    flex: 1; overflow: auto; max-height: 500px;
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}
.wpm-table-wrap table { font-size: 0.8rem; }
.wpm-table-wrap th {
    position: sticky; top: 0; z-index: 2; background: var(--surface);
    border-bottom: 2px solid var(--border);
}
.wpm-sortable { cursor: pointer; user-select: none; transition: color var(--transition); }
.wpm-sortable:hover { color: var(--accent-bright); }
.wpm-sort-icon { font-size: 0.65rem; color: var(--text-muted); margin-left: 2px; }
.wpm-sortable.wpm-sort-active .wpm-sort-icon { color: var(--accent-bright); }

/* ── Activity Log ──────────────────────────────────────────── */

.wpm-activity-log {
    max-height: 150px; overflow-y: auto;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.72rem; line-height: 1.6;
    background: var(--surface-inset); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 8px;
}
.wpm-log-entry { padding: 2px 4px; border-left: 2px solid transparent; }
.wpm-log-ts { color: var(--text-muted); margin-right: 6px; }
.wpm-log-info { border-left-color: var(--accent); color: var(--text-secondary); }
.wpm-log-success { border-left-color: var(--success); color: var(--success); }
.wpm-log-warning { border-left-color: var(--warning); color: var(--warning); }
.wpm-log-error { border-left-color: var(--danger); color: var(--danger); }

/* ── WPM Responsive ────────────────────────────────────────── */

@media (max-width: 900px) {
    .wpm-grid { grid-template-columns: 1fr; }
    .wpm-left { border-right: none; border-bottom: 1px solid var(--border); }
}

/* ── Chart wrap (used by system token views) ──────────────── */
.ct-chart-wrap {
    min-height: 500px; border: 1px solid var(--border);
    border-radius: 10px; overflow: hidden; flex: 1;
}

/* ════════════════════════════════════════════════════════════
   TOKEN MANAGER — Page Layout (sidebar + content)
   ════════════════════════════════════════════════════════════ */

.tm-layout {
    display: flex; height: 100%; min-height: 0;
    margin: -24px -28px; /* offset #content padding to go edge-to-edge */
}

.tm-sidebar {
    width: 200px; min-width: 200px; flex-shrink: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 12px 0; overflow-y: auto;
    display: flex; flex-direction: column;
}

.tm-section-label {
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
    color: var(--text-muted); padding: 8px 16px 4px;
}

.tm-separator {
    height: 1px; background: var(--border); margin: 8px 12px;
}

.tm-new-token-btn {
    display: block; width: calc(100% - 24px); margin: 4px 12px 8px;
    padding: 8px 12px; border: 1px dashed var(--border);
    border-radius: 6px; background: none; color: var(--text-muted);
    font-size: 0.8rem; cursor: pointer; text-align: center;
    transition: background var(--transition), color var(--transition);
}
.tm-new-token-btn:hover { background: var(--surface-hover); color: var(--text); }

.token-tab {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 10px 16px;
    background: none; border: none; border-left: 3px solid transparent;
    color: var(--text-secondary); font-size: 0.85rem; font-weight: 500;
    cursor: pointer; text-align: left;
    transition: background var(--transition), color var(--transition);
}
.token-tab:hover { background: var(--surface-hover); color: var(--text); }
.token-tab.active {
    color: var(--text); background: rgba(160, 88, 78, 0.08);
    border-left-color: var(--accent);
}
.tab-icon { font-size: 0.9rem; flex-shrink: 0; width: 18px; text-align: center; }
.tab-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.token-tab.dragging { opacity: 0.4; }
.token-tab.drag-over { border-top: 2px solid var(--accent); }

.tm-layout > .tm-content {
    flex: 1; padding: 24px 28px; overflow-y: auto; min-width: 0;
}

/* ── Token Module (component-based layout from token-module.js) ── */

.token-header-box {
    background: linear-gradient(135deg, var(--surface) 0%, rgba(160,88,78,0.08) 100%);
    border: 1px solid var(--border); border-radius: 10px;
    padding: 20px; margin-bottom: 16px;
    display: flex; align-items: center; gap: 14px;
}
.token-image {
    width: 60px; height: 60px; border-radius: 12px;
    border: 1px solid var(--border); object-fit: cover;
}
.token-image-fallback {
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; font-weight: 700;
    background: var(--bg); color: var(--accent);
}
.token-info { flex: 1; min-width: 0; }
.token-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

.th-title { font-size: 1.2rem; margin: 0 0 4px; }
.th-badges { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.th-platform { font-size: 0.75rem; color: var(--text-muted); }
.th-contract { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 2px; }
.th-pool { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 2px; }
.th-socials { display: flex; gap: 10px; margin-top: 4px; }
.th-social-link {
    font-size: 0.75rem; color: var(--accent); text-decoration: none;
    transition: color var(--transition);
}
.th-social-link:hover { color: var(--accent-bright); text-decoration: underline; }
.th-edit-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px;
}

.ui-badge {
    display: inline-block; padding: 2px 8px; font-size: 0.68rem;
    font-weight: 600; border-radius: 999px; letter-spacing: 0.3px;
}

.token-module-grid {
    display: grid; grid-template-columns: 420px 1fr; gap: 16px; margin-bottom: 16px;
}
.token-module-left { display: flex; flex-direction: column; }
.token-module-right { display: flex; flex-direction: column; }

/* Swap controls (compact row: $ [input] [+] [-] [BUY] [SELL]) */
.control-section {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.control-section h3 {
    font-size: 0.95rem; font-weight: 700; margin-bottom: 12px;
    padding-bottom: 8px; border-bottom: 1px solid var(--border);
}

.swap-row {
    display: flex; align-items: center; gap: 6px;
}
.swap-prefix {
    font-size: 0.9rem; font-weight: 600; color: var(--text-muted); flex-shrink: 0;
}
.swap-amount {
    width: 100px; padding: 6px 8px; font-size: 0.9rem;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
}

.btn-adj {
    padding: 6px 10px; background: var(--surface); color: var(--text-muted);
    border: 1px solid var(--border); border-radius: var(--radius);
    cursor: pointer; font-size: 0.85rem; font-weight: 600;
    transition: background var(--transition), color var(--transition);
}
.btn-adj:hover { background: var(--surface-hover); color: var(--text); }

.tc-wallet-row {
    display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.tc-wallet-label {
    font-size: 0.78rem; font-weight: 600; color: var(--text-muted); flex-shrink: 0;
}
.tc-wallet-select {
    flex: 1; padding: 5px 8px; font-size: 0.8rem;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    min-width: 0;
}
.tc-status { font-size: 0.78rem; margin-top: 8px; min-height: 1.2em; }

/* Copyable address */
.copyable-addr {
    cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.copyable-addr:hover { color: var(--accent-bright); }
.copy-icon { font-size: 0.75rem; }

/* ── Amount Control (from helpers.js amountControl()) ──── */

.amount-control {
    display: flex; align-items: center; gap: 0;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg); overflow: hidden; margin-bottom: 6px;
}
.amount-control .amount-label {
    padding: 0 10px; font-size: 0.82rem; font-weight: 600;
    color: var(--text-muted); white-space: nowrap; flex-shrink: 0;
    min-width: 36px;
}
.amount-control .amount-prefix,
.amount-control .amount-suffix {
    padding: 0 6px; font-size: 0.82rem; color: var(--text-muted); flex-shrink: 0;
}
.amount-control input[type="number"] {
    flex: 1; border: none; background: none; color: var(--text);
    padding: 8px 6px; font-size: 0.85rem; outline: none; min-width: 0;
}
.amount-control .btn-adj-minus,
.amount-control .btn-adj-plus {
    padding: 8px 10px; background: var(--surface); color: var(--text-muted);
    border: none; border-left: 1px solid var(--border);
    cursor: pointer; font-size: 0.82rem; font-weight: 600;
    transition: background var(--transition);
}
.amount-control .btn-adj-minus:hover,
.amount-control .btn-adj-plus:hover { background: var(--surface-hover); color: var(--text); }

/* ── Volume Bot Component ──────────────────────────────── */

.vb-estimate-row {
    text-align: right; margin: 4px 0 10px;
}
.vb-estimate { font-size: 0.75rem; color: var(--text-muted); }
.vb-mode-panel { margin-bottom: 8px; }
.vb-mode-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; display: block; }
.vb-cap-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}

.btn-volume-toggle {
    display: block; width: 100%; padding: 10px; border: none;
    border-radius: var(--radius); font-size: 0.85rem; font-weight: 700;
    cursor: pointer; text-align: center; transition: all var(--transition);
}
.btn-volume-toggle.start { background: var(--accent); color: #fff; }
.btn-volume-toggle.start:hover { background: var(--accent-dim); }
.btn-volume-toggle.stop { background: var(--danger); color: #fff; }
.btn-volume-toggle.stop:hover { background: var(--danger-dim); }
.btn-volume-toggle:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Chart + Stream Component ──────────────────────────── */

.chart-container {
    border: 1px solid var(--border); border-radius: 10px;
    overflow: hidden; min-height: 400px; margin-bottom: 12px;
}
.chart-container iframe {
    width: 100%; height: 400px; border: none;
}
.chart-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 400px; color: var(--text-muted);
    background: var(--surface);
}
.chart-placeholder-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.5; }
.chart-placeholder-text { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.chart-placeholder-hint { font-size: 0.78rem; opacity: 0.7; }

.stream-panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 14px; margin-bottom: 12px;
}
.stream-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.stream-header h4 { font-size: 0.88rem; font-weight: 700; margin: 0; }
.stream-controls { display: flex; align-items: center; gap: 8px; }
.stream-status-label { font-size: 0.72rem; font-weight: 600; }

.status-indicator {
    display: inline-flex; align-items: center; gap: 4px;
}
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
}

.stream-body {
    max-height: 180px; overflow-y: auto;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 8px;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.72rem; line-height: 1.5;
}
.stream-entry { padding: 1px 0; }
.stream-entry.info { color: var(--text-secondary); }
.stream-entry.success { color: var(--success); }
.stream-entry.error { color: var(--danger); }
.stream-entry.warning { color: var(--warning); }
.stream-entry.external { color: #bb6e62; }

/* ── Bot Status Component ──────────────────────────────── */

.bot-status-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px;
}
.bot-status-panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 16px;
}
.bsp-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.bsp-header h4 { font-size: 0.85rem; margin: 0; }

.bsp-stats { display: flex; gap: 8px; margin-bottom: 8px; }
.bsp-stat {
    flex: 1; text-align: center; padding: 8px 6px;
    border-radius: var(--radius); border: 1px solid var(--border);
}
.bsp-stat-value { display: block; font-weight: 700; font-size: 0.82rem; }
.bsp-stat-label { display: block; font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; }

.bsp-stat--green { background: rgba(74, 158, 92, 0.08); }
.bsp-stat--blue  { background: rgba(160, 88, 78, 0.08); }
.bsp-stat--purple { background: rgba(168, 85, 247, 0.08); }
.bsp-stat--orange { background: rgba(245, 158, 11, 0.08); }

.bot-mini-log {
    max-height: 75px; overflow-y: auto; font-family: monospace;
    font-size: 0.7rem; line-height: 1.4; color: var(--text-muted);
    background: var(--bg); border-radius: var(--radius); padding: 6px 8px;
}

/* ── If-Then Rules Component ───────────────────────────── */

.itr-condition-row,
.itr-action-row,
.itr-trade-fields,
.itr-vol-fields {
    display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
}
.itr-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.itr-select {
    padding: 5px 8px; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 0.78rem;
}
.itr-select-wide { flex: 1; }
.itr-input,
.itr-input-sm {
    flex: 1; padding: 5px 8px; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 0.78rem; min-width: 0;
}
.itr-add-btn { width: 100%; margin-top: 4px; margin-bottom: 12px; }

.itr-list { min-height: 60px; max-height: 240px; overflow-y: auto; }
.itr-empty { text-align: center; padding: 12px; font-size: 0.8rem; color: var(--text-muted); }

.ifthen-rule {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 10px; border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 4px;
    background: var(--bg); font-size: 0.78rem;
    transition: opacity var(--transition);
}
.ifthen-rule-disabled { opacity: 0.45; }
.itr-rule-info { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-width: 0; }
.rule-condition { color: var(--warning); font-weight: 600; }
.rule-arrow { color: var(--text-muted); margin: 0 2px; }
.rule-action { color: var(--success); }
.itr-oneshot {
    font-size: 0.65rem; background: rgba(245,158,11,0.15);
    color: var(--warning); padding: 1px 6px; border-radius: 3px; margin-left: 4px;
}
.itr-triggered {
    font-size: 0.65rem; background: rgba(239,68,68,0.15);
    color: var(--danger); padding: 1px 6px; border-radius: 3px; margin-left: 4px;
}
.itr-rule-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Countertrade Component ────────────────────────────── */

.ct-automation { margin-bottom: 16px; }
.ct-automation > .ct-header {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 16px 20px; margin-bottom: 0;
}
.ct-automation > .ct-grid {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-top: none; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.ct-column {
    padding: 16px; border-right: 1px solid var(--border);
}
.ct-column:last-child { border-right: none; }

.ct-col-header {
    display: flex; align-items: center; gap: 6px; margin-bottom: 10px;
}
.ct-col-label { font-weight: 700; font-size: 0.82rem; }
.ct-tooltip {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%; font-size: 0.65rem; font-weight: 700;
    background: var(--bg-tertiary); color: var(--text-muted); border: 1px solid var(--border);
    cursor: help; margin-left: auto; flex-shrink: 0;
}

/* ── Help Icon & Popup ─────────────────────────────────── */
.help-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%;
    font-size: 0.75rem; font-weight: 700; line-height: 1;
    background: var(--accent, #a0584e); color: #fff;
    cursor: pointer; margin-left: 6px; flex-shrink: 0;
    transition: background .15s, transform .15s;
    user-select: none; vertical-align: middle;
}
.help-icon:hover {
    background: #874a40; transform: scale(1.12);
}

.help-popup-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,.55);
    display: flex; align-items: center; justify-content: center;
    animation: helpFadeIn .15s ease;
}
@keyframes helpFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.help-popup {
    background: var(--bg-secondary, #1e1e2e); color: var(--text, #e0e0e0);
    border: 1px solid var(--border, #333); border-radius: 10px;
    padding: 24px 28px 20px; max-width: 520px; width: 92vw;
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
    position: relative;
    animation: helpSlideUp .2s ease;
}
@keyframes helpSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.help-popup h3 {
    margin: 0 0 12px; font-size: 1.1rem; font-weight: 700;
}
.help-popup-body {
    font-size: 0.88rem; line-height: 1.6;
}
.help-popup-body ul {
    margin: 8px 0; padding-left: 20px;
}
.help-popup-body li {
    margin-bottom: 4px;
}
.help-popup-body .help-warning {
    color: var(--warning, #d4a04a); font-weight: 600;
}
.help-popup-close {
    position: absolute; top: 10px; right: 14px;
    background: none; border: none; color: var(--text-muted, #888);
    font-size: 1.4rem; cursor: pointer; line-height: 1; padding: 4px;
}
.help-popup-close:hover {
    color: var(--text, #fff);
}
.ct-col-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.ct-col-fields-single { grid-template-columns: 1fr; }
.ct-col-table-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }

.ct-table-wrap {
    max-height: 160px; overflow-y: auto;
    border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px;
}
.ct-table-wrap table { font-size: 0.78rem; }
.ct-table-wrap th { font-size: 0.68rem; padding: 4px 8px; }
.ct-table-wrap td { padding: 4px 8px; }
.ct-table-wrap input {
    width: 100%; padding: 3px 6px; font-size: 0.75rem;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 3px;
}

.ct-col-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ── Token Footer (Abort + Delete) ─────────────────────── */

.tm-footer-btns {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    margin-top: 20px; padding: 16px 0;
}
.tm-abort-btn {
    padding: 14px 20px; font-size: 0.9rem; font-weight: 700;
    background: transparent; color: var(--danger);
    border: 2px solid var(--danger); border-radius: var(--radius-lg);
    cursor: pointer; text-align: center;
    transition: all var(--transition);
}
.tm-abort-btn:hover { background: var(--danger); color: #fff; }
.tm-delete-btn {
    padding: 14px 20px; font-size: 0.9rem; font-weight: 700;
    background: transparent; color: var(--danger);
    border: 2px solid var(--danger); border-radius: var(--radius-lg);
    cursor: pointer; text-align: center;
    transition: all var(--transition);
}
.tm-delete-btn:hover { background: var(--danger); color: #fff; }

/* Token module grid: collapse at narrower widths */
@media (max-width: 1100px) {
    .token-module-grid { grid-template-columns: 1fr; }
}

/* Countertrade 3-col → stack on narrow */
@media (max-width: 1000px) {
    .ct-automation > .ct-grid { grid-template-columns: 1fr; }
    .ct-column { border-right: none; border-bottom: 1px solid var(--border); }
    .ct-column:last-child { border-bottom: none; }
}

/* Bot status: stack on narrow */
@media (max-width: 800px) {
    .bot-status-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .tm-layout { flex-direction: column; }
    .tm-sidebar { width: 100%; min-width: 100%; border-right: none; border-bottom: 1px solid var(--border); flex-direction: row; overflow-x: auto; padding: 6px; gap: 4px; }
    .tm-section-label { display: none; }
    .tm-separator { display: none; }
    .token-tab { padding: 8px 12px; border-left: none; white-space: nowrap; }
    .th-edit-grid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════
   DATA ANALYTICS PAGE
   ════════════════════════════════════════════════════════════ */

.da-page { max-width: 1400px; }
.da-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.da-header h2 {
    font-size: 1.3rem; font-weight: 700; letter-spacing: 2px; color: var(--text);
}
.da-filters {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.da-time-btns { display: flex; gap: 6px; }
.da-date-label { font-size: 0.82rem; color: var(--text-muted); }
.da-token-filter {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap; margin-bottom: 20px;
}
.da-token-label { font-size: 0.82rem; color: var(--text-muted); }
.da-filter-btn {
    padding: 6px 14px; font-size: 0.78rem; font-weight: 600;
    border: 1px solid var(--border); border-radius: 6px;
    background: rgba(56,56,56,0.5); color: var(--text-muted);
    cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.da-filter-btn:hover { border-color: var(--accent); color: var(--text); }
.da-filter-btn.active {
    background: rgba(160,88,78,0.2); border-color: var(--accent); color: var(--accent);
}
.da-loading { text-align: center; padding: 2rem; color: var(--text-muted); }
.da-profit-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px;
}
.da-profit-card {
    background: rgba(15,15,35,0.8); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
}
.da-profit-card h4 {
    font-size: 0.82rem; font-weight: 700; letter-spacing: 1px;
    color: var(--text); margin-bottom: 12px;
}
.da-profit-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px;
}
.da-profit-stat { text-align: center; padding: 16px; background: rgba(0,0,0,0.3); border-radius: 8px; }
.da-stat-label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; }
.da-stat-value { font-size: 1.3rem; font-weight: 700; }
.da-stat-value-lg { display: block; font-size: 1.8rem; font-weight: 700; }
.da-stat-sublabel { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.da-profit-highlight {
    text-align: center; padding: 14px;
    background: rgba(0,212,255,0.1); border: 1px solid rgba(0,212,255,0.3); border-radius: 8px;
}
.da-ct-card { display: flex; flex-direction: column; }
.da-ct-highlight {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 14px;
    background: rgba(255,153,102,0.1); border: 1px solid rgba(255,153,102,0.3); border-radius: 8px;
}
.da-gas-card {
    background: rgba(15,15,35,0.8); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px; margin-bottom: 24px;
}
.da-gas-card h4 {
    font-size: 0.82rem; font-weight: 700; letter-spacing: 1px;
    color: var(--text); margin-bottom: 12px;
}
.da-gas-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.da-gas-stat { text-align: center; padding: 14px; background: rgba(0,0,0,0.3); border-radius: 8px; }
.da-gas-stat .da-stat-label { font-size: 0.78rem; margin-bottom: 6px; }
.da-gas-stat .da-stat-value { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.da-charts-grid {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 24px;
}
.da-chart-card {
    background: rgba(15,15,35,0.8); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 16px;
}
.da-chart-card h4 {
    font-size: 0.78rem; font-weight: 700; letter-spacing: 1px;
    color: var(--text); margin-bottom: 8px;
}
.da-chart-wrap { position: relative; height: 200px; }
.da-chart-wrap canvas { width: 100%; height: 100%; }
.da-chart-empty {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 0.82rem;
}
.da-trades-card {
    background: rgba(15,15,35,0.8); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
}
.da-trades-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
.da-trades-header h4 {
    font-size: 0.88rem; font-weight: 700; letter-spacing: 1px; color: var(--text);
}
@media (max-width: 900px) {
    .da-profit-grid { grid-template-columns: 1fr; }
    .da-gas-stats { grid-template-columns: 1fr 1fr; }
    .da-charts-grid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════
   SETTINGS PAGE
   ════════════════════════════════════════════════════════════ */

.settings-page { max-width: 900px; }
.settings-page h1 {
    font-size: 1.5rem; margin-bottom: 6px;
    display: flex; align-items: center; gap: 10px;
}
.settings-page .settings-subtitle {
    font-size: 0.82rem; color: var(--text-muted); margin-bottom: 24px;
}
.settings-section {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px;
}
.settings-section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.settings-section h2 {
    font-size: 1rem; font-weight: 600;
    display: flex; align-items: center; gap: 10px; margin: 0;
}
.settings-section p.desc {
    font-size: 0.78rem; color: var(--text-muted); margin: 0 0 16px;
}
.settings-section h3 {
    font-size: 0.82rem; font-weight: 700; letter-spacing: 0.5px;
    color: var(--text-secondary); margin: 0 0 12px;
    display: flex; align-items: center; gap: 8px;
}
.settings-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px; margin-bottom: 8px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.settings-row-info { flex: 1; min-width: 0; }
.settings-row-label { font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.settings-row-desc { font-size: 0.75rem; color: var(--text-muted); }
.settings-toggle {
    position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0;
}
.settings-toggle input { opacity: 0; width: 0; height: 0; }
.settings-toggle .slider {
    position: absolute; inset: 0; background: var(--border); border-radius: 26px;
    cursor: pointer; transition: background 0.3s;
}
.settings-toggle .slider::before {
    content: ""; position: absolute;
    width: 20px; height: 20px; left: 3px; bottom: 3px;
    background: var(--text-muted); border-radius: 50%;
    transition: transform 0.3s, background 0.3s;
}
.settings-toggle input:checked + .slider { background: var(--accent); }
.settings-toggle input:checked + .slider::before { transform: translateX(22px); background: #fff; }
.settings-rpc-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.settings-rpc-ordinal {
    font-size: 0.75rem; color: var(--text-muted); min-width: 24px;
    text-align: right; flex-shrink: 0;
}
.settings-rpc-input {
    flex: 1; padding: 10px 12px; font-size: 0.82rem; font-family: monospace;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 6px;
}
.settings-rpc-status { font-size: 1rem; min-width: 20px; text-align: center; }
.settings-rpc-remove {
    padding: 4px 8px; font-size: 0.75rem;
    background: none; border: 1px solid var(--border); border-radius: 4px;
    color: var(--text-muted); cursor: pointer;
}
.settings-rpc-remove:hover { color: var(--danger); border-color: var(--danger); }
.settings-rpc-group { margin-bottom: 16px; }
.settings-rpc-label {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.settings-rpc-label label {
    font-size: 0.82rem; font-weight: 600; color: var(--text-secondary);
    display: flex; align-items: center; gap: 6px;
}
.settings-rpc-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.settings-input-sm {
    width: 70px; padding: 6px 8px; text-align: center;
    font-size: 0.85rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: 6px; color: var(--text);
}
.settings-select {
    padding: 6px 12px; font-size: 0.85rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text); cursor: pointer;
    flex-shrink: 0; width: auto; min-width: 140px;
}
.settings-sheets-input {
    width: 100%; padding: 10px 14px; font-size: 0.82rem; font-family: monospace;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; box-sizing: border-box;
}
.settings-sheets-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.settings-sheets-footer {
    display: flex; align-items: center; justify-content: space-between; margin-top: 12px;
}
.settings-sheets-status { font-size: 0.82rem; color: var(--text-muted); }

/* ════════════════════════════════════════════════════════════
   GUIDE PAGE
   ════════════════════════════════════════════════════════════ */

.guide-page {
    max-width: 900px;
    padding-bottom: 60px;
}
.guide-header { margin-bottom: 28px; }
.guide-header h1 { font-size: 1.5rem; margin-bottom: 6px; }
.guide-subtitle { font-size: 0.82rem; color: var(--text-muted); }

.guide-toc {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 28px;
}
.guide-toc h3 {
    font-size: 0.82rem; font-weight: 700; color: var(--text-secondary);
    margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px;
}
.guide-toc ol {
    columns: 2; column-gap: 32px;
    list-style-position: inside; padding: 0; margin: 0;
}
.guide-toc li {
    font-size: 0.82rem; padding: 3px 0; break-inside: avoid;
}
.guide-toc a {
    color: var(--accent-bright); text-decoration: none;
}
.guide-toc a:hover { text-decoration: underline; }

.guide-section {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px;
}
.guide-section h2 {
    font-size: 1.05rem; font-weight: 700; margin: 0 0 14px;
    padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.guide-section h3 {
    font-size: 0.88rem; font-weight: 600; color: var(--text-secondary);
    margin: 16px 0 8px;
}
.guide-section p {
    font-size: 0.84rem; color: var(--text); line-height: 1.6;
    margin: 0 0 10px;
}
.guide-section ul, .guide-section ol {
    font-size: 0.84rem; padding-left: 20px; margin: 0 0 12px;
}
.guide-section li { margin-bottom: 4px; line-height: 1.5; }
.guide-section strong { color: var(--accent-bright); }

.guide-diagram {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; margin: 12px 0;
    overflow-x: auto;
}
.guide-diagram pre {
    font-size: 0.78rem; color: var(--text-secondary);
    font-family: 'Consolas', 'Monaco', monospace; margin: 0;
    white-space: pre; line-height: 1.4;
}

.guide-formula {
    background: var(--bg); border: 1px solid var(--accent-glow-subtle);
    border-radius: var(--radius); padding: 12px 16px;
    font-family: monospace; font-size: 0.88rem; font-weight: 600;
    color: var(--accent-bright); text-align: center; margin: 12px 0 !important;
}

.guide-table {
    width: 100%; border-collapse: collapse; margin: 12px 0;
    font-size: 0.82rem;
}
.guide-table th {
    text-align: left; font-size: 0.72rem; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px;
    padding: 8px 12px; border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.guide-table td {
    padding: 8px 12px; border-bottom: 1px solid var(--border);
    color: var(--text);
}
.guide-table tr:last-child td { border-bottom: none; }
.guide-table tr:hover td { background: var(--surface-hover); }

.guide-table-compact td:first-child {
    font-weight: 600; color: var(--text); white-space: nowrap; width: 140px;
}

/* ════════════════════════════════════════════════════════════
   LAUNCH PAGE
   ════════════════════════════════════════════════════════════ */

.launch-page { max-width: 1100px; }

.launch-title {
    font-size: 1.2rem; font-weight: 800; letter-spacing: 1px;
    color: var(--text); margin: 0 0 20px; text-transform: uppercase;
}

.launch-section {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 18px 20px;
    margin-bottom: 16px;
}

.launch-section-title {
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.6px;
    color: var(--text-muted); text-transform: uppercase;
    margin-bottom: 14px;
}

/* Grid layouts */
.launch-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.launch-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.launch-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; }

/* Hints below fields */
.launch-hint { font-size: 0.72rem; font-style: italic; }
.launch-hint-row { display: flex; gap: 24px; margin-top: 4px; }

/* Color helpers */
.launch-text-orange { color: var(--warning); }
.launch-text-blue { color: var(--accent); }
.launch-text-purple { color: var(--purple); }
.launch-text-green { color: var(--success); }
.launch-text-red { color: var(--danger); }
.launch-text-gray { color: var(--text-muted); }

/* Checkbox label */
.launch-checkbox-label {
    display: inline-flex; align-items: center; gap: 8px;
    cursor: pointer; color: var(--text-secondary);
    font-size: 0.78rem; font-weight: 600;
}
.launch-checkbox-label input[type="checkbox"] {
    width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer;
}
.launch-checkbox-label:hover { color: var(--text); }

/* Wallet status bar */
.launch-wallet-status {
    display: flex; align-items: center; gap: 16px;
    padding: 10px 14px; margin-bottom: 12px;
    background: var(--surface-inset); border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 0.82rem;
    color: var(--text-secondary);
}

/* Wallet table */
.launch-wallet-table-wrap {
    max-height: 200px; overflow-y: auto;
    border: 1px solid var(--border); border-radius: var(--radius);
}
.launch-wallet-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.launch-wallet-table th {
    text-align: left; padding: 6px 10px; font-size: 0.7rem;
    font-weight: 600; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.4px; background: var(--surface);
    border-bottom: 1px solid var(--border); position: sticky; top: 0;
}
.launch-wallet-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.launch-wallet-table tr:hover { background: var(--surface-hover); }
.launch-wallet-table tr.deployer { background: rgba(245, 158, 11, 0.1); }
.launch-wallet-table tr.deployer:hover { background: rgba(245, 158, 11, 0.15); }
.launch-wallet-table tr.selected { background: rgba(160, 88, 78, 0.08); }
.launch-wallet-table tr.selected:hover { background: rgba(160, 88, 78, 0.12); }
.launch-wallet-table input[type="radio"],
.launch-wallet-table input[type="checkbox"] {
    accent-color: var(--accent); cursor: pointer;
}

/* Config preview table */
.launch-config-preview {
    background: var(--surface-inset); border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 16px; overflow: hidden;
}
.launch-config-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 14px; font-size: 0.82rem;
    border-bottom: 1px solid var(--border);
}
.launch-config-row:last-child { border-bottom: none; }
.launch-config-row span:first-child { color: var(--text-muted); }

/* Subsection (CT bot, volume bot inside post-launch) */
.launch-subsection {
    background: var(--surface-inset); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 16px 18px;
    margin-bottom: 12px;
}
.launch-subsection-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px; padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.launch-subsection-title {
    font-size: 0.82rem; font-weight: 700; color: var(--text);
    letter-spacing: 0.5px; text-transform: uppercase;
}
.launch-toggle-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.75rem; color: var(--text-muted); font-weight: 600;
}

/* Milestone rows */
.launch-milestone-row {
    display: grid; grid-template-columns: 1fr 1fr 32px;
    gap: 8px; margin-bottom: 6px; align-items: center;
}
.launch-milestone-row input {
    padding: 6px 10px; font-size: 0.82rem;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.launch-ms-remove {
    background: transparent; border: none; color: #666;
    cursor: pointer; padding: 4px; font-size: 14px;
    line-height: 1; text-align: center; border-radius: var(--radius);
}
.launch-ms-remove:hover { color: var(--danger); }

/* Launch readiness checklist */
.launch-readiness { border-left: 3px solid var(--warning); }
.launch-checklist { display: flex; flex-direction: column; gap: 8px; }
.launch-check-item {
    display: flex; align-items: center; gap: 10px;
    font-size: 0.85rem; color: var(--text-secondary);
}
.launch-check-icon {
    font-size: 0.9rem; font-weight: 700; width: 18px; text-align: center;
    color: var(--danger);
}
.launch-check-item.valid .launch-check-icon { color: var(--success); }

/* Action buttons row */
.launch-action-row {
    display: flex; gap: 12px; margin-bottom: 16px;
}
.launch-action-row .btn {
    padding: 12px 28px; font-size: 0.88rem; font-weight: 700;
    letter-spacing: 0.5px;
}
.launch-action-row .btn:disabled { opacity: 0.5; }

/* Warning button (for Launch) */
.btn-warning {
    background: var(--warning); border-color: var(--warning); color: #000;
}
.btn-warning:hover {
    background: var(--warning-dim); border-color: var(--warning-dim);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

/* Output pre */
.launch-output {
    background: var(--surface-inset); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.78rem; line-height: 1.5;
    color: var(--text-secondary); white-space: pre-wrap;
    max-height: 300px; overflow-y: auto;
}

/* Notice box */
.launch-notice {
    padding: 8px 12px; background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius); font-size: 0.82rem;
}

@media (max-width: 900px) {
    .launch-grid-2 { grid-template-columns: 1fr; }
    .launch-grid-3 { grid-template-columns: 1fr; }
    .launch-grid-4 { grid-template-columns: 1fr 1fr; }
    .launch-milestone-row { grid-template-columns: 1fr 1fr 36px; }
}

/* ══════════════════════════════════════════════════════════
   Auth & Landing Pages
   ══════════════════════════════════════════════════════════ */

.auth-page {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; min-height: 80vh; padding: 40px 20px;
}

/* ── Auth Card (login, set-password) ─────────────────────── */

.auth-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 40px 36px;
    width: 100%; max-width: 420px;
    box-shadow: var(--shadow-md);
}

.auth-title {
    font-size: 1.6rem; font-weight: 700; color: var(--text);
    text-align: center; margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 0.88rem; color: var(--text-muted); text-align: center;
    margin-bottom: 28px;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-field label {
    display: block; font-size: 0.8rem; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px;
}

.auth-field input {
    width: 100%; padding: 10px 12px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg);
    color: var(--text); font-size: 0.9rem;
    transition: border-color var(--transition);
}

.auth-field input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow-subtle);
}

.auth-error {
    color: var(--danger); font-size: 0.82rem; padding: 8px 12px;
    background: rgba(192, 80, 74, 0.08); border-radius: var(--radius);
    border: 1px solid rgba(192, 80, 74, 0.2);
}

.auth-submit {
    width: 100%; padding: 12px; font-size: 0.95rem; font-weight: 600;
    cursor: pointer; margin-top: 4px;
}

.auth-footer {
    text-align: center; margin-top: 20px; font-size: 0.82rem;
}
.auth-footer a { color: var(--accent); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

.auth-logo { text-align: center; margin-bottom: 16px; }
.auth-logo svg { opacity: 0.9; }

.auth-product-footer {
    margin-top: 24px; font-size: 0.75rem; color: var(--text-muted);
    text-align: center;
}
.auth-product-footer a { color: var(--accent); text-decoration: none; }
.auth-product-footer a:hover { text-decoration: underline; }

/* ── Landing / Pricing ───────────────────────────────────── */

.landing-hero { text-align: center; margin-bottom: 40px; max-width: 640px; }

.landing-title {
    font-size: 2.4rem; font-weight: 800; color: var(--text);
    margin-bottom: 12px;
}

.landing-subtitle {
    font-size: 1rem; color: var(--text-secondary); line-height: 1.6;
}

.landing-features {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
    max-width: 720px; width: 100%; margin-bottom: 48px;
}

.landing-feature {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px 20px; text-align: center;
}

.landing-feature-icon { font-size: 2rem; display: block; margin-bottom: 10px; }

.landing-feature h3 {
    font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 6px;
}

.landing-feature p { font-size: 0.82rem; color: var(--text-muted); line-height: 1.4; }

/* ── Landing sections ─────────────────────────────────────── */

.landing-section {
    max-width: 780px; width: 100%; margin-bottom: 48px;
}

.landing-section-title {
    font-size: 1.3rem; font-weight: 700; color: var(--text);
    text-align: center; margin-bottom: 24px;
}

.landing-steps {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}

.landing-step {
    text-align: center; padding: 20px 16px;
}

.landing-step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent); color: #fff; font-weight: 800;
    font-size: 0.9rem; margin-bottom: 12px;
}

.landing-step h4 {
    font-size: 0.95rem; font-weight: 700; color: var(--text); margin-bottom: 8px;
}

.landing-step p {
    font-size: 0.8rem; color: var(--text-muted); line-height: 1.5;
}

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

.landing-detail {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px 16px;
}

.landing-detail h4 {
    font-size: 0.9rem; font-weight: 700; color: var(--accent); margin-bottom: 8px;
}

.landing-detail p {
    font-size: 0.78rem; color: var(--text-muted); line-height: 1.5;
}

.landing-pricing-title {
    font-size: 1.4rem; font-weight: 700; color: var(--text);
    text-align: center; margin-bottom: 24px;
}

.landing-pricing {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
    max-width: 780px; width: 100%; margin-bottom: 20px;
}

.pricing-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 28px 24px;
    text-align: center; position: relative;
    transition: border-color var(--transition), box-shadow var(--transition);
    display: flex; flex-direction: column;
}

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

.pricing-highlight {
    border-color: var(--accent); box-shadow: var(--shadow-accent);
}

.pricing-badge {
    position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
    background: var(--accent); color: #fff; font-size: 0.68rem; font-weight: 700;
    padding: 3px 12px; border-radius: 10px; letter-spacing: 0.5px;
}

.pricing-name {
    font-size: 1rem; font-weight: 600; color: var(--text-secondary);
    margin-bottom: 12px;
}

.pricing-price {
    font-size: 2rem; font-weight: 800; color: var(--text); margin-bottom: 4px;
}

.pricing-period { font-size: 0.82rem; font-weight: 400; color: var(--text-muted); }

.pricing-desc {
    font-size: 0.82rem; color: var(--text-muted); margin: 12px 0 4px;
}

.pricing-btn { width: 100%; padding: 10px; font-size: 0.9rem; }

.landing-pricing-sub {
    font-size: 0.85rem; color: var(--text-muted); text-align: center;
    margin: -8px 0 16px;
}

.pricing-credits-info {
    margin-top: auto; padding: 10px; background: var(--bg);
    border-radius: var(--radius); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-bottom: 0;
}

.pricing-credits-icon { font-size: 1rem; }

.pricing-credits-val {
    font-size: 0.85rem; font-weight: 700; color: var(--accent);
}

.landing-credits-title {
    font-size: 1rem; font-weight: 700; color: var(--text); text-align: center;
    margin: 8px 0 4px;
}

.landing-credit-packs {
    display: flex; gap: 12px; justify-content: center; margin-bottom: 24px;
    max-width: 500px; width: 100%;
}

.landing-credit-pack {
    display: flex; flex-direction: column; align-items: center;
    padding: 12px 20px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); gap: 4px; flex: 1;
}

.landing-cp-credits { font-size: 0.82rem; font-weight: 700; color: var(--text); }

.landing-cp-price { font-size: 0.82rem; font-weight: 800; color: var(--accent); }

.pricing-save {
    font-size: 0.72rem; font-weight: 700; color: #2ecc71;
    margin: 0 0 8px; letter-spacing: 0.3px;
    min-height: 1em;
}

.landing-addon {
    font-size: 0.85rem; color: var(--text-muted); text-align: center;
    margin-bottom: 24px;
}

.landing-login-link {
    font-size: 0.85rem; color: var(--text-muted); text-align: center;
}
.landing-login-link a { color: var(--accent); text-decoration: none; }
.landing-login-link a:hover { text-decoration: underline; }

/* ── Portfolio header: subscription info + logout ─────────── */

.ph-sub-info {
    display: flex; flex-direction: column; align-items: flex-end;
    gap: 1px; margin-right: 8px;
}

.ph-sub-plan {
    font-size: 0.7rem; font-weight: 700; color: var(--accent);
    letter-spacing: 0.5px;
}

.ph-sub-detail { font-size: 0.68rem; color: var(--text-muted); }

.ph-logout-btn {
    padding: 4px 14px; font-size: 0.78rem; font-weight: 600;
    background: var(--surface); color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: var(--radius);
    cursor: pointer; transition: all var(--transition);
}

.ph-logout-btn:hover {
    background: var(--danger-dim); color: #fff; border-color: var(--danger);
}

/* ── Pricing email input ──────────────────────────────────── */

.pricing-email-input {
    width: 100%; padding: 8px 12px; margin-bottom: 8px;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 0.9rem; box-sizing: border-box;
}
.pricing-email-input:focus {
    outline: none; border-color: var(--accent);
}

/* ── Hidden helper ────────────────────────────────────────── */

#portfolio-header.hidden,
#main-nav.hidden,
#sub-nav.hidden { display: none !important; }

/* ── Credits modal ────────────────────────────────────────── */

.credits-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
}

.credits-modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 28px; max-width: 360px; width: 90%;
    text-align: center;
}

.credits-modal h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text); }

.credits-modal-sub { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 16px; }

.credits-adjust {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-bottom: 16px;
}

.credits-adj-btn {
    padding: 6px 10px; background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text); cursor: pointer;
    font-size: 0.78rem; font-weight: 600; transition: all var(--transition);
}

.credits-adj-btn:hover { border-color: var(--accent); color: var(--accent); }

.credits-adj-display { text-align: center; min-width: 100px; }

.credits-adj-amount { display: block; font-size: 1.3rem; font-weight: 800; color: var(--text); }

.credits-adj-price { display: block; font-size: 0.85rem; font-weight: 700; color: var(--accent); }

.credits-buy-btn {
    width: 100%; padding: 12px; font-size: 0.95rem; margin-bottom: 8px;
}

.credits-modal-close {
    background: none; border: 1px solid var(--border); color: var(--text-muted);
    padding: 8px 20px; border-radius: var(--radius); cursor: pointer;
    font-size: 0.85rem;
}

.credits-modal-close:hover { border-color: var(--text-muted); }

.ph-credits-stat .ph-value { color: var(--accent); }

/* ── Landing responsive ───────────────────────────────────── */

@media (max-width: 700px) {
    .landing-features { grid-template-columns: 1fr; }
    .landing-pricing { grid-template-columns: 1fr; }
    .landing-steps { grid-template-columns: 1fr; }
    .landing-details { grid-template-columns: 1fr; }
    .auth-card { padding: 28px 20px; }
}
