:root {
  --bg: #120d08; --panel: #1c150d; --panel2: #241a10; --edge: #4a3a24; --text: #f3e6c4; --dim: #a8987a;
  --gold: #f8d24a; --ok: #7fdc7f; --bad: #ff7b6b; --warn: #ffb547; --link: #9fd2ff;
  --r0: #c9c9c9; --r1: #6fe06f; --r2: #5aa8ff; --r3: #c37bff; --r4: #ff9a3c;
}
* { 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", sans-serif; }
a { color: var(--link); }
h1 { font-size: 20px; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 15px; margin: 22px 0 8px; color: var(--gold); }
small, .dim { color: var(--dim); }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

#app { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
#side { background: var(--panel); border-right: 1px solid var(--edge); padding: 14px 10px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 18px; color: var(--gold); padding: 0 6px; }
.brand small { font-weight: 400; color: var(--dim); font-size: 12px; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a { color: var(--text); text-decoration: none; padding: 7px 10px; border-radius: 7px; }
#nav a:hover { background: var(--panel2); }
#nav a.sel { background: #3a2b16; color: var(--gold); }
.srvpick { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); padding: 0 6px; }
.me { margin-top: auto; font-size: 12px; color: var(--dim); padding: 0 6px; word-break: break-all; }
main { padding: 22px 28px 60px; min-width: 0; }

input, select, textarea, button { font: inherit; color: var(--text); }
input, select, textarea { background: #0d0905; border: 1px solid var(--edge); border-radius: 6px; padding: 6px 8px; }
textarea { width: 100%; min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--gold); }
button { background: #3a2b16; border: 1px solid #6b5433; border-radius: 7px; padding: 6px 12px; cursor: pointer; }
button:hover { filter: brightness(1.25); }
button.alt { background: transparent; }
button.danger { background: #4a1c16; border-color: #8a3a2c; }
button:disabled { opacity: .5; cursor: default; filter: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row + .row { margin-top: 8px; }
.grow { flex: 1; min-width: 160px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--edge); border-radius: 10px; padding: 12px 14px; }
.card h3 { margin: 0 0 6px; font-size: 15px; display: flex; justify-content: space-between; gap: 8px; }
.card .big { font-size: 26px; font-weight: 700; color: var(--gold); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; }
.kv > span { color: var(--dim); }
.kv > b { font-weight: 500; word-break: break-word; }

.tbl { overflow-x: auto; border: 1px solid var(--edge); border-radius: 10px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid #2c2216; white-space: nowrap; vertical-align: top; }
td.wrap { white-space: normal; }
th { color: var(--dim); font-weight: 500; font-size: 12px; cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--panel); }
th.sel { color: var(--gold); }
tr.click { cursor: pointer; }
tr.click:hover td { background: #2a1f12; }
tbody tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 11px; border: 1px solid var(--edge); background: var(--panel2); color: var(--text); white-space: nowrap; }
.badge.owner { border-color: var(--gold); color: var(--gold); }
.badge.admin { border-color: #c37bff; color: #d9b0ff; }
.badge.ban { border-color: var(--bad); color: var(--bad); }
.badge.on { border-color: var(--ok); color: var(--ok); }
.badge.srv { border-color: #5aa8ff; color: #9fd2ff; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #555; margin-right: 6px; }
.dot.on { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot.off { background: var(--bad); }

.sec { background: var(--panel); border: 1px solid var(--edge); border-radius: 10px; padding: 12px 14px; margin-top: 12px; }
.sec > h2:first-child { margin-top: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.items { display: flex; flex-wrap: wrap; gap: 6px; }
.item { border: 1px solid var(--edge); border-radius: 6px; padding: 3px 8px; background: #0d0905; font-size: 12px; cursor: help; }
.r0 { color: var(--r0); } .r1 { color: var(--r1); } .r2 { color: var(--r2); } .r3 { color: var(--r3); } .r4 { color: var(--r4); }
.list > div { padding: 3px 0; border-bottom: 1px dashed #2c2216; }
.list > div:last-child { border-bottom: none; }
pre { white-space: pre-wrap; word-break: break-word; background: #0d0905; border: 1px solid var(--edge); border-radius: 8px; padding: 10px; font-size: 12px; max-height: 60vh; overflow: auto; }
.log { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.log div { padding: 2px 0; border-bottom: 1px solid #221a10; white-space: pre-wrap; word-break: break-word; }
.log .adm { color: var(--gold); } .log .hub { color: #9fd2ff; }
.log .ses { color: #b9e6a8; } .log .ses.out { color: #f0b48a; } .log .jeu { color: #d6c6ff; } .log .can { color: var(--dim); }
.badge.new { border-color: var(--warn); color: #1c150d; background: var(--warn); }
.mjcols { display: grid; grid-template-columns: 240px 1fr; gap: 12px; align-items: start; }
.mjlist { display: flex; flex-direction: column; gap: 2px; background: var(--panel); border: 1px solid var(--edge); border-radius: 10px; padding: 6px; max-height: 70vh; overflow: auto; }
.mjlist a { color: var(--text); padding: 6px 8px; border-radius: 7px; cursor: pointer; word-break: break-word; }
.mjlist a:hover { background: var(--panel2); }
.mjlist a.sel { background: #3a2b16; }
.mjtalk { background: var(--panel); border: 1px solid var(--edge); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.mjtalk h2 { margin-top: 0; }
.mjlines { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow: auto; margin-bottom: 10px; }
.mjlines > div { max-width: 80%; padding: 6px 10px; border-radius: 10px; white-space: pre-wrap; word-break: break-word; }
.mjlines small { display: block; font-size: 11px; }
.mjlines .pl { align-self: flex-start; background: var(--panel2); border: 1px solid var(--edge); }
.mjlines .mj { align-self: flex-end; background: #3a2b16; border: 1px solid #6b5433; color: #ffe6a8; }
.mjlines.chan { margin-top: 10px; max-height: 65vh; }
.mjlines.chan > div { max-width: none; padding: 3px 0; border-radius: 0; border-bottom: 1px solid #221a10; }
.mjlines.chan .who { cursor: pointer; } .mjlines.chan .who:hover { text-decoration: underline; }
.mjlines .ch-g .who { color: #f3e6c4; } .mjlines .ch-c .who { color: #7fdc7f; } .mjlines .ch-p .who { color: #9fd2ff; }
.check { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; cursor: pointer; }
.back { margin-bottom: 10px; }
.empty { color: var(--dim); padding: 14px; }
.toast { position: fixed; right: 18px; bottom: 18px; background: #2a1f12; border: 1px solid var(--gold); border-radius: 10px; padding: 10px 14px; max-width: 420px; z-index: 9; box-shadow: 0 6px 24px #000a; }
.toast.bad { border-color: var(--bad); }
.gate { max-width: 460px; margin: 12vh auto; background: var(--panel); border: 1px solid var(--edge); border-radius: 12px; padding: 24px; text-align: center; }
.gate h1 { justify-content: center; color: var(--gold); }

@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; }
  #side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  #nav { flex-direction: row; flex-wrap: wrap; }
  .me { margin-top: 0; }
  main { padding: 16px; }
  .cols, .mjcols { grid-template-columns: 1fr; }
}
.card .reboot { margin: 4px 0 6px; font-weight: 600; }

/* the Stats page (stats.js) */
.note { margin: 2px 0 8px; font-size: 12px; }
.up { color: var(--ok); } .down { color: var(--bad); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.tile { background: var(--panel); border: 1px solid var(--edge); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.tile .lbl { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .04em; }
.tile b { font-size: 22px; color: var(--gold); font-variant-numeric: tabular-nums; }
.tile small { font-size: 12px; min-height: 16px; }
.heat { overflow-x: auto; display: flex; flex-direction: column; gap: 2px; font-size: 11px; }
.hrow { display: grid; grid-template-columns: 82px repeat(24, minmax(14px, 1fr)); gap: 2px; min-width: 460px; }
.hday { color: var(--dim); white-space: nowrap; }
.hh { color: var(--dim); }
.hc { height: 16px; border-radius: 3px; background: #0d0905; position: relative; }
.hc[style] { background: rgba(248, 210, 74, var(--a)); }
.hc.fut { background: transparent; }
.hc.in { box-shadow: inset 0 -2px 0 #9fd2ff; }
.hc:hover { outline: 1px solid var(--text); }
.chart { overflow-x: auto; }
svg.bars { width: 100%; min-width: 480px; height: auto; display: block; }
svg.bars .bar { fill: var(--gold); }
svg.bars .hit { fill: transparent; }
svg.bars .hit:hover { fill: rgba(243, 230, 196, .08); }
svg.bars .grid { stroke: #2c2216; stroke-width: 1; }
svg.bars .base { stroke: var(--edge); stroke-width: 1; }
svg.bars .ax { fill: var(--dim); font-size: 11px; }
.tip { position: fixed; z-index: 10; pointer-events: none; background: #2a1f12; border: 1px solid var(--edge); border-radius: 8px; padding: 7px 10px; font-size: 12px; max-width: 320px; box-shadow: 0 6px 20px #000a; }
.tip hr { border: none; border-top: 1px solid var(--edge); margin: 5px 0; }
.gwrap { display: grid; grid-template-columns: 150px minmax(0, 1fr); margin-top: 10px; }
.gnames { display: flex; flex-direction: column; }
.gname { height: 22px; line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; font-size: 13px; }
.gtrack { overflow-x: auto; }
svg.gantt { width: 100%; min-width: 520px; display: block; }
svg.gantt .grid { stroke: #2c2216; stroke-width: 1; vector-effect: non-scaling-stroke; }
svg.gantt .stripe { fill: rgba(243, 230, 196, .025); }
svg.gantt .ma { fill: var(--gold); }
svg.gantt .mi { fill: #6b5a3a; }
svg.gantt .mx { fill: var(--bad); opacity: .7; }
svg.gantt .mp { fill: #a8987a; opacity: .5; }
svg.gantt .hit { fill: transparent; }
svg.gantt .ses:hover .hit { fill: rgba(243, 230, 196, .08); }
svg.gantt .ax { fill: var(--dim); font-size: 11px; }
.glegend { font-size: 12px; color: var(--dim); margin: 8px 0 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.glegend .sw { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-left: 8px; }
.glegend .sw.ma { background: var(--gold); } .glegend .sw.mi { background: #6b5a3a; } .glegend .sw.mx { background: var(--bad); opacity: .7; }
.gtrack > * { min-width: 520px; }
.gaxis { position: relative; height: 18px; font-size: 11px; color: var(--dim); }
.gaxis span { position: absolute; top: 2px; padding-left: 3px; white-space: nowrap; border-left: 1px solid var(--edge); }

.mjlines .ch-a { color: #ffd27a; } .mjlines .ch-a .who { color: #ffb84a; }
.chanpost { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; } .chanpost select { max-width: 100%; } .chanpost input { min-width: 0; flex: 1 1 200px; }
