/* =========================================================
   TheBot — Design System (Institutional Crypto Terminal)
   Obsidian canvas · sky accent · tabular numerals
   ========================================================= */

:root {
    /* Surfaces */
    --tb-canvas: #060606;
    --tb-surface: #0d0d0d;
    --tb-surface-2: #141414;
    --tb-surface-hover: #1a1a1a;

    /* Hairlines */
    --tb-line: #1f1f1f;
    --tb-line-2: #2e2e2e;

    /* Ink */
    --tb-text: #ededed;
    --tb-text-secondary: #a3a3a3;
    --tb-muted: #737373;

    /* Semantic */
    --tb-accent: #0ea5e9;
    --tb-accent-hover: #0284c7;
    --tb-profit: #10b981;
    --tb-loss: #f43f5e;
    --tb-amber: #f59e0b;

    /* Fonts */
    --tb-font-sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
    --tb-font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

    color-scheme: dark;
}

/* ---------- Base ---------- */

html, body {
    font-family: var(--tb-font-sans);
    background-color: var(--tb-canvas);
    color: var(--tb-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    background-attachment: fixed;
}

::selection {
    background: rgba(14, 165, 233, 0.3);
    color: var(--tb-text);
}

/* Links */
a, .btn-link { color: var(--tb-accent); }

/* ---------- Scrollbar ---------- */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--tb-line-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--tb-muted); }

/* ---------- Typography utilities ---------- */

.tb-mono {
    font-family: var(--tb-font-mono) !important;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.tb-tabular { font-variant-numeric: tabular-nums; }

.tb-overline {
    font-family: var(--tb-font-mono);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tb-muted);
}

.tb-micro {
    font-size: 0.6875rem;
    letter-spacing: 0.02em;
}

/* ---------- Color utilities ---------- */

.tb-text-profit { color: var(--tb-profit) !important; }
.tb-text-loss { color: var(--tb-loss) !important; }
.tb-text-accent { color: var(--tb-accent) !important; }
.tb-text-muted { color: var(--tb-muted) !important; }
.tb-text-amber { color: var(--tb-amber) !important; }

.tb-bg-profit-10 { background-color: rgba(16, 185, 129, 0.1); }
.tb-bg-loss-10 { background-color: rgba(244, 63, 94, 0.1); }
.tb-bg-accent-10 { background-color: rgba(14, 165, 233, 0.1); }
.tb-bg-amber-10 { background-color: rgba(245, 158, 11, 0.1); }

/* ---------- Panel / card utilities ---------- */

.tb-panel {
    background-color: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 4px;
}

.tb-panel-raised {
    background-color: var(--tb-surface-2);
    border: 1px solid var(--tb-line);
    border-radius: 4px;
}

.tb-divider { border-top: 1px solid var(--tb-line); }
.tb-divider-light { border-top: 1px solid var(--tb-line-2); }

/* ---------- Chips ---------- */

.tb-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    border: 1px solid transparent;
    white-space: nowrap;
}

.tb-chip-profit { background: rgba(16, 185, 129, 0.1); color: var(--tb-profit); border-color: rgba(16, 185, 129, 0.2); }
.tb-chip-loss { background: rgba(244, 63, 94, 0.1); color: var(--tb-loss); border-color: rgba(244, 63, 94, 0.2); }
.tb-chip-accent { background: rgba(14, 165, 233, 0.1); color: var(--tb-accent); border-color: rgba(14, 165, 233, 0.2); }
.tb-chip-amber { background: rgba(245, 158, 11, 0.1); color: var(--tb-amber); border-color: rgba(245, 158, 11, 0.2); }
.tb-chip-muted { background: var(--tb-surface-2); color: var(--tb-muted); border-color: var(--tb-line); }

.tb-chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* ---------- Pulsing status dot ---------- */

.tb-pulse-dot {
    position: relative;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
}

