/* ===== Base ===== */
html, body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI Variable', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: var(--neutral-layer-1);
    color: var(--neutral-foreground-rest);
    height: 100%;
    -webkit-font-smoothing: antialiased;
}

*, *::before, *::after {
    box-sizing: border-box;
}

h1:focus, h2:focus, h3:focus, main:focus {
    outline: none;
}

/* ===== App layout ===== */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ===== Header ===== */
.app-header {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 1.25rem;
    background: var(--accent-fill-rest);
    color: var(--foreground-on-accent-rest, #fff);
    gap: 0.75rem;
    flex-shrink: 0;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0,0,0,0.14);
}

.app-header-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.app-header-link {
    color: var(--foreground-on-accent-rest, #fff) !important;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    transition: background 0.12s;
    cursor: pointer;
}

.app-header-link:hover {
    background: rgba(255,255,255,0.15);
}

.app-header-btn {
    background: none;
    border: none;
    font: inherit;
    display: inline;
    color: inherit;
}

/* ===== Body (sidebar + content) ===== */
.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===== Sidebar ===== */
.app-sidebar {
    width: 220px;
    background: var(--neutral-layer-2);
    border-right: 1px solid var(--neutral-stroke-divider-rest);
    padding: 0.75rem 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.app-nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    margin: 0 0.5rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--neutral-foreground-rest);
    font-size: 0.875rem;
    font-weight: 400;
    transition: background 0.12s;
}

.app-nav-item:hover {
    background: var(--neutral-fill-stealth-hover);
    color: var(--neutral-foreground-rest);
}

.app-nav-item svg {
    flex-shrink: 0;
    opacity: 0.75;
}

.app-nav-divider {
    height: 1px;
    background: var(--neutral-stroke-divider-rest);
    margin: 0.5rem 1rem;
}

.app-nav-group-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--neutral-foreground-hint);
    padding: 0.35rem 1.5rem;
}

/* ===== Content area ===== */
.app-content {
    flex: 1;
    padding: 1.5rem 2rem;
    overflow-y: auto;
    background: var(--neutral-layer-1);
}

.app-content h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    color: var(--neutral-foreground-rest);
}

/* ===== Trade mode badges ===== */
.trade-mode-real {
    color: #0078d4;
    font-weight: 600;
}

.trade-mode-fake {
    color: #8a8886;
    font-style: italic;
}

.trade-mode-cooldown {
    color: #d83b01;
    font-weight: 600;
}

.trade-mode-daily_loss_triggered {
    color: #a4262c;
    font-weight: 600;
}

/* ===== Profit/loss colouring ===== */
.profit-positive {
    color: #107c10;
    font-weight: 600;
}

.profit-negative {
    color: #a4262c;
    font-weight: 600;
}

/* ===== Contract type ===== */
.contract-call {
    color: #107c10;
}

.contract-put {
    color: #a4262c;
}

/* ===== Login page ===== */
.login-card {
    max-width: 380px;
    margin: 80px auto;
    padding: 2rem;
    background: var(--neutral-layer-2);
    border: 1px solid var(--neutral-stroke-divider-rest);
    border-radius: 8px;
}

/* ===== Summary stat cards ===== */
.stat-card {
    min-width: 140px;
    text-align: center;
    padding: 1rem;
    background: var(--neutral-layer-2);
    border: 1px solid var(--neutral-stroke-divider-rest);
    border-radius: 8px;
}

.stat-card small {
    font-size: 0.78rem;
    color: var(--neutral-foreground-hint);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-card h2 {
    margin: 0.25rem 0 0;
    font-size: 1.35rem;
}

/* ===== Stat card sub-value (small secondary line under h2) ===== */
.stat-card .stat-sub {
    font-size: 0.75rem;
    color: var(--neutral-foreground-hint);
    margin-top: 0.15rem;
}

/* ===== Stat tile section groups ===== */
.stat-section {
    margin-bottom: 1rem;
}

.stat-section-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--neutral-foreground-hint);
    margin-bottom: 0.4rem;
    padding-left: 0.15rem;
}

.stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* ===== Mini progress bar inside stat cards ===== */
.stat-progress {
    width: 100%;
    height: 4px;
    background: var(--neutral-stroke-divider-rest);
    border-radius: 2px;
    margin-top: 0.4rem;
    overflow: hidden;
}

.stat-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.stat-progress-fill.fill-red {
    background: #a4262c;
}

.stat-progress-fill.fill-green {
    background: #107c10;
}

.stat-progress-fill.fill-blue {
    background: #0078d4;
}

.stat-progress-fill.fill-orange {
    background: #d83b01;
}

/* ===== Stat card compact variant (narrower, for count tiles) ===== */
.stat-card-sm {
    min-width: 110px;
    text-align: center;
    padding: 0.75rem;
    background: var(--neutral-layer-2);
    border: 1px solid var(--neutral-stroke-divider-rest);
    border-radius: 8px;
}

.stat-card-sm small {
    font-size: 0.72rem;
    color: var(--neutral-foreground-hint);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-card-sm h3 {
    margin: 0.15rem 0 0;
    font-size: 1.1rem;
}

/* ===== Settings card ===== */
.settings-card {
    max-width: 700px;
    padding: 1.5rem;
    margin-top: 1rem;
    background: var(--neutral-layer-2);
    border: 1px solid var(--neutral-stroke-divider-rest);
    border-radius: 8px;
}

.settings-card h3 {
    margin-top: 0;
    color: var(--neutral-foreground-rest);
}

/* ===== Empty state ===== */
.empty-state-card {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--neutral-layer-2);
    border: 1px dashed var(--neutral-stroke-rest);
    border-radius: 8px;
    color: var(--neutral-foreground-hint);
}

/* ===== FluentButton polish ===== */
fluent-button[appearance="accent"] {
    border-radius: 6px;
}

fluent-button[appearance="outline"] {
    border-radius: 6px;
}

/* ===== FluentSelect ===== */
fluent-select {
    min-width: 160px;
}

fluent-select .listbox,
fluent-select [role="listbox"] {
    max-height: 220px !important;
    overflow-y: auto !important;
}

/* Bold text for real trades */
.trade-row-real {
    font-weight: 700;
}

/* ===== Environment badge ===== */
.kv-env-badge {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: var(--neutral-fill-secondary-rest);
    color: var(--neutral-foreground-rest);
}

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