:root {
  --bg: #111513;
  --sidebar: #171d19;
  --card: #1b211e;
  --top: #161b17;
  --line: #343e36;
  --line-soft: #2a332c;
  --text: #e6e9e0;
  --text-strong: #f0efe2;
  --muted: #8d978a;
  --faint: #6c766c;
  --olive: #a4ad74;
  --green: #8eb99a;
  --copper: #dd945e;
  --copper-deep: #ab714e;
  --red: #d47266;
  --nav: #303a2e;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  --sidebar-w: 244px;
  --top-h: 58px;
  --radius: 8px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 13.5px;
  line-height: 1.4;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.green { color: var(--green); }
.olive { color: var(--olive); }
.copper { color: var(--copper); }
.red { color: var(--red); }

.app { display: flex; height: 100%; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.brand {
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--copper-deep);
  color: #1a120c;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.brand strong { display: block; font-size: 13px; letter-spacing: 0.08em; }
.brand span { display: block; color: var(--faint); font-size: 10px; letter-spacing: 0.08em; }
.nav {
  padding: 12px 10px 16px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-label {
  margin: 14px 8px 6px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.14em;
}
.nav-label:first-child { margin-top: 4px; }
.nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: transparent;
  border: 0;
  border-left: 2px solid transparent;
  color: #c5cdc3;
  border-radius: 6px;
  padding: 8px 10px;
}
.nav button .ico { width: 16px; height: 16px; flex: none; color: var(--faint); }
.nav button.active {
  background: var(--nav);
  border-left-color: var(--copper);
  color: var(--text-strong);
}
.nav button.active .ico { color: var(--olive); }
.nav button:hover:not(.active) { background: rgba(48, 58, 46, 0.45); }
.nav-spacer { margin-top: 8px; border-top: 1px solid var(--line-soft); padding-top: 8px; }

.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--top-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--top);
}
.icon-btn.menu-btn { display: none; }
.server-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.server-id .ico { color: var(--faint); }
.server-id strong { display: block; font-weight: 500; font-size: 13.5px; }
.server-meta { display: flex; gap: 8px; align-items: center; color: var(--faint); font-size: 11px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }
.sample-pill, .stat-pill, .tag, .btn, .icon-btn {
  border: 1px solid var(--line);
  background: #20261f;
  border-radius: 5px;
}
.sample-pill {
  color: #cbb892;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  white-space: nowrap;
}
.top-stats { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.stat-pill { padding: 5px 8px; color: var(--muted); font-size: 11px; letter-spacing: 0.04em; white-space: nowrap; }
.stat-pill b { color: var(--text); font-weight: 500; }
.icon-btn, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 9px;
  color: var(--text);
  background: #222922;
}
.icon-btn { width: 32px; height: 32px; padding: 0; position: relative; }
.btn:hover, .icon-btn:hover, .nav button:hover { border-color: #465246; }
.btn.primary { background: #2a3324; border-color: #516046; }
.badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}
.who { display: flex; align-items: center; gap: 8px; padding-left: 4px; }
.who small { display: block; color: var(--faint); font-size: 11px; }
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2c3830;
  display: grid;
  place-items: center;
  color: var(--olive);
  font-size: 11px;
  font-weight: 600;
}

.views { flex: 1; overflow: auto; padding: 16px 18px 28px; }
.view { display: none; }
.view.active { display: block; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 14px; }
.kicker { margin: 0 0 4px; color: var(--faint); font-size: 10px; letter-spacing: 0.14em; }
h1 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.sub { margin: 4px 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 8px; }