.tb-pulse-dot::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: currentColor;
    animation: tb-pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes tb-pulse-ring {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* ---------- Price flash animations ---------- */

@keyframes tb-flash-green {
    0% { background-color: rgba(16, 185, 129, 0.2); color: #34d399; }
    100% { background-color: transparent; color: inherit; }
}

@keyframes tb-flash-red {
    0% { background-color: rgba(244, 63, 94, 0.2); color: #fb7185; }
    100% { background-color: transparent; color: inherit; }
}

.tb-tick-up { animation: tb-flash-green 1s ease-out; }
.tb-tick-down { animation: tb-flash-red 1s ease-out; }

/* ---------- Bot card borders (profit/loss/neutral) ---------- */

.tb-card-profit { border-top: 3px solid var(--tb-profit) !important; box-shadow: inset 0 2px 10px -5px rgba(16, 185, 129, 0.15); }
.tb-card-loss { border-top: 3px solid var(--tb-loss) !important; box-shadow: inset 0 2px 10px -5px rgba(244, 63, 94, 0.15); }
.tb-card-neutral { border-top: 3px solid var(--tb-muted) !important; }

/* ---------- Cover progress dots (used in Bot List) ---------- */

.tb-cover-progress {
    display: inline-flex;
    gap: 2px;
    align-items: center;
}

.tb-cover-dot {
    width: 10px;
    height: 6px;
    border-radius: 2px;
    background: var(--tb-surface-2);
    border: 1px solid var(--tb-line);
}

.tb-cover-dot.filled { background: var(--tb-accent); border-color: var(--tb-accent); }
.tb-cover-dot.filled-loss { background: var(--tb-loss); border-color: var(--tb-loss); }
.tb-cover-dot.filled-amber { background: var(--tb-amber); border-color: var(--tb-amber); }

/* ---------- Phosphor icon size helpers ---------- */

.tb-icon { font-size: 18px; line-height: 1; display: inline-block; }
.tb-icon-sm { font-size: 14px; }
.tb-icon-lg { font-size: 20px; }
.tb-icon-xl { font-size: 24px; }

/* ---------- MudBlazor overrides (blend stock components into the theme) ---------- */

/* App bar + drawer — flatten, use hairlines instead of shadows */
.mud-appbar {
    border-bottom: 1px solid var(--tb-line) !important;
    box-shadow: none !important;
    background-color: var(--tb-surface) !important;
    backdrop-filter: blur(12px);
}

.mud-drawer {
    border-right: 1px solid var(--tb-line) !important;
    box-shadow: none !important;
    background-color: var(--tb-surface) !important;
}

.mud-paper {
    background-color: var(--tb-surface) !important;
    background-image: none !important;
    border: 1px solid var(--tb-line);
    box-shadow: none !important;
    border-radius: 4px !important;
}

.mud-card {
    background-color: var(--tb-surface) !important;
    background-image: none !important;
    border: 1px solid var(--tb-line) !important;
    box-shadow: none !important;
    border-radius: 4px !important;
}

/* Chips */
.mud-chip {
    border-radius: 4px !important;
    font-weight: 500;
    letter-spacing: -0.01em;
}

/* Buttons */
.mud-button-root {
    text-transform: none !important;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.mud-button-filled.mud-button-filled-primary {
    background-color: var(--tb-accent) !important;
    color: var(--tb-canvas) !important;
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.15);
}
.mud-button-filled.mud-button-filled-primary:hover {
    background-color: var(--tb-accent-hover) !important;
    box-shadow: 0 0 25px rgba(14, 165, 233, 0.3);
}

/* Nav menu */
.mud-nav-link {
    border-radius: 4px !important;
    margin: 2px 8px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    font-weight: 500;
}

.mud-nav-link.active {
    background-color: var(--tb-surface-2) !important;
    color: var(--tb-accent) !important;
    position: relative;
}

.mud-nav-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--tb-accent);
    border-radius: 0 2px 2px 0;
}

/* Data grid — sharpen */
.mud-table {
    background-color: var(--tb-surface) !important;
    border: 1px solid var(--tb-line) !important;
    border-radius: 4px;
}

.mud-table-head {
    background-color: var(--tb-surface-2) !important;
}

.mud-table-cell-header {
    font-family: var(--tb-font-mono) !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tb-muted) !important;
    border-bottom: 1px solid var(--tb-line) !important;
}

.mud-table-cell {
    border-bottom: 1px solid var(--tb-line) !important;
}

/* Inputs */
.mud-input-outlined .mud-input-outlined-border {
    border-color: var(--tb-line) !important;
}
.mud-input-outlined:hover .mud-input-outlined-border {
    border-color: var(--tb-line-2) !important;
}
.mud-input-outlined.mud-focused .mud-input-outlined-border {
    border-color: var(--tb-accent) !important;
}

/* Dialog */
.mud-dialog {
    background-color: var(--tb-surface) !important;
    border: 1px solid var(--tb-line);
    border-radius: 6px !important;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.8), 0 0 40px rgba(14, 165, 233, 0.05) !important;
}

.mud-overlay {
    backdrop-filter: blur(8px);
    background-color: rgba(6, 6, 6, 0.7) !important;
}

/* Tabs */
.mud-tabs-toolbar {
    border-bottom: 1px solid var(--tb-line);
}

.mud-tab-active {
    color: var(--tb-text) !important;
}

/* Switches */
.mud-switch-track {
    background-color: var(--tb-line) !important;
}

/* Snackbar */
.mud-snackbar {
    background-color: var(--tb-surface-2) !important;
    border: 1px solid var(--tb-line);
    border-radius: 4px !important;
}

/* ---------- Shell: Sidebar ---------- */

.tb-sidebar {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--tb-surface);
    color: var(--tb-text);
}

