/* dayz-panel v2 — dark ops console */
:root {
  color-scheme: dark;
  --bg: #0b0d0c;
  --surface: #131614;
  --surface-2: #181c19;
  --surface-3: #20251f;
  --line: #242925;
  --line-2: #323832;
  --text: #eeede6;
  --text-2: #b8b8ae;
  --muted: #85877e;
  --grid: #232823;
  --axis: #383d38;
  --accent: #e28b3c;
  --accent-2: #f0a45e;
  --accent-ink: #1b1006;
  --accent-wash: rgba(226, 139, 60, .12);
  /* chart series — categorical slots 1..3 (dark steps) */
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  /* status (reserved) */
  --good: #0ca30c;
  --good-text: #3fc43f;
  --warn: #fab219;
  --crit: #d03b3b;
  --crit-text: #ef7a7a;
  --radius: 10px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.dim { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 25%, #3a2a1a, #140e09);
  border: 1px solid #3b2c1d;
  color: var(--accent);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-weight: 700; letter-spacing: .14em; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-sep { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 500;
  text-decoration: none;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--accent-wash); color: var(--accent-2); }
.nav a .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.side-host { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }

.main { min-width: 0; padding-inline: 28px; padding-block: 22px 60px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.btn.menu-btn { display: none; }

/* ---------------------------------------------------------------- primitives */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-width: 0;
}
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h h2 { font-size: 13px; font-weight: 600; margin: 0; color: var(--text); letter-spacing: .01em; }
.card-h .sub { color: var(--muted); font-size: 12px; }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 550; font-size: 13px;
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-3); border-color: #444b44; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { color: var(--crit-text); }
.btn.danger:hover { border-color: var(--crit); background: rgba(208, 59, 59, .1); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 34px; padding: 0; justify-content: center; }

.input, .select, textarea.input {
  height: 34px; padding: 0 10px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  color: var(--text);
  outline: none; min-width: 0;
}
textarea.input { height: auto; padding: 10px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.select { padding-right: 26px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px; background-size: 5px 5px; background-repeat: no-repeat; }
label.chk { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); font-size: 13px; cursor: pointer; }
label.chk input { accent-color: var(--accent); }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: transparent; color: var(--text-2); height: 28px; padding: 0 11px; border-radius: 6px; cursor: pointer; font-size: 12.5px; font-weight: 550; }
.seg button.on { background: var(--surface-3); color: var(--text); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--line-2); white-space: nowrap;
}
.badge.accent { background: var(--accent-wash); color: var(--accent-2); border-color: rgba(226,139,60,.35); }
.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px rgba(133,135,126,.15); }
.status.good { color: var(--good-text); } .status.good .dot { background: var(--good); box-shadow: 0 0 0 3px rgba(12,163,12,.18); }
.status.warn { color: var(--warn); } .status.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(250,178,25,.16); }
.status.crit { color: var(--crit-text); } .status.crit .dot { background: var(--crit); box-shadow: 0 0 0 3px rgba(208,59,59,.2); }
.status.live .dot { animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(12,163,12,0); } }

/* tables */
.tbl-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 550; font-size: 11.5px; color: var(--muted); padding: 0 12px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl td.num { font-variant-numeric: tabular-nums; }
.tbl tbody tr:hover td { background: rgba(255,255,255,.015); }
.empty { color: var(--muted); padding: 18px 0; text-align: center; font-size: 13px; }