.metrics { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 10px; }
.metric, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.metric { padding: 12px 14px 11px; min-width: 0; }
.metric .label { color: var(--faint); font-size: 10px; letter-spacing: 0.08em; }
.metric .value { margin-top: 8px; font-size: 26px; line-height: 1; letter-spacing: -0.03em; }
.metric .value span { font-size: 14px; color: #9ba99a; letter-spacing: 0; }
.metric .hint { margin-top: 8px; color: var(--faint); font-size: 11.5px; }
.metric button.jump {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
}

.cc {
  display: grid;
  grid-template-columns: 1.15fr 1fr 0.92fr;
  gap: 10px;
}
.card { padding: 12px 14px 14px; }
.card h2 { margin: 0; font-size: 14px; font-weight: 500; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.span-2 { grid-column: 1 / 3; }
.side { grid-column: 3; grid-row: 1 / 4; display: flex; flex-direction: column; gap: 10px; }
.side .card { flex: 1; }

.chart {
  width: 100%;
  height: 210px;
  display: block;
  background:
    linear-gradient(to right, rgba(52, 62, 54, 0.45) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(52, 62, 54, 0.45) 1px, transparent 1px);
  background-size: 48px 35px;
  border-radius: 6px;
}
.legend { display: flex; gap: 12px; color: var(--faint); font-size: 11px; }
.swatch { width: 8px; height: 8px; display: inline-block; margin-right: 5px; }
.swatch.fps { background: var(--green); }
.swatch.ram { background: var(--copper); }

.alert, .event, .log-row, .queue-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
}
.alert:first-of-type, .event:first-of-type, .log-row:first-of-type, .queue-item:first-of-type { border-top: 0; }
.alert b, .event b, .log-row b, .queue-item b { font-weight: 500; }
.alert small, .event small, .log-row small, .queue-item small { display: block; color: var(--faint); margin-top: 2px; }
.tag {
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  color: var(--muted);
  background: transparent;
}
.tag.high, .tag.raid, .tag.report { color: var(--red); border-color: #6e3d38; }
.tag.med, .tag.kill, .tag.pvp, .tag.review, .tag.warn, .tag.due { color: var(--copper); border-color: #6d5438; }
.tag.join, .tag.build, .tag.ok, .tag.ready { color: var(--green); border-color: #3d5646; }
.tag.healthy { color: var(--green); border-color: transparent; background: transparent; letter-spacing: 0.08em; }

.tactical {
  position: relative;
  height: 148px;
  border-radius: 6px;
  overflow: hidden;
  background:
    radial-gradient(circle at 68% 42%, rgba(221, 148, 94, 0.28), transparent 34%),
    linear-gradient(to right, rgba(142, 185, 154, 0.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(142, 185, 154, 0.16) 1px, transparent 1px),
    #141a16;
  background-size: auto, 22px 22px, 22px 22px, auto;
  margin-bottom: 8px;
}
.blip {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.blip.ok { background: var(--green); }
.blip.hot { background: var(--copper); box-shadow: 0 0 0 3px rgba(221, 148, 94, 0.2); }
.queue-actions { display: flex; gap: 8px; margin-top: 8px; }
.queue-actions .btn { flex: 1; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.search, .field input, .field select, .field textarea, .console-form input, .ask input {
  background: #141a16;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px 10px;
}
.search { min-width: 240px; }
.filters { display: flex; gap: 6px; }
.filters button.active { background: var(--nav); border-color: #516046; color: var(--text-strong); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 10px; letter-spacing: 0.08em; color: var(--faint); font-weight: 500; padding: 0 8px 8px; }
td { padding: 9px 8px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
tr.hidden { display: none; }
tr.selected td { background: rgba(48, 58, 46, 0.65); }
.trust { font-variant-numeric: tabular-nums; }
.trust.high { color: var(--red); }
.trust.watch { color: var(--copper); }
.trust.clear { color: var(--green); }

.split { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 10px; }
.map-stage {
  position: relative;
  height: 560px;
  border-radius: 6px;
  background:
    linear-gradient(to right, rgba(142, 185, 154, 0.14) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(142, 185, 154, 0.14) 1px, transparent 1px),
    #141a16;
  background-size: 40px 40px;
}
.monument {
  position: absolute;
  transform: translate(-50%, -50%);
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.08em;
}
.map-player {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  padding: 0;
  width: 14px;
  height: 14px;
}
.map-player i {
  display: block;
  width: 8px;
  height: 8px;
  margin: 3px;
  border-radius: 50%;
  background: var(--green);
}
.map-player.watch i { background: var(--copper); }
.map-player.high i { background: var(--red); }
.map-player.selected i { box-shadow: 0 0 0 4px rgba(221, 148, 94, 0.25); }
.detail p { margin: 8px 0; }
.detail dt { color: var(--faint); font-size: 11px; }
.detail dd { margin: 0 0 8px; }

.cases, .plugins, .jobs { display: flex; flex-direction: column; }
.case, .plugin, .job {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
}
.case:first-child, .plugin:first-child, .job:first-child { border-top: 0; padding-top: 2px; }
.toggle {
  width: 36px;
  height: 20px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: #141a16;
  position: relative;
  padding: 0;
}
.toggle i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--faint);
}
.toggle.on { background: #2c3b30; border-color: #3d5646; }
.toggle.on i { left: 18px; background: var(--green); }

.console {
  background: #101410;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 420px;
  max-height: 520px;
  overflow: auto;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.55;
}
.console .cmd { color: var(--olive); }
.console .out { color: #c5cdc3; white-space: pre-wrap; }
.console-form { display: flex; gap: 8px; margin-top: 10px; }
.console-form input, .ask input { flex: 1; }
.prompt { color: var(--copper); align-self: center; }

.chat { display: flex; flex-direction: column; gap: 10px; min-height: 380px; }
.bubble { max-width: 680px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: #20261f; }
.bubble.user { margin-left: auto; background: #2a3328; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.ask { display: flex; gap: 8px; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; }
.bars span {
  flex: 1;
  background: #8ea36a;
  border-radius: 2px 2px 0 0;
  min-height: 4px;
}
.bar-labels { display: flex; gap: 6px; color: var(--faint); font-size: 10px; margin-top: 6px; }
.bar-labels span { flex: 1; text-align: center; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.wide { grid-column: 1 / -1; }
.field span { color: var(--faint); font-size: 11px; letter-spacing: 0.06em; }
.note {
  margin-top: 12px;
  color: var(--muted);
  border-left: 2px solid var(--copper);
  padding-left: 10px;
}

.modal, .palette, .drawer-back {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 8, 0.62);
  display: grid;
  place-items: center;
  z-index: 20;
}
.modal[hidden], .palette[hidden], .drawer-back[hidden] { display: none; }
.modal-card, .palette-card {
  width: min(480px, calc(100% - 32px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.modal-card h3, .palette-card h3 { margin: 0 0 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.palette-card { width: min(560px, calc(100% - 32px)); }
.palette-list { display: flex; flex-direction: column; margin-top: 8px; max-height: 320px; overflow: auto; }
.palette-list button, .alert-list button {
  text-align: left;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line-soft);
  padding: 8px 4px;
  color: var(--text);
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(380px, 100%);
  background: #171d19;
  border-left: 1px solid var(--line);
  z-index: 21;
  padding: 16px;
  overflow: auto;
}
.drawer[hidden] { display: none; }
.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: #222922;
  border: 1px solid var(--line);
  border-left: 3px solid var(--copper);
  padding: 10px 12px;
  border-radius: 6px;
  z-index: 30;
  max-width: 360px;
}
.toast[hidden] { display: none; }
.sidebar-back { display: none; }
.ico { width: 16px; height: 16px; display: block; flex: none; }

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .cc, .split { grid-template-columns: 1fr; }
  .span-2, .side { grid-column: auto; grid-row: auto; }
  .sample-pill { display: none; }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 15;
    transform: translateX(-105%);
    transition: transform 160ms ease;
  }
  .sidebar.open { transform: none; }
  .sidebar-back:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 14;
  }
  .icon-btn.menu-btn { display: inline-flex; }
  .who small, .stat-pill { display: none; }
  .metrics, .form-grid { grid-template-columns: 1fr 1fr; }
  .map-stage { height: 380px; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