.tb-sidebar-header {
    height: 56px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    border-bottom: 1px solid var(--tb-line);
    font-family: var(--tb-font-mono);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.tb-sidebar-header i { font-size: 20px; }

.tb-sidebar-brand { color: var(--tb-text); }

.tb-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tb-sidebar-section {
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tb-sidebar-section-label {
    padding: 4px 12px 8px;
    color: var(--tb-muted);
}

.tb-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 4px;
    color: var(--tb-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
    position: relative;
    border: 1px solid transparent;
}

.tb-nav-link:hover {
    color: var(--tb-text);
    background: var(--tb-surface-2);
}

.tb-nav-link.active {
    color: var(--tb-accent);
    background: var(--tb-surface-2);
    border-color: var(--tb-line);
}

.tb-nav-link.active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--tb-accent);
    border-radius: 0 2px 2px 0;
}

.tb-nav-icon { font-size: 18px; line-height: 1; flex-shrink: 0; }
.tb-nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tb-sidebar-footer {
    border-top: 1px solid var(--tb-line);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.tb-user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.tb-user-monogram {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: var(--tb-surface-2);
    border: 1px solid var(--tb-line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--tb-font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--tb-muted);
    flex-shrink: 0;
}

.tb-user-info { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }

.tb-user-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--tb-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tb-user-role {
    font-family: var(--tb-font-mono);
    font-size: 10px;
    color: var(--tb-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---------- Shell: Icon buttons ---------- */

.tb-icon-btn {
    background: transparent;
    border: none;
    color: var(--tb-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background-color 0.15s, color 0.15s;
    position: relative;
    line-height: 1;
}

.tb-icon-btn:hover {
    color: var(--tb-text);
    background: var(--tb-surface-2);
}

.tb-icon-btn-notif .tb-notif-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tb-accent);
    border: 2px solid var(--tb-surface);
    box-sizing: content-box;
}

/* ---------- Shell: Top bar env switch ---------- */

.tb-env-switch {
    display: inline-flex;
    background: var(--tb-canvas);
    border: 1px solid var(--tb-line);
    border-radius: 4px;
    padding: 2px;
    gap: 2px;
}

.tb-env-btn {
    padding: 4px 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--tb-muted);
    font-family: var(--tb-font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
}

.tb-env-btn.active {
    background: var(--tb-surface-2);
    border-color: var(--tb-line);
    color: var(--tb-text);
}

.tb-env-btn:hover:not(.active) { color: var(--tb-text); }

/* Vertical divider for app bar and inline separators */
.tb-divider-v {
    width: 1px;
    height: 16px;
    background: var(--tb-line);
    display: inline-block;
    flex-shrink: 0;
    vertical-align: middle;
}

.tb-mx-3 { margin-left: 12px; margin-right: 12px; }

/* ---------- Workspace wrapper ---------- */

.tb-workspace {
    padding: 24px 32px;
    min-height: calc(100vh - 56px);
}

@media (max-width: 959.98px) {
    .tb-workspace { padding: 16px; }
}

/* ---------- Mobile shell ---------- */

.tb-mobile-root {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--tb-canvas);
}

.tb-mobile-topbar {
    height: 56px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--tb-line);
    background: rgba(6, 6, 6, 0.8);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 30;
}

.tb-mobile-brand {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.tb-mobile-title {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    min-width: 0;
}

.tb-mobile-title > span:first-child {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tb-mobile-subtitle {
    font-size: 10px;
    color: var(--tb-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 2px;
}

.tb-mobile-main {
    flex: 1;
    padding-bottom: 88px;
    min-height: 0;
}

.tb-mobile-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 72px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: rgba(13, 13, 13, 0.92);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--tb-line);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    z-index: 40;
}

.tb-mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--tb-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    padding-top: 6px;
    transition: color 0.15s;
}

.tb-mobile-tab i { font-size: 22px; }

.tb-mobile-tab:hover { color: var(--tb-text); }
.tb-mobile-tab.active { color: var(--tb-accent); }
.tb-mobile-tab.active i {
    filter: drop-shadow(0 0 6px rgba(14, 165, 233, 0.4));
}

.tb-mobile-tab-fab-slot {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
}

.tb-mobile-fab {
    position: absolute;
    top: -18px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--tb-accent);
    color: var(--tb-canvas);
    border: 3px solid var(--tb-canvas);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.35), inset 0 0 10px rgba(255, 255, 255, 0.15);
    transition: transform 0.15s;
}

.tb-mobile-fab:active { transform: scale(0.95); }

/* ---------- Page header ---------- */

.tb-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tb-page-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--tb-text);
    margin: 0;
}

