:root {
    --bg: #090c11;
    --sidebar: #10151d;
    --card: #171d27;
    --line: #2c3544;
    --text: #f3f6f8;
    --muted: #93a0b4;
    --gold: #d4b15f;
    --gold-ink: #1c1608;
    --buy: #1faf6e;
    --sell: #e15b64;
    --warn: #e0a15a;
    --shadow: 0 16px 40px rgba(0, 0, 0, .28);
    --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 248px;
    background: var(--sidebar);
    border-left: 1px solid var(--line);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; margin-bottom: 28px; }
.mark {
    width: 42px; height: 42px; border-radius: 12px;
    display: grid; place-items: center;
    background: var(--gold); color: var(--gold-ink); font-weight: 800;
}
.brand strong { display: block; font-size: 20px; }
.brand small { color: var(--muted); letter-spacing: .18em; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 12px;
    color: var(--muted);
}
.sidebar nav a.active, .sidebar nav a:hover { background: #222a37; color: var(--text); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 14px; }
.sidebar-foot a { color: var(--gold); }
.main { flex: 1; min-width: 0; }
.topbar { padding: 28px 32px 0; }
.eyebrow { margin: 0; color: var(--gold); font-size: 13px; }
.topbar h1 { margin: 4px 0 0; font-size: 28px; font-weight: 700; }
.content { padding: 22px 32px 48px; }
.flash { margin: 16px 32px 0; padding: 12px 14px; border-radius: 12px; }
.flash.ok { background: rgba(31, 175, 110, .15); color: #b7f0d4; }
.flash.err { background: rgba(225, 91, 100, .15); color: #ffc9cd; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: 1.4fr .8fr; }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 14px; font-size: 18px; }
.stat-label { color: var(--muted); margin: 0 0 8px; }
.stat-value { margin: 0; font-size: 30px; font-weight: 700; }
.muted { color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.badge {
    display: inline-flex; align-items: center; border-radius: 999px;
    padding: 4px 10px; font-size: 12px; font-weight: 700;
    background: #263041; color: var(--text);
}
.badge.buy { background: rgba(31, 175, 110, .16); color: #8ee0b8; }
.badge.sell { background: rgba(225, 91, 100, .16); color: #ffb4b8; }
.badge.win { background: rgba(31, 175, 110, .16); color: #8ee0b8; }
.badge.loss { background: rgba(225, 91, 100, .16); color: #ffb4b8; }
.badge.pending { background: rgba(212, 177, 95, .16); color: #ead7a4; }
.badge.sample { background: #2a3142; color: var(--muted); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar form, .inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input, select, textarea {
    background: #0f141c;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 12px;
    outline: none;
    width: 100%;
}
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 14px; }
.field { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.span-2 { grid-column: span 2; }
.btn, button, .btn-link {
    border: 0; cursor: pointer; text-decoration: none;
    border-radius: 12px; padding: 11px 16px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--gold); color: var(--gold-ink); font-weight: 700;
}
.btn.secondary, button.secondary { background: #263041; color: var(--text); }
.btn.danger, button.danger { background: rgba(225, 91, 100, .16); color: #ffb4b8; }
.btn.small, button.small { padding: 7px 10px; border-radius: 10px; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); }
.check input { width: auto; }
.choice { display: flex; gap: 10px; }
.choice label {
    flex: 1; margin: 0; border: 1px solid var(--line); border-radius: 12px; padding: 12px;
    display: flex; gap: 8px; align-items: center; color: var(--text); cursor: pointer;
}
.choice input { width: auto; }
.errors { background: rgba(225, 91, 100, .12); color: #ffc9cd; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.errors p { margin: 0; }
.pager { display: flex; gap: 8px; margin-top: 16px; }
.pager a, .pager span { padding: 8px 12px; border-radius: 10px; background: #222a37; text-decoration: none; }
.note { font-size: 14px; color: var(--muted); line-height: 1.7; }
.preview { max-width: 280px; border-radius: 12px; border: 1px solid var(--line); }
.timeline { display: flex; flex-direction: column; gap: 12px; }
.timeline article { border-right: 3px solid var(--gold); padding-right: 12px; }
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(440px, 100%); }
.levels { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.level { background: #10151d; border-radius: 12px; padding: 12px; }
.level span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
@media (max-width: 980px) {
    .shell { display: block; }
    .sidebar { width: auto; height: auto; position: static; }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; }
    .grid.stats, .grid.two, .form-grid, .levels { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .content, .topbar { padding-right: 16px; padding-left: 16px; }
    .flash { margin-right: 16px; margin-left: 16px; }
}
