:root {
    --bg: #111114;
    --surface: #17171c;
    --surface-raised: #1e1e25;
    --border: #2a2a33;
    --text: #e6e6ea;
    --muted: #8b8b98;
    --accent: #8b7cf6;
    --accent-soft: rgba(139, 124, 246, 0.16);
    --denied: #f0607a;
    --denied-soft: rgba(240, 96, 122, 0.16);
    --warning: #f5a35b;
    --ok: #5ad38c;
    --radius: 8px;
    --mono: "JetBrains Mono", Consolas, "Cascadia Mono", monospace;
    --sans: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 18px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.warning { color: var(--warning); }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg); border-right: 1px solid var(--border); padding: 18px 12px; display: flex; flex-direction: column; gap: 1px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-weight: 700; font-size: 16px; padding: 2px 10px 18px; letter-spacing: 0.01em; }
.navGroup { color: var(--muted); font-size: 11px; font-weight: 500; text-transform: none; margin: 14px 10px 6px; letter-spacing: 0.02em; }
.navLink { display: flex; align-items: center; gap: 10px; color: var(--text); padding: 7px 10px; border-radius: 6px; font-size: 13.5px; }
.navLink:hover { background: var(--surface-raised); text-decoration: none; }
.navLink.active { color: var(--accent); background: var(--accent-soft); }
.navIcon { display: inline-grid; place-items: center; width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.navIcon svg { width: 16px; height: 16px; }
.navLink.active .navIcon { color: var(--accent); }
.sidebarFooter { margin-top: auto; padding: 12px 10px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-raised); font-size: 12px; }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.searchBox { position: relative; width: min(420px, 50vw); }
.searchBox input { width: 100%; }
.searchResults { position: absolute; top: 40px; left: 0; right: 0; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius); max-height: 420px; overflow-y: auto; display: none; }
.searchResults.open { display: block; }
.searchResults a { display: block; padding: 8px 12px; color: var(--text); }
.searchResults a:hover { background: var(--accent-soft); text-decoration: none; }
.searchResults .searchType { color: var(--muted); font-size: 11px; text-transform: uppercase; margin-right: 8px; }
.content { padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 18px; }

.banner { background: var(--surface); border: 1px solid var(--border); padding: 10px 14px; border-radius: var(--radius); display: flex; align-items: center; gap: 10px; }
.banner::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--denied); flex-shrink: 0; }
.banner strong { font-weight: 600; }
.banner .muted { margin-left: 4px; }

.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.tile { padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-height: 92px; display: flex; flex-direction: column; justify-content: center; }
.tileLabel { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.tileValue { font-size: 28px; font-weight: 600; line-height: 1.1; margin: 0 0 4px; }
.tileSub { color: var(--muted); font-size: 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: middle; }
.dotOk { background: var(--ok); }
.dotAccent { background: var(--accent); }
.dotDenied { background: var(--denied); }
.dotWarning { background: var(--warning); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.cardHeader { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cardBody { padding: 14px 18px; }
.cardFooter { padding: 10px 18px; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; align-items: center; }

.activity { display: grid; grid-template-columns: 240px 1fr; gap: 24px; padding: 16px 18px; }
.legendValue { font-size: 24px; font-weight: 600; }
.reasonRow { display: grid; grid-template-columns: 1fr 90px 28px; gap: 8px; align-items: center; font-size: 12.5px; margin: 6px 0; }
.reasonBar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.reasonBar span { display: block; height: 100%; background: var(--warning); }
.chartBox { position: relative; height: 220px; min-width: 0; }

.tabs { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.tabs a, .tabs button { background: none; border: 0; color: var(--text); padding: 6px 12px; font: inherit; cursor: pointer; }
.tabs .active { background: var(--accent-soft); color: var(--accent); }
.tabs a:hover { text-decoration: none; }

.tableWrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; padding: 10px 18px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 18px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-raised); }
.empty { color: var(--muted); padding: 18px; text-align: center; }

.pill { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.pillAccent { color: var(--accent); border-color: var(--accent); }
.pillDenied { color: var(--denied); border-color: var(--denied); }
.pillOk { color: var(--ok); border-color: var(--ok); }
.pillWarning { color: var(--warning); border-color: var(--warning); }

input, select, textarea { background: var(--surface-raised); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 7px 10px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12.5px; }
.button { background: var(--surface-raised); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 6px 12px; font: inherit; cursor: pointer; white-space: nowrap; }
.button:hover { border-color: var(--accent); }
.buttonPrimary { background: var(--accent); border-color: var(--accent); color: #fff; }
.buttonDanger { color: var(--denied); border-color: rgba(240, 96, 122, 0.45); }
.buttonDanger:hover { background: var(--denied-soft); border-color: var(--denied); }
.formRow { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.notice { padding: 10px 12px; border-radius: 6px; font-size: 13px; }
.noticeOk { background: rgba(90, 211, 140, 0.12); color: var(--ok); }
.noticeError { background: var(--denied-soft); color: var(--denied); }
.keyReveal { font-family: var(--mono); background: var(--surface-raised); padding: 10px 12px; border-radius: 6px; white-space: pre; overflow-x: auto; user-select: all; }

.pageHeader { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.stats { display: flex; gap: 0; }
.stat { padding: 0 20px; border-left: 1px solid var(--border); }
.stat:first-child { padding-left: 0; border-left: 0; }
.stat div:first-child { color: var(--muted); font-size: 12px; }
.split { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.details { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 13px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.signals li { margin: 4px 0; }
.pager { display: flex; gap: 6px; }

.centeredPage { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.redeemCard, .loginCard { width: min(420px, 100%); padding: 24px; display: flex; flex-direction: column; gap: 14px; }

@media (max-width: 1100px) {
    .tiles { grid-template-columns: repeat(2, 1fr); }
    .tile { border-bottom: 1px solid var(--border); }
    .activity, .split { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
    .navGroup { display: none; }
    .topbar, .content { padding-left: 16px; padding-right: 16px; }
    .searchBox { width: 100%; }
}

.toast { position: fixed; right: 20px; bottom: 20px; padding: 10px 14px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 20; }
.toast.noticeOk, .toast.noticeError { opacity: 1; }

.modalOverlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); display: grid; place-items: center; z-index: 30; }
.modalCard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; width: min(500px, 92vw); display: flex; flex-direction: column; gap: 6px; }
.modalCard h2 { margin-bottom: 4px; }