.tb-page-sub {
    font-size: 11px;
    color: var(--tb-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 4px;
    font-family: var(--tb-font-mono);
}

.tb-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.tb-section-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--tb-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------- KPI strip (hero + 4 stat cards) ---------- */

.tb-kpi-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

@media (min-width: 1200px) {
    .tb-kpi-strip {
        grid-template-columns: minmax(280px, 1fr) 3fr;
    }
}

.tb-kpi-strip-dual {
    grid-template-columns: 1fr;
}

@media (min-width: 900px) {
    .tb-kpi-strip-dual {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 1280px) {
    .tb-kpi-strip-dual {
        grid-template-columns: 1.1fr 1.1fr minmax(260px, 1fr);
    }
}

.tb-kpi-grid-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (min-width: 1280px) {
    .tb-kpi-grid-pair {
        grid-template-columns: 1fr;
    }
}

.tb-kpi-hero {
    position: relative;
    padding: 20px;
    min-height: 160px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.tb-kpi-hero-grid-bg {
    position: absolute;
    inset: 0;
    opacity: 0.04;
    pointer-events: none;
    background-image: linear-gradient(var(--tb-line-2) 1px, transparent 1px),
                      linear-gradient(90deg, var(--tb-line-2) 1px, transparent 1px);
    background-size: 20px 20px;
}

.tb-kpi-hero-value {
    font-family: var(--tb-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-top: 4px;
}

.tb-kpi-hero-sub {
    font-size: 11px;
    color: var(--tb-muted);
    margin-top: 6px;
    letter-spacing: 0.02em;
}

.tb-kpi-sparkline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 52px;
    opacity: 0.45;
    pointer-events: none;
}

.tb-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (min-width: 720px) {
    .tb-kpi-grid { grid-template-columns: repeat(4, 1fr); }
}

.tb-kpi-card {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100px;
}

.tb-kpi-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.tb-kpi-card-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--tb-muted);
}

.tb-kpi-card-icon {
    font-size: 16px;
    color: var(--tb-muted);
    line-height: 1;
}

.tb-kpi-card-value {
    font-family: var(--tb-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--tb-text);
    margin-top: 12px;
}

.tb-kpi-card-hint {
    font-size: 10px;
    color: var(--tb-muted);
    letter-spacing: 0.02em;
    margin-top: 2px;
}

/* ---------- Bot cards grid ---------- */

.tb-bot-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 760px) { .tb-bot-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .tb-bot-grid { grid-template-columns: repeat(3, 1fr); } }

.tb-bot-card {
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.15s, transform 0.15s;
}

.tb-bot-card:hover {
    border-color: var(--tb-line-2);
}

.tb-bot-card-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--tb-line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(20, 20, 20, 0.3);
}

.tb-bot-card-head-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.tb-bot-card-symbol {
    font-family: var(--tb-font-mono);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: -0.01em;
}

.tb-bot-card-exchange {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid var(--tb-line-2);
    color: var(--tb-muted);
    text-transform: uppercase;
    font-family: var(--tb-font-mono);
    letter-spacing: 0.05em;
}

.tb-bot-card-asset-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.2);
    color: var(--tb-accent);
    flex-shrink: 0;
}

.tb-bot-card-price-row {
    padding: 14px 16px;
    border-bottom: 1px solid var(--tb-line);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
}

