/* Ginder2.0 — панель серверов ARK: Survival Ascended.
   Тёмный «базальт» и циановый акцент интерфейса ARK. Статус всегда цвет + слово. */

:root {
  --bg: #121a1d;
  --surface: #172227;
  --raised: #1e2c33;
  --line: #2a3a42;
  --line-strong: #3a4d56;
  --text: #dde6e4;
  --muted: #8da0a3;
  --faint: #62767b;
  --accent: #57c7c1;
  --accent-strong: #7fe0d9;
  --accent-ink: #082423;
  --ok: #6bcb8b;
  --warn: #e8b44c;
  --bad: #e5675a;
  --off: #73858a;
  --radius-s: 4px;
  --radius-m: 8px;
  --font-body: "Golos Text", "Segoe UI", system-ui, sans-serif;
  --font-head: "Unbounded", "Golos Text", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --sidebar: 232px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font-body);
  font-feature-settings: "tnum" 1;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 1.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.95rem; }
p { margin: 0 0 .75em; }
code, .mono { font-family: var(--font-mono); font-size: .86em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.hidden, [hidden] { display: none !important; }

/* --- каркас ---------------------------------------------------------------- */

.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; color: var(--text); padding: 0 6px; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand span { color: var(--accent); }

.cluster-switch select {
  width: 100%;
  background: var(--raised); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  padding: 7px 8px; font: inherit;
}
.cluster-switch .role { font-size: .8rem; color: var(--muted); padding: 4px 2px 0; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: .78rem; color: var(--faint); padding: 10px 8px 4px; }
.nav a {
  color: var(--muted); padding: 6px 8px; border-radius: var(--radius-s);
  border-left: 2px solid transparent;
}
.nav a:hover { color: var(--text); background: var(--raised); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--raised); border-left-color: var(--accent); }

.tz-note { margin-top: auto; font-size: .8rem; padding: 0 6px; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 8px 6px 0; border-top: 1px solid var(--line); }
.me img { width: 32px; height: 32px; border-radius: 50%; }
.me .who { flex: 1; min-width: 0; }
.me .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font: inherit; font-size: .85rem; }
.me button:hover { color: var(--text); }

.main { padding: 26px 32px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .grow { flex: 1; min-width: 200px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }

.topbar { display: none; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 30% 0 0; z-index: 30; transform: translateX(-102%); transition: transform .2s; height: 100vh; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.55); }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
  .main { padding: 18px 16px 48px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* --- кнопки и формы -------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-weight: 500; font-size: .92rem;
  padding: 7px 14px; border-radius: var(--radius-s);
  border: 1px solid var(--line-strong); background: var(--raised); color: var(--text);
  cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 14%, var(--raised)); border-color: var(--bad); }
