/* AXI0MA Control — premium dark + gold, mobile-first, Telegram WebView */
:root {
  --bg: #0a0b0d;
  --bg2: #101216;
  --card: linear-gradient(180deg, #16181e 0%, #111318 100%);
  --card2: #14161b;
  --border: #23262e;
  --border2: #2c3039;
  --text: #eef1f6;
  --muted: #98a1b3;
  --dim: #6b7484;
  --gold: #d4b06a;
  --gold2: #e9cd8f;
  --gold-dim: rgba(212, 176, 106, .14);
  --ok: #46b96a;
  --warn: #d9a441;
  --crit: #e5534b;
  --radius: 18px;
  --radius-s: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 62px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); overflow-x: hidden; }
body {
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 10px;
  background: linear-gradient(180deg, rgba(10,11,13,.97) 70%, rgba(10,11,13,.82));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid #1a1d23;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); box-shadow: 0 0 0 4px rgba(255,255,255,.03); flex: 0 0 auto; }
.brand-dot.ok { background: var(--ok); box-shadow: 0 0 10px rgba(70,185,106,.65); }
.brand-dot.warn { background: var(--warn); }
.brand-dot.crit { background: var(--crit); box-shadow: 0 0 10px rgba(229,83,75,.6); }
.brand-title { font-size: 14px; font-weight: 700; letter-spacing: .14em; }
.brand-sub { font-size: 11px; color: var(--dim); margin-top: 1px; }
.gold { color: var(--gold); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card2); color: var(--muted); display: grid; place-items: center; flex: 0 0 auto;
}
.icon-btn svg { width: 19px; height: 19px; fill: currentColor; }
.icon-btn:active { transform: scale(.94); color: var(--gold); }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.view { flex: 1; padding: 12px 14px calc(var(--nav-h) + var(--safe-b) + 18px); }
.section-label {
  font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim);
  margin: 18px 4px 8px; display: flex; align-items: center; justify-content: space-between;
}
.section-label:first-child { margin-top: 4px; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; margin-bottom: 11px; position: relative; overflow: hidden;
}
.card.tap:active { transform: scale(.985); border-color: var(--border2); }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); letter-spacing: .05em; margin-bottom: 10px; }
.card-title .sp { flex: 1; }
.card-title .badge { font-size: 10.5px; }
.hero { background: linear-gradient(160deg, #1a1c22 0%, #121419 70%); }
.hero::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; background: linear-gradient(90deg, transparent, rgba(212,176,106,.55), transparent); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); display: inline-block; flex: 0 0 auto; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px rgba(70,185,106,.6); }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); box-shadow: 0 0 8px rgba(229,83,75,.5); }
.dot.gold { background: var(--gold); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border2); color: var(--muted); background: rgba(255,255,255,.02);
  white-space: nowrap;
}
.badge.ok { color: #8fe0a8; border-color: rgba(70,185,106,.35); background: rgba(70,185,106,.08); }
.badge.warn { color: #ecc27a; border-color: rgba(217,164,65,.35); background: rgba(217,164,65,.08); }
.badge.crit { color: #f09a94; border-color: rgba(229,83,75,.4); background: rgba(229,83,75,.09); }
.badge.gold { color: var(--gold2); border-color: rgba(212,176,106,.4); background: var(--gold-dim); }

.big { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.big small { font-size: 13px; color: var(--dim); font-weight: 500; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.mono { font-variant-numeric: tabular-nums; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 13.5px; border-bottom: 1px solid rgba(255,255,255,.035); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { text-align: right; word-break: break-word; }

/* progress bars */
.bar { height: 7px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; margin: 7px 0 5px; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--gold2)); transition: width .5s ease; }
.bar.ok > i { background: linear-gradient(90deg, #2f8f4e, var(--ok)); }
.bar.warn > i { background: linear-gradient(90deg, #a87b2a, var(--warn)); }
.bar.crit > i { background: linear-gradient(90deg, #a83a34, var(--crit)); }
.bar.gold > i { background: linear-gradient(90deg, #a8874b, var(--gold2)); }

/* server rows / preview */
.srv-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.srv-row:last-child { border-bottom: 0; }
.srv-ic { width: 34px; height: 34px; border-radius: 11px; background: var(--card2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--gold); flex: 0 0 auto; }
.srv-ic svg { width: 17px; height: 17px; fill: currentColor; }
.srv-main { flex: 1; min-width: 0; }
.srv-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srv-sub { font-size: 11.5px; color: var(--dim); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11px; padding: 3px 9px; border-radius: 9px; background: rgba(255,255,255,.03); border: 1px solid var(--border); color: var(--muted); }
.chip.on { color: #8fe0a8; border-color: rgba(70,185,106,.3); }
.chip.off { color: #8b93a3; opacity: .65; }
.chip.gold { color: var(--gold2); border-color: rgba(212,176,106,.35); }

/* events */
.ev { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.04); font-size: 13px; }
.ev:last-child { border-bottom: 0; }
.ev .t { color: var(--dim); font-size: 11px; flex: 0 0 86px; padding-top: 2px; }
.ev .x { flex: 1; min-width: 0; }
.ev .x .kind { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; margin-right: 6px; }
.kind.backup { color: var(--gold); }
.kind.systemd { color: #79b8ff; }
.kind.failed { color: var(--crit); }

/* skeleton */
.skel { position: relative; overflow: hidden; background: #14161b; border-radius: 10px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.045), transparent);
  animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-card { height: 118px; border-radius: var(--radius); margin-bottom: 11px; }
.skel-line { height: 14px; margin: 9px 0; }
.skel-line.w60 { width: 60%; }

/* states */
.empty { text-align: center; color: var(--dim); padding: 30px 10px; font-size: 13.5px; }
.empty .big2 { font-size: 34px; margin-bottom: 8px; opacity: .5; }
.err-banner { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: #f09a94; background: rgba(229,83,75,.08); border: 1px solid rgba(229,83,75,.25); border-radius: 12px; padding: 9px 12px; margin-bottom: 10px; }
.stale { color: var(--warn); font-size: 11px; }

/* bottom nav */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around;
  padding: 8px 6px calc(var(--safe-b) + 8px);
  background: rgba(13,14,17,.94); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid #1c1f25;
}
.nav-btn {
  appearance: none; border: 0; background: transparent; color: var(--dim);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font: inherit; font-size: 10.5px; padding: 4px 10px; border-radius: 12px; min-width: 58px;
}
.nav-btn svg { width: 23px; height: 23px; fill: currentColor; }
.nav-btn.active { color: var(--gold); }
.nav-btn.active svg { filter: drop-shadow(0 0 6px rgba(212,176,106,.35)); }
.nav-btn:active { transform: scale(.93); }

/* overlay (detail) */
.overlay { position: fixed; inset: 0; z-index: 60; background: var(--bg); overflow-y: auto;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px calc(var(--safe-b) + 20px); }
.overlay.hidden { display: none; }
.ov-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ov-head h2 { font-size: 17px; margin: 0; flex: 1; min-width: 0; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); transform: translateX(-50%);
  background: #1c1f26; border: 1px solid var(--border2); color: var(--text); font-size: 12.5px;
  padding: 8px 14px; border-radius: 12px; z-index: 80; max-width: 86vw; text-align: center; }
.toast.hidden { display: none; }

.fade-in { animation: fadeIn .28s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