.tb-bot-card-price {
    font-family: var(--tb-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    padding: 2px 4px;
    margin: -2px -4px;
    border-radius: 3px;
    transition: background-color 0.25s, color 0.25s;
}

.tb-bot-card-pnl {
    font-family: var(--tb-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.tb-bot-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: rgba(6, 6, 6, 0.4);
}

.tb-bot-card-stat {
    padding: 10px 14px;
    border-top: 1px solid var(--tb-line);
    border-right: 1px solid var(--tb-line);
}

.tb-bot-card-stat:nth-child(2n) { border-right: none; }

.tb-bot-card-stat-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--tb-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 2px;
}

.tb-bot-card-stat-label.accent { color: var(--tb-accent); font-weight: 700; }

.tb-bot-card-stat-value {
    font-family: var(--tb-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    font-weight: 500;
    color: var(--tb-text);
    letter-spacing: -0.01em;
}

.tb-bot-card-foot {
    padding: 8px 16px;
    border-top: 1px solid var(--tb-line);
    background: rgba(20, 20, 20, 0.5);
    font-family: var(--tb-font-mono);
    font-size: 11px;
    color: var(--tb-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
}

.tb-bot-card-chart-wrap {
    padding: 8px 12px 6px 12px;
    border-top: 1px solid var(--tb-line);
    background: rgba(6, 6, 6, 0.5);
}

.tb-bot-card-chart {
    width: 100%;
    height: 64px;
    display: block;
}

.tb-bot-card-actions {
    padding: 10px 14px;
    border-top: 1px solid var(--tb-line);
    display: flex;
    gap: 8px;
}

.tb-btn-ghost {
    flex: 1;
    padding: 6px 10px;
    border-radius: 3px;
    background: transparent;
    border: 1px solid var(--tb-line-2);
    color: var(--tb-text-secondary);
    font-family: var(--tb-font-sans);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tb-btn-ghost:hover {
    background: var(--tb-surface-2);
    color: var(--tb-text);
    border-color: var(--tb-muted);
}

.tb-btn-ghost.accent:hover { color: var(--tb-accent); border-color: rgba(14, 165, 233, 0.4); }
.tb-btn-ghost.loss:hover { color: var(--tb-loss); border-color: rgba(244, 63, 94, 0.4); }
.tb-btn-ghost.profit:hover { color: var(--tb-profit); border-color: rgba(16, 185, 129, 0.4); }

.tb-btn-primary {
    padding: 8px 14px;
    border-radius: 4px;
    background: var(--tb-accent);
    border: 1px solid var(--tb-accent);
    color: #f8fafc;
    font-family: var(--tb-font-sans);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

/* ---------- Data table ---------- */

.tb-table-wrap {
    border: 1px solid var(--tb-line);
    border-radius: 6px;
    background: var(--tb-surface);
    overflow-x: auto;
}

.tb-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.tb-table thead tr {
    background: rgba(20, 20, 20, 0.5);
    border-bottom: 1px solid var(--tb-line);
}

.tb-table th {
    padding: 10px 14px;
    font-size: 10px;
    font-weight: 700;
    color: var(--tb-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.tb-table tbody tr {
    border-bottom: 1px solid var(--tb-line);
    transition: background-color 0.1s;
}

.tb-table tbody tr:last-child { border-bottom: none; }
.tb-table tbody tr:hover { background: rgba(20, 20, 20, 0.3); }

.tb-table td {
    padding: 10px 14px;
    font-family: var(--tb-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: var(--tb-text);
    letter-spacing: -0.01em;
}

/* ---------- Empty state ---------- */

.tb-empty {
    border: 1px dashed var(--tb-line-2);
    border-radius: 6px;
    padding: 32px;
    text-align: center;
    color: var(--tb-muted);
    background: rgba(13, 13, 13, 0.4);
}

.tb-empty-icon { font-size: 36px; color: var(--tb-line-2); margin-bottom: 12px; display: block; }
.tb-empty-title { font-size: 13px; color: var(--tb-text); font-weight: 600; margin-bottom: 4px; }
.tb-empty-sub { font-size: 11px; color: var(--tb-muted); margin-bottom: 16px; }

/* ---------- Bot Create / Form layout ---------- */

.tb-bot-create-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
}

@media (min-width: 1100px) {
    .tb-bot-create-layout {
        grid-template-columns: minmax(0, 1fr) 340px;
    }
}

.tb-bot-create-form {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.tb-form-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tb-form-section-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.tb-form-section-num {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    background: var(--tb-surface);
    border: 1px solid var(--tb-line-2);
    font-family: var(--tb-font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--tb-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tb-form-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--tb-text);
    margin: 0;
    letter-spacing: -0.01em;
}

.tb-form-section-rule {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--tb-line) 0%, transparent 100%);
}

.tb-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tb-form-label {
    font-family: var(--tb-font-mono);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--tb-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tb-form-hint {
    font-size: 10px;
    color: var(--tb-muted);
    letter-spacing: 0.02em;
    margin-top: 2px;
}

.tb-form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 760px) {
    .tb-form-row { grid-template-columns: repeat(2, 1fr); }
}

.tb-input-wrap {
    position: relative;
}

.tb-input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tb-muted);
    font-size: 14px;
    pointer-events: none;
}

.tb-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 4px;
    color: var(--tb-text);
    font-family: var(--tb-font-mono);
    font-size: 13px;
    letter-spacing: -0.01em;
    outline: none;
    transition: border-color 0.15s, background-color 0.15s;
}

.tb-input:focus {
    border-color: var(--tb-accent);
    background: var(--tb-surface-2);
}

.tb-input::placeholder {
    color: var(--tb-muted);
    opacity: 0.6;
}

/* Account selector */

.tb-account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.tb-account-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 5px;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
    text-align: left;
    font-family: var(--tb-font-sans);
    color: var(--tb-text);
}

.tb-account-chip:hover { border-color: var(--tb-line-2); }

.tb-account-chip.selected {
    background: var(--tb-surface-2);
    border-color: var(--tb-accent);
    box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.4);
}

.tb-account-chip-icon {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    background: var(--tb-canvas);
    border: 1px solid var(--tb-line-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--tb-font-mono);
    font-weight: 700;
    font-size: 12px;
    color: var(--tb-accent);
    flex-shrink: 0;
}

.tb-account-chip-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tb-account-chip-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--tb-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tb-account-chip-exchange {
    font-family: var(--tb-font-mono);
    font-size: 10px;
    color: var(--tb-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Segmented control (Mode) */

.tb-seg-group {
    display: flex;
    padding: 3px;
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 6px;
    gap: 2px;
}

.tb-seg-btn {
    flex: 1;
    padding: 8px 10px;
    border-radius: 4px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--tb-muted);
    font-family: var(--tb-font-sans);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    line-height: 1.1;
}

.tb-seg-btn:hover { color: var(--tb-text); }

.tb-seg-btn.active {
    background: var(--tb-canvas);
    border-color: var(--tb-line-2);
    color: var(--tb-text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.tb-seg-sub {
    font-family: var(--tb-font-mono);
    font-size: 9px;
    color: var(--tb-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Parameter cards */

.tb-param-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 760px) {
    .tb-param-grid { grid-template-columns: repeat(2, 1fr); }
}

.tb-param-card {
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 6px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.15s, background-color 0.15s;
}

.tb-param-card:focus-within {
    border-color: var(--tb-line-2);
    background: var(--tb-surface-2);
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.06);
}

.tb-param-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tb-param-value-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.tb-param-prefix {
    font-family: var(--tb-font-mono);
    font-size: 18px;
    color: var(--tb-muted);
}

.tb-param-suffix {
    font-family: var(--tb-font-mono);
    font-size: 13px;
    color: var(--tb-muted);
}

.tb-param-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--tb-text);
    font-family: var(--tb-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    padding: 0;
    min-width: 0;
}

.tb-param-input::-webkit-outer-spin-button,
.tb-param-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.tb-param-input { appearance: textfield; -moz-appearance: textfield; }

/* Launch summary */

.tb-launch-summary { position: sticky; top: 80px; }

.tb-launch-card {
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 6px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tb-launch-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--tb-line);
    margin-bottom: 6px;
}

.tb-launch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
    font-size: 12px;
}

.tb-launch-label {
    color: var(--tb-muted);
    font-size: 11px;
    letter-spacing: 0.02em;
}

.tb-launch-value {
    color: var(--tb-text);
    font-size: 12px;
    letter-spacing: -0.01em;
    text-align: right;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tb-launch-divider {
    height: 1px;
    background: var(--tb-line);
    margin: 6px 0;
}

.tb-launch-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 4px;
    color: var(--tb-amber);
    font-size: 11px;
    margin-top: 4px;
}

.tb-launch-warning i { font-size: 14px; }

.tb-launch-btn {
    margin-top: 10px;
    justify-content: center;
    width: 100%;
    padding: 10px 14px;
}

.tb-launch-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---------- Mobile bot list / detail ---------- */

.tb-m-page {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 16px;
}

.tb-m-summary-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px 12px 0 12px;
}

