/* TradingBot — dashboard. Projektowany na telefon trzymany w jednej ręce:
   duże liczby, wysoki kontrast, pasek zakładek w zasięgu kciuka. */

:root {
    color-scheme: light dark;

    --bg: #f4f4f6;
    --surface: #ffffff;
    --surface-2: #ececed;
    --border: #d8d8dc;
    --text: #15151a;
    --text-dim: #6a6a73;
    --text-faint: #9a9aa3;
    --accent: #2563eb;
    --up: #137a3a;
    --down: #c02626;
    --warn: #b45309;
    --crit: #b91c1c;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e0e11;
        --surface: #17171c;
        --surface-2: #202028;
        --border: #2b2b34;
        --text: #f2f2f5;
        --text-dim: #9b9ba6;
        --text-faint: #6b6b78;
        --accent: #5b8def;
        --up: #35c26a;
        --down: #f0565a;
        --warn: #f5a524;
        --crit: #f0565a;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body { overscroll-behavior-y: contain; }

/* ---------- układ ---------- */

.app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar .title { font-weight: 650; letter-spacing: -0.01em; }

.topbar .spacer { flex: 1; }

.content {
    flex: 1;
    padding: 12px 12px calc(76px + var(--safe-bottom));
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
}

.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom);
}

.tabbar a {
    flex: 1;
    text-align: center;
    padding: 9px 2px 10px;
    font-size: 11px;
    color: var(--text-faint);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.tabbar a.active { color: var(--accent); font-weight: 600; }

.tabbar .ico { display: block; font-size: 17px; line-height: 1.2; margin-bottom: 1px; }

/* ---------- karty ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 13px 14px;
    margin-bottom: 10px;
}

.card.alarm { border-color: var(--crit); }

.label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-faint);
    margin-bottom: 5px;
}

.row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }

.row + .row { margin-top: 4px; }

.big {
    font-size: 30px;
    font-weight: 660;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

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

.small { font-size: 12.5px; }

.dim { color: var(--text-dim); }

.faint { color: var(--text-faint); }

.up { color: var(--up); }

.down { color: var(--down); }

.warn { color: var(--warn); }

.crit { color: var(--crit); }

/* ---------- odznaki ---------- */

.pill {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 650;
    padding: 2.5px 8px;
    border-radius: 99px;
    letter-spacing: 0.03em;
}

.pill-test { background: rgba(53, 194, 106, .16); color: var(--up); }

.pill-main { background: rgba(240, 86, 90, .18); color: var(--crit); }

.pill-pos { background: rgba(91, 141, 239, .18); color: var(--accent); }

.pill-warn { background: rgba(245, 165, 36, .18); color: var(--warn); }

.pill-off { background: var(--surface-2); color: var(--text-faint); }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }

.dot-live { background: var(--up); }

.dot-dead { background: var(--crit); }

/* ---------- paski ---------- */

.bar {
    height: 5px;
    background: var(--surface-2);
    border-radius: 99px;
    overflow: hidden;
    margin: 5px 0;
}

.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }

.bar.ok > span { background: var(--up); }

.bar.warn > span { background: var(--warn); }

.bar.crit > span { background: var(--crit); }

.range {
    position: relative;
    height: 6px;
    background: linear-gradient(90deg, var(--down), var(--surface-2) 45%, var(--surface-2) 55%, var(--up));
    border-radius: 99px;
    margin: 9px 0 5px;
}

.range .marker {
    position: absolute;
    top: -4px;
    width: 3px;
    height: 14px;
    background: var(--text);
    border-radius: 2px;
    transform: translateX(-50%);
}

/* ---------- listy ---------- */

.list { display: flex; flex-direction: column; }

.item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}

.item:last-child { border-bottom: 0; }

/* ---------- przyciski ---------- */

.actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }

button.btn {
    flex: 1 1 auto;
    min-width: 96px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 11px 10px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

button.btn:active { opacity: .7; }

button.btn:disabled { opacity: .4; cursor: default; }

button.btn.danger { border-color: rgba(240, 86, 90, .5); color: var(--crit); background: rgba(240, 86, 90, .1); }

button.btn.primary { border-color: var(--accent); color: #fff; background: var(--accent); }

/* ---------- formularze ---------- */

.field { margin-bottom: 12px; }

.field label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 5px; }

.field input {
    width: 100%;
    font: inherit;
    padding: 12px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
}

.field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---------- log ---------- */

.logline {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    line-height: 1.55;
    padding: 2px 0;
    border-bottom: 1px solid transparent;
    word-break: break-word;
}

.logline .lvl { font-weight: 700; }

.logline.err { color: var(--crit); }

.logline.warn { color: var(--warn); }

/* ---------- komunikaty ---------- */

.banner {
    border-radius: 12px;
    padding: 11px 13px;
    margin-bottom: 10px;
    font-size: 13.5px;
    line-height: 1.45;
}

.banner.crit { background: rgba(240, 86, 90, .14); border: 1px solid var(--crit); color: var(--crit); }

.banner.warn { background: rgba(245, 165, 36, .14); border: 1px solid var(--warn); color: var(--warn); }

.banner.info { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); }

.empty { text-align: center; color: var(--text-faint); padding: 26px 10px; font-size: 13.5px; }

.chart { width: 100%; display: block; }

.filters { display: flex; gap: 6px; margin-bottom: 9px; flex-wrap: wrap; }

.chip {
    font-size: 12px;
    padding: 6px 11px;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    cursor: pointer;
}

.chip.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }

#blazor-error-ui {
    background: var(--warn);
    color: #000;
    bottom: 0;
    display: none;
    left: 0;
    padding: 12px;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 12px; top: 10px; }
