:root {
    --bg: #f6f7f9;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --up: #16a34a;
    --down: #dc2626;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }

.topbar {
    display: flex; align-items: center; gap: 24px;
    padding: 12px 24px; background: #0f172a; color: #fff;
}
.topbar .brand { color: #fff; font-weight: 700; font-size: 16px; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { color: #cbd5e1; padding: 6px 12px; border-radius: 6px; }
.topbar nav a.active, .topbar nav a:hover { background: #1e293b; color: #fff; text-decoration: none; }
.topbar .mode { margin-left: auto; font-size: 12px; color: #94a3b8; }

.page { max-width: 1280px; margin: 0 auto; padding: 24px; }
.footer { max-width: 1280px; margin: 0 auto; padding: 8px 24px 32px; color: var(--muted); font-size: 12px; }

.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.status { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; overflow-x: auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 22px; font-weight: 600; margin: 6px 0 4px; }

.bigprice { font-size: 20px; font-weight: 600; margin-top: 6px; display: flex; gap: 12px; align-items: baseline; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.up { color: var(--up); }
.down { color: var(--down); }

.btn {
    border: 1px solid var(--border); background: #fff; color: var(--text);
    padding: 7px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; display: inline-block;
}
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.ghost { border-color: transparent; background: transparent; padding: 4px 8px; }
.btn.ghost.active { background: #e0e7ff; }
.btn:disabled { opacity: .6; cursor: default; }

input, select {
    border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; font-size: 13px; background: #fff;
}

.addform { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.btform { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.btform label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.btform input { width: 110px; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.buy, .pill.ok { background: #dcfce7; color: #166534; }
.pill.sell { background: #fee2e2; color: #991b1b; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.info { background: #dbeafe; color: #1e40af; }

table.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.grid td { padding: 8px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid tr.fresh { background: #fffbeb; }
.grid tr.clickable { cursor: pointer; }
.grid tr.clickable:hover { background: #f8fafc; }
.grid tr.selected { background: #eff6ff; }
.grid tr.ref td { color: var(--muted); font-style: italic; }

.chart { height: 420px; width: 100%; }
.legend { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-size: 12px; margin-bottom: 8px; }
.legend i { display: inline-block; width: 12px; height: 3px; margin-right: 6px; vertical-align: middle; }

#blazor-error-ui {
    background: #fef3c7; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none; left: 0; padding: 0.6rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
h1:focus { outline: none; }
.topbar .logout { color: #cbd5e1; font-size: 12px; }