.tb-m-summary-item {
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tb-m-summary-label {
    font-size: 9px;
    color: var(--tb-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.tb-m-summary-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--tb-text);
    letter-spacing: -0.01em;
}

.tb-m-bot-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
}

.tb-m-bot-item {
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.tb-m-bot-item:active { background: var(--tb-surface-2); }

.tb-m-bot-price-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--tb-line);
}

.tb-m-bot-price {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    padding: 2px 4px;
    margin: -2px -4px;
    border-radius: 3px;
    transition: background-color 0.25s, color 0.25s;
}

.tb-m-bot-pnl {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.tb-m-bot-gaps {
    display: flex;
    gap: 14px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--tb-line-2);
}

.tb-m-bot-gap {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.tb-m-bot-gap i { font-size: 12px; }

.tb-m-bot-chart {
    width: 100%;
    height: 52px;
    display: block;
    margin-top: 10px;
}

.tb-m-bot-chart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 52px;
    margin-top: 10px;
    border: 1px dashed var(--tb-line-2);
    border-radius: 4px;
    color: var(--tb-muted);
    font-size: 11px;
    letter-spacing: 0.02em;
}

.tb-m-bot-chart-placeholder i { font-size: 14px; }

.tb-m-bot-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.tb-m-bot-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--tb-canvas);
    border: 1px solid var(--tb-line-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--tb-font-mono);
    font-weight: 700;
    font-size: 13px;
    color: var(--tb-accent);
    flex-shrink: 0;
}

.tb-m-bot-symbol {
    font-family: var(--tb-font-mono);
    font-weight: 600;
    font-size: 14px;
    color: var(--tb-text);
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tb-m-bot-meta {
    font-size: 10px;
    color: var(--tb-muted);
    letter-spacing: 0.02em;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tb-m-bot-stat-label {
    font-size: 10px;
    color: var(--tb-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-bottom: 2px;
}

.tb-m-bot-stat-value {
    font-family: var(--tb-font-mono);
    font-size: 13px;
    color: var(--tb-text);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.tb-m-card {
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 6px;
    padding: 14px;
    margin: 12px;
}

.tb-m-card-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--tb-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.tb-m-settings-list {
    display: flex;
    flex-direction: column;
    margin: 12px;
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 6px;
    overflow: hidden;
}

.tb-m-settings-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--tb-line);
    color: var(--tb-text);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.1s;
}

.tb-m-settings-item:last-child { border-bottom: none; }
.tb-m-settings-item:active { background: var(--tb-surface-2); }

.tb-m-settings-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--tb-canvas);
    border: 1px solid var(--tb-line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--tb-accent);
    flex-shrink: 0;
}

.tb-m-settings-body {
    flex: 1;
    min-width: 0;
}

.tb-m-settings-label {
    font-size: 13px;
    color: var(--tb-text);
    font-weight: 500;
}

.tb-m-settings-sub {
    font-size: 11px;
    color: var(--tb-muted);
    margin-top: 2px;
}

/* Mobile bot detail — hero card with sparkline */