/* ---------------------------------------------------------------- overview */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center;
  background:
    radial-gradient(900px 200px at 0% 0%, rgba(226,139,60,.10), transparent 60%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; margin-bottom: 16px;
}
.hero-name { font-size: 19px; font-weight: 650; margin: 6px 0 4px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.hero-meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--text-2); font-size: 13px; }
.hero-meta b { color: var(--text); font-weight: 600; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.players-big { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.players-big small { font-size: 15px; color: var(--muted); font-weight: 500; }

.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px 12px; min-width: 0; }
.tile-k { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tile-v { font-size: 22px; font-weight: 650; margin-top: 6px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-v small { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.tile-s { font-size: 12px; color: var(--text-2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { height: 4px; border-radius: 4px; background: var(--surface-3); margin-top: 9px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 4px; background: var(--s1); transition: width .4s; }
.meter.warn > i { background: var(--warn); }
.meter.crit > i { background: var(--crit); }

/* charts */
.chart { display: flex; flex-direction: column; }
.chart-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.chart-title { font-size: 13px; font-weight: 600; }
.chart-now { margin-left: auto; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.chart-legend { display: flex; gap: 12px; flex-wrap: wrap; }
.lg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.lg i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-body { position: relative; height: 190px; }
.chart-body canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; }
.chart-tip {
  position: absolute; top: 6px; pointer-events: none; z-index: 2;
  background: rgba(20, 23, 21, .96); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 7px 10px; font-size: 12px; min-width: 130px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.chart-tip .t { color: var(--muted); margin-bottom: 4px; }
.chart-tip .v { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.chart-tip .v i { width: 8px; height: 8px; border-radius: 50%; }
.chart-tip .v b { margin-left: auto; padding-left: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }

.cores { display: flex; flex-direction: column; gap: 7px; }
.core { display: grid; grid-template-columns: 52px 1fr 44px; gap: 10px; align-items: center; font-size: 12px; color: var(--text-2); }
.core .meter { margin: 0; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.timeline { display: flex; flex-direction: column; }
.tl { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; align-items: start; }
.tl:last-child { border-bottom: 0; }
.tl .when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.tl-ic { width: 18px; height: 18px; display: grid; place-items: center; margin-top: 1px; }
.tl-ic svg { width: 15px; height: 15px; }
.k-crash { color: var(--crit-text); } .k-start { color: var(--good-text); } .k-stop, .k-exit { color: var(--text-2); } .k-auto-restart { color: var(--warn); }
.k-join { color: var(--good-text); } .k-leave { color: var(--text-2); } .k-death { color: var(--crit-text); }

/* ---------------------------------------------------------------- editors */
.split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.tree { max-height: calc(100vh - 230px); overflow: auto; margin: 0 -8px; padding: 0 2px; }
.tree a {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px; border-radius: 6px;
  color: var(--text-2); font-size: 13px; cursor: pointer; text-decoration: none;
  white-space: nowrap; overflow: hidden;
}
.tree a:hover { background: var(--surface-2); color: var(--text); }
.tree a.on { background: var(--accent-wash); color: var(--accent-2); }
.tree a .sz { margin-left: auto; color: var(--muted); font-size: 11.5px; padding-left: 8px; }
.tree a.dir { color: var(--text); font-weight: 550; }
.tree a span.nm { overflow: hidden; text-overflow: ellipsis; }
.editor {
  width: 100%; min-height: calc(100vh - 290px);
  background: #0a0c0b; color: #e4e2d8;
  border: 1px solid var(--line-2); border-radius: 8px;
  font: 12.5px/1.55 var(--mono); padding: 12px 14px;
  resize: vertical; tab-size: 4; outline: none; white-space: pre; overflow: auto;
}
.editor:focus { border-color: #4a514a; }
.console {
  background: #0a0c0b; border: 1px solid var(--line); border-radius: 8px;
  font: 12px/1.55 var(--mono); color: #cfcdc2;
  padding: 10px 12px; margin: 0; overflow: auto; white-space: pre; max-height: calc(100vh - 260px); min-height: 200px;
}
.console.tall { height: calc(100vh - 215px); max-height: none; }
.console.wrap { white-space: pre-wrap; word-break: break-all; }
.console mark { background: rgba(226,139,60,.3); color: inherit; border-radius: 2px; }
.console .ln-e { color: var(--crit-text); }
.console .ln-w { color: var(--warn); }

.cfg-row input.input { width: 100%; font-family: var(--mono); font-size: 12.5px; height: 30px; }
.cfg-key { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.cfg-cmt { color: var(--muted); font-size: 12px; }
.dirty-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }

.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 13px; }
.note svg { margin-top: 2px; color: var(--accent); }

/* ---------------------------------------------------------------- overlays */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: min(420px, calc(100vw - 36px)); }
.toast {
  background: var(--surface-2); border: 1px solid var(--line-2); border-left: 3px solid var(--s1);
  padding: 10px 14px; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.45);
  font-size: 13px; animation: slide .18s ease-out;
}
.toast.good { border-left-color: var(--good); } .toast.crit { border-left-color: var(--crit); }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 40; padding: 16px; backdrop-filter: blur(2px); }
.modal { background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; width: min(460px, 100%); padding: 20px 22px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal h3 { margin: 0 0 8px; font-size: 16px; }
.modal p { margin: 0 0 16px; color: var(--text-2); }
.modal .row { justify-content: flex-end; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding-inline: 16px;
  background: radial-gradient(700px 400px at 50% 20%, rgba(226,139,60,.10), transparent 70%), var(--bg); }
.login { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.login .brand { padding: 0 0 20px; }
.login .input { width: 100%; height: 40px; }
.login .btn { width: 100%; justify-content: center; height: 40px; margin-top: 12px; }
.login .err { color: var(--crit-text); font-size: 13px; min-height: 20px; margin-top: 10px; }

.skeleton { color: var(--muted); padding: 40px 0; text-align: center; }
.spin { width: 14px; height: 14px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: sp .7s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1280px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .g-side, .g3 { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .tree { max-height: 320px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 30; left: 0; top: 0; width: 250px; transform: translateX(-100%); transition: transform .2s; box-shadow: 20px 0 60px rgba(0,0,0,.5); }
  .side.open { transform: none; }
  .btn.menu-btn { display: inline-flex; }
  .main { padding-inline: 16px; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-actions { justify-content: flex-start; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
