/* Idolum admin panel: dark, dense, professional. No external fonts or assets. */
:root {
  --bg: #0d1017;
  --panel: #151a23;
  --panel-2: #1b2130;
  --line: #262e3f;
  --text: #dfe5f0;
  --muted: #8691a8;
  --accent: #7aa2ff;
  --ok: #4fd18b;
  --warn: #f2b84b;
  --danger: #ff6b6b;
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 16px; font-weight: 600; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; color: var(--text); }
h3 { font-size: 13px; margin: 14px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
.boot { padding: 40px; color: var(--muted); }

/* Layout */
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.brand { font-weight: 700; font-size: 16px; padding: 0 10px 18px; letter-spacing: .02em; }
.brand span { color: var(--accent); }
.nav a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--muted); }
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--panel-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.side .spacer { flex: 1; }
.side .who { color: var(--muted); font-size: 12px; padding: 8px 10px; }
.main { padding: 24px 28px; min-width: 0; }

/* Cards and grids */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.card .value { font-size: 24px; font-weight: 600; margin-top: 4px; }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; min-width: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--panel-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* Forms */
input, select, textarea, button {
  font: inherit; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px;
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
button { cursor: pointer; background: var(--panel-2); }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #0b1020; border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--danger); border-color: #5a2a33; }
button.danger:hover { background: #2a1519; }
button:disabled { opacity: .5; cursor: default; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input.narrow { width: 110px; }

/* Badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; border: 1px solid var(--line); color: var(--muted); }
.badge.ok { color: var(--ok); border-color: #1f5138; }
.badge.warn { color: var(--warn); border-color: #5a4520; }
.badge.danger { color: var(--danger); border-color: #5a2a33; }
.badge.accent { color: var(--accent); border-color: #2c3d66; }

/* Inventory grid */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.slot { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px; min-height: 58px; font-size: 12px; position: relative; }
.slot.empty { opacity: .45; }
.slot .idx { position: absolute; top: 3px; right: 6px; color: var(--muted); font-size: 10px; }
.slot .id { font-weight: 600; word-break: break-all; }
.slot .meta { color: var(--muted); font-size: 11px; }
.slot.filled { cursor: pointer; }
.slot.filled:hover { border-color: var(--danger); }

/* Charts */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 120px; padding-top: 6px; }
.bars .bar { flex: 1; background: var(--accent); opacity: .8; border-radius: 2px 2px 0 0; min-height: 1px; }
.bars .bar:hover { opacity: 1; }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 4px; }

/* JSON */
pre.json { background: #0a0d13; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; overflow: auto; max-height: 420px; margin: 0; white-space: pre; }
.j-key { color: #9cc3ff; }
.j-str { color: #a7e3a1; }
.j-num { color: #f7c27a; }
.j-bool { color: #e39af0; }
.j-null { color: var(--muted); }
details > summary { cursor: pointer; color: var(--muted); margin: 6px 0; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; }
.login form { width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.login .brand { padding: 0 0 6px; font-size: 18px; }

/* Messages and modal */
.error { color: var(--danger); font-size: 13px; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; box-shadow: 0 6px 24px #0008; z-index: 30; }
.toast.err { border-color: #5a2a33; color: var(--danger); }
.modal-back { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; z-index: 20; }
.modal { width: min(460px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.modal .warn-text { color: var(--warn); }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 4px 12px; }
.kv .k { color: var(--muted); }
.list-plain { margin: 0; padding-left: 18px; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; }
  .side .spacer { display: none; }
}