.tb-m-hero {
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 8px;
    padding: 14px 16px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tb-m-hero-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.tb-m-hero-symbol {
    font-family: var(--tb-font-mono);
    font-size: 15px;
    font-weight: 700;
    color: var(--tb-text);
    letter-spacing: -0.01em;
}

.tb-m-hero-exchange {
    font-size: 10px;
    color: var(--tb-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
    font-family: var(--tb-font-mono);
}

.tb-m-hero-price-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
}

.tb-m-hero-price {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    padding: 2px 6px;
    margin: -2px -6px;
    border-radius: 4px;
    transition: background-color 0.25s, color 0.25s;
}

.tb-m-hero-pnl {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

.tb-m-sparkline {
    width: 100%;
    height: 56px;
    display: block;
}

.tb-m-spark-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: var(--tb-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--tb-font-mono);
}

.tb-m-spark-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 56px;
    font-size: 11px;
    color: var(--tb-muted);
    border: 1px dashed var(--tb-line-2);
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.tb-m-spark-placeholder i { font-size: 16px; }

/* Mobile targets (distance to next buy/sell) */

.tb-m-targets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tb-m-target {
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tb-m-target-sell { border-top: 2px solid var(--tb-profit); }
.tb-m-target-cover { border-top: 2px solid var(--tb-loss); }

.tb-m-target-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tb-muted);
    font-weight: 600;
}

.tb-m-target-head i { font-size: 12px; }

.tb-m-target-label { letter-spacing: 0.08em; }

.tb-m-target-price {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--tb-text);
}

.tb-m-target-gap {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Mobile gauge (position between cover and sell) */

.tb-m-gauge-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tb-m-gauge {
    position: relative;
    height: 10px;
}

.tb-m-gauge-bar {
    position: absolute;
    inset: 3px 0;
    background: linear-gradient(90deg,
        rgba(244, 63, 94, 0.3) 0%,
        rgba(244, 63, 94, 0.12) 25%,
        rgba(115, 115, 115, 0.2) 50%,
        rgba(16, 185, 129, 0.12) 75%,
        rgba(16, 185, 129, 0.3) 100%);
    border-radius: 3px;
    border: 1px solid var(--tb-line);
}

.tb-m-gauge-tick {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 0;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tb-m-gauge-tick-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--tb-accent);
    border: 2px solid var(--tb-canvas);
    box-shadow: 0 0 8px rgba(14, 165, 233, 0.5);
}

.tb-m-gauge-labels {
    display: flex;
    justify-content: space-between;
    font-family: var(--tb-font-mono);
    font-size: 10px;
    letter-spacing: -0.01em;
}

/* Mobile key-value rows, event list */

.tb-m-kv {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.tb-m-kv > span:first-child {
    color: var(--tb-muted);
    letter-spacing: 0.02em;
}

.tb-m-event-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tb-m-event {
    padding: 10px 0;
    border-bottom: 1px solid var(--tb-line);
}

.tb-m-event:last-child { border-bottom: none; }
.tb-m-event:first-child { padding-top: 0; }

.tb-m-event-msg {
    font-size: 12px;
    color: var(--tb-text);
    line-height: 1.4;
}

.tb-m-event-time {
    font-size: 10px;
    color: var(--tb-muted);
    margin-top: 3px;
    letter-spacing: 0.02em;
}

/* ---------- Account cards (Accounts list) ---------- */

.tb-account-list-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 760px) { .tb-account-list-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1180px) { .tb-account-list-grid { grid-template-columns: repeat(3, 1fr); } }

.tb-account-card {
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.15s;
}

.tb-account-card:hover { border-color: var(--tb-line-2); }

.tb-account-card-head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--tb-line);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(20, 20, 20, 0.3);
}

.tb-account-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: var(--tb-canvas);
    border: 1px solid var(--tb-line-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--tb-font-mono);
    font-weight: 700;
    font-size: 15px;
    color: var(--tb-accent);
    flex-shrink: 0;
}