.btn.small { padding: 3px 9px; font-size: .82rem; }
.btn.link { background: none; border-color: transparent; color: var(--accent); padding-left: 4px; padding-right: 4px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.table .btn-row { flex-wrap: nowrap; gap: 6px; }
.table .mono { white-space: nowrap; }
@media (max-width: 900px) { .table-wrap > .table { min-width: 760px; } }

input[type=text], input[type=number], input[type=search], input[type=password], input[type=datetime-local],
input:not([type]), select, textarea {
  width: 100%;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  padding: 7px 9px; font: inherit;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 20px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > label { font-size: .86rem; color: var(--muted); }
.field .help { font-size: .8rem; color: var(--faint); }
.field .errors { color: var(--bad); font-size: .84rem; }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.field.check > label { color: var(--text); font-size: .92rem; order: 2; }
.field.check .help { order: 3; flex-basis: 100%; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.checks div { display: contents; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px 18px; margin: 0 0 18px; }
legend { padding: 0 6px; color: var(--muted); font-size: .9rem; }

/* --- панели и таблицы ------------------------------------------------------ */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { flex: 1; }
.panel-body { padding: 14px 16px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 500; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: color-mix(in srgb, var(--raised) 55%, transparent); }
.table .sub { color: var(--muted); font-size: .82rem; }
.table .col-what { min-width: 170px; }
.table .col-result { min-width: 240px; max-width: 460px; }
.empty { padding: 26px 16px; color: var(--muted); text-align: center; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; border-bottom: 1px solid var(--line); }
.filters > input, .filters > select { width: auto; min-width: 140px; padding: 6px 9px; }
.filters > .grow-input { flex: 1 1 260px; }
.filters > .date-input { min-width: 0; width: 150px; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; white-space: nowrap; }

.pager { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between;
  padding: 10px 16px; color: var(--muted); font-size: .86rem; border-top: 1px solid var(--line); }
.pages { display: flex; flex-wrap: wrap; gap: 4px; }
.pages a, .pages span { min-width: 30px; padding: 3px 8px; text-align: center; border-radius: var(--radius-s);
  border: 1px solid var(--line); color: var(--text); }
.pages a:hover { border-color: var(--accent); text-decoration: none; }
.pages .current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pages .gap { border-color: transparent; color: var(--faint); }

.global-search input { padding: 7px 9px; font-size: .9rem; }

/* --- статусы --------------------------------------------------------------- */

.status { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; font-weight: 500; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.status.online { color: var(--ok); }
.status.starting, .status.stopping, .status.queued, .status.running, .status.sent, .status.pending { color: var(--warn); }
.status.frozen, .status.failed, .status.expired { color: var(--bad); }
.status.offline, .status.unknown, .status.cancelled { color: var(--off); }
.status.done { color: var(--ok); }
.status.online::before { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.tag { display: inline-block; white-space: nowrap; font-size: .78rem; padding: 1px 7px; border-radius: 10px; background: var(--raised); color: var(--muted); border: 1px solid var(--line); }
.tag.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.tag.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }

/* --- онлайн: плитки карт ---------------------------------------------------- */

.summary { display: flex; gap: 28px; flex-wrap: wrap; align-items: baseline; }
.summary .big { font-family: var(--font-head); font-size: 2.2rem; font-weight: 700; line-height: 1; }
.summary .big small { font-family: var(--font-body); font-size: .95rem; font-weight: 400; color: var(--muted); margin-left: 6px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--off); }
.tile.online::before { background: var(--ok); }
.tile.starting::before, .tile.stopping::before { background: var(--warn); }
.tile.frozen::before { background: var(--bad); }
.tile-head { padding: 14px 16px 10px 18px; display: flex; gap: 12px; align-items: flex-start; }
.tile-head .names { flex: 1; min-width: 0; }
.tile-head h3 { font-size: 1.02rem; }
.tile-head h3 a { color: var(--text); }
.tile-head .map { color: var(--muted); font-size: .82rem; margin-top: 2px; }
.tile-count { text-align: right; }
.tile-count .n { font-family: var(--font-head); font-size: 1.7rem; font-weight: 700; line-height: 1; }
.tile.offline .tile-count .n, .tile.unknown .tile-count .n { color: var(--faint); }
.tile-meta { padding: 0 16px 10px 18px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .82rem; color: var(--muted); }
.tile-op { margin: 0 16px 10px 18px; padding: 6px 10px; border-radius: var(--radius-s); background: color-mix(in srgb, var(--warn) 12%, var(--raised)); color: var(--warn); font-size: .84rem; }
.tile-op.error { background: color-mix(in srgb, var(--bad) 12%, var(--raised)); color: var(--bad); }
.roster { border-top: 1px solid var(--line); margin: 0; padding: 6px 0; list-style: none; max-height: 330px; overflow-y: auto; }
.roster li { display: flex; gap: 10px; align-items: baseline; padding: 4px 16px 4px 18px; font-size: .88rem; }
.roster li:hover { background: var(--raised); }
.roster a.pname, .roster a.tribe { color: inherit; }
.roster a.tribe { color: var(--muted); }
.roster a:hover { color: var(--accent-strong); }
.roster .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster .tribe { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.roster .since { color: var(--faint); font-size: .8rem; white-space: nowrap; }
.roster-empty { border-top: 1px solid var(--line); padding: 10px 18px 12px; color: var(--faint); font-size: .85rem; }

.live-note { font-size: .82rem; color: var(--faint); }
.live-note.stale { color: var(--warn); }

/* --- сервер ---------------------------------------------------------------- */

.server-head { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; }
.server-head .facts { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: .88rem; color: var(--muted); }
.server-head .facts b { color: var(--text); font-weight: 500; }

.console {
  background: #0d1416; border: 1px solid var(--line); border-radius: var(--radius-m);
  font-family: var(--font-mono); font-size: .84rem;
  display: flex; flex-direction: column;
}
.console-log { max-height: 420px; min-height: 160px; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.console-entry .cmdline { color: var(--accent); white-space: pre-wrap; word-break: break-word; }
.console-entry .cmdline .who { color: var(--faint); }
.console-entry pre { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; color: var(--text); font: inherit; }
.console-entry .pending { color: var(--warn); }
.console-entry .fail { color: var(--bad); }
.console form { display: flex; border-top: 1px solid var(--line); }
.console input { border: 0; border-radius: 0 0 0 var(--radius-m); background: transparent; font-family: var(--font-mono); padding: 10px 14px; }
.console button { border-radius: 0 0 var(--radius-m) 0; border: 0; border-left: 1px solid var(--line); }

.spark { width: 100%; height: 64px; display: block; }
.spark path.area { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.spark path.line { fill: none; stroke: var(--accent); stroke-width: 1.5; }

/* --- диалоги и уведомления ------------------------------------------------- */

dialog {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius-m);
  padding: 0; width: min(480px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(4, 10, 12, .65); }
dialog form { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
dialog h2 { font-size: 1.05rem; }
dialog .what { color: var(--muted); font-size: .9rem; margin: 0; }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  background: var(--raised); border: 1px solid var(--line-strong); border-left: 3px solid var(--accent);
  border-radius: var(--radius-s); padding: 9px 14px; max-width: 380px; font-size: .9rem;
  animation: toast-in .2s ease-out;
}
.toast.error { border-left-color: var(--bad); }
.toast.warning { border-left-color: var(--warn); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

.notice { padding: 10px 14px; border-radius: var(--radius-s); background: var(--raised); border: 1px solid var(--line); font-size: .9rem; }
.notice.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.notice.bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.secret { font-family: var(--font-mono); background: #0d1416; padding: 10px 12px; border-radius: var(--radius-s); border: 1px dashed var(--accent); word-break: break-all; user-select: all; }

/* --- вход ------------------------------------------------------------------ */

.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 500px at 15% 110%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    var(--bg);
}
.login-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 18px; }
.login-card h1 { font-size: 2rem; }
.login-card h1 span { color: var(--accent); }
.steam-btn { justify-content: center; padding: 11px 18px; font-size: 1rem; }