.tb-account-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--tb-text);
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tb-account-card-exchange {
    font-family: var(--tb-font-mono);
    font-size: 10px;
    color: var(--tb-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

.tb-account-card-body {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tb-account-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.tb-account-card-label {
    color: var(--tb-muted);
    font-size: 11px;
    letter-spacing: 0.02em;
}

.tb-account-card-actions {
    padding: 10px 12px;
    border-top: 1px solid var(--tb-line);
    display: flex;
    gap: 6px;
    background: rgba(20, 20, 20, 0.3);
}

/* ---------- Auth (Login / Register) ---------- */

.tb-auth-root {
    display: flex;
    min-height: 100vh;
    background: var(--tb-canvas);
    font-family: var(--tb-font-sans);
    color: var(--tb-text);
    position: relative;
    overflow: hidden;
}

.tb-auth-brand {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 55%;
    padding: 48px;
    background: var(--tb-canvas);
    border-right: 1px solid var(--tb-line);
    position: relative;
    background-image: linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
    background-size: 40px 40px;
}

@media (min-width: 900px) {
    .tb-auth-brand { display: flex; }
}

.tb-auth-brand-head {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.tb-auth-brand-icon {
    width: 40px;
    height: 40px;
    border: 2px solid var(--tb-line);
    background: var(--tb-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
    transform: rotate(3deg);
    color: var(--tb-text-secondary);
    font-size: 20px;
}

.tb-auth-brand-title {
    display: flex;
    align-items: flex-end;
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--tb-text);
    margin: 0;
    line-height: 1;
    font-family: var(--tb-font-sans);
}

.tb-auth-brand-cursor {
    display: inline-block;
    width: 12px;
    height: 3px;
    background: var(--tb-accent);
    margin-left: 6px;
    margin-bottom: 6px;
    animation: tb-blink 1.2s step-end infinite;
}

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

.tb-auth-tagline {
    font-size: 28px;
    font-weight: 300;
    color: var(--tb-text-secondary);
    line-height: 1.3;
    letter-spacing: -0.02em;
    max-width: 520px;
}

.tb-auth-tagline strong {
    color: var(--tb-text);
    font-weight: 500;
}

.tb-auth-tagline-rule {
    height: 1px;
    width: 64px;
    background: var(--tb-line);
    margin-top: 32px;
}

.tb-auth-brand-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--tb-font-mono);
    font-size: 11px;
    color: var(--tb-muted);
    letter-spacing: 0.05em;
}

.tb-auth-brand-footer .tb-dot {
    width: 4px;
    height: 4px;
    background: var(--tb-line-2);
    border-radius: 50%;
}

.tb-auth-form-pane {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    z-index: 1;
}

.tb-auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--tb-surface);
    border: 1px solid var(--tb-line);
    border-radius: 10px;
    padding: 36px 36px 32px;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.8);
}

.tb-auth-card-head {
    margin-bottom: 28px;
}

.tb-auth-card-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--tb-text);
    margin: 0;
}

.tb-auth-card-sub {
    font-size: 13px;
    color: var(--tb-muted);
    margin-top: 6px;
    font-weight: 300;
}

.tb-auth-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.tb-auth-field-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tb-auth-link {
    font-size: 11px;
    color: var(--tb-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.tb-auth-link:hover { color: var(--tb-accent); }

.tb-auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.tb-auth-input-wrap i {
    position: absolute;
    left: 14px;
    color: var(--tb-muted);
    font-size: 16px;
    pointer-events: none;
    transition: color 0.2s;
}

.tb-auth-input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    background: var(--tb-canvas);
    border: 1px solid var(--tb-line);
    border-radius: 6px;
    color: var(--tb-text);
    font-family: var(--tb-font-mono);
    font-size: 13px;
    letter-spacing: -0.01em;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tb-auth-input:focus {
    border-color: var(--tb-accent);
    box-shadow: 0 0 0 1px var(--tb-accent);
}

.tb-auth-input-wrap:focus-within i { color: var(--tb-text); }

.tb-auth-input::placeholder {
    color: var(--tb-line-2);
    font-family: var(--tb-font-mono);
}

.tb-auth-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(244, 63, 94, 0.08);
    border: 1px solid rgba(244, 63, 94, 0.2);
    border-radius: 6px;
    color: var(--tb-loss);
    font-size: 12px;
    margin-bottom: 14px;
}

.tb-auth-submit {
    width: 100%;
    padding: 12px 14px;
    border-radius: 6px;
    background: var(--tb-accent);
    border: 1px solid var(--tb-accent);
    color: var(--tb-canvas);
    font-family: var(--tb-font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.05s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.tb-auth-submit:hover:not(:disabled) { background: #38bdf8; }
.tb-auth-submit:active:not(:disabled) { transform: translateY(1px); }
.tb-auth-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.tb-auth-foot {
    text-align: center;
    margin-top: 28px;
    font-size: 12px;
    color: var(--tb-muted);
}

.tb-auth-foot a {
    color: var(--tb-accent);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 1px;
    transition: border-color 0.15s;
}

.tb-auth-foot a:hover { border-bottom-color: var(--tb-accent); }

/* ---------- Blazor reconnect UI override ---------- */

#blazor-error-ui {
    color-scheme: dark;
    background: var(--tb-surface);
    color: var(--tb-text);
    border-top: 1px solid var(--tb-loss);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.6);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-family: var(--tb-font-mono);
    font-size: 13px;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
    color: var(--tb-muted);
}

.blazor-error-boundary {
    background: var(--tb-surface);
    border: 1px solid var(--tb-loss);
    color: var(--tb-loss);
    padding: 1rem;
    border-radius: 4px;
    font-family: var(--tb-font-mono);
}

.blazor-error-boundary::after { content: "An error has occurred."; }

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--tb-profit); }
.invalid { outline: 1px solid var(--tb-loss); }
.validation-message { color: var(--tb-loss); font-size: 12px; }

h1:focus { outline: none; }
