/* Sonagi Service Manager */
:root {
  --bg: #070b13;
  --bg-soft: #0b1220;
  --panel: rgba(15, 24, 40, 0.82);
  --panel-solid: #0f1828;
  --panel-2: #121e31;
  --border: #22314b;
  --border-soft: rgba(83, 112, 153, 0.22);
  --text: #edf4ff;
  --text-soft: #c6d3e6;
  --muted: #8fa3c0;
  --faint: #607491;
  --accent: #57d6ff;
  --accent-2: #8b6cff;
  --accent-3: #2dd4bf;
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.14);
  --red: #fb7185;
  --red-soft: rgba(251, 113, 133, 0.14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --blue-soft: rgba(87, 214, 255, 0.12);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-width: 286px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 560px at 12% -8%, rgba(87, 214, 255, 0.11), transparent 60%),
    radial-gradient(800px 520px at 96% 8%, rgba(139, 108, 255, 0.11), transparent 62%),
    radial-gradient(700px 500px at 50% 110%, rgba(45, 212, 191, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 20%, black, transparent 78%);
  z-index: 0;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3, h4, p { margin: 0; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- layout */
.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px 18px 18px;
  background: linear-gradient(180deg, rgba(13, 21, 36, 0.96), rgba(8, 13, 23, 0.96));
  border-right: 1px solid var(--border-soft);
  backdrop-filter: blur(18px);
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 6px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.brand-icon { width: 42px; height: 42px; border-radius: 12px; box-shadow: 0 0 26px rgba(87, 214, 255, 0.18); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 20px; letter-spacing: 0.06em; font-weight: 750; }
.brand-text span { font-size: 11px; color: var(--muted); letter-spacing: 0.18em; text-transform: uppercase; }
.icon-btn.sidebar-close { display: none; margin-left: auto; }

.sidebar-section { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.section-head .icon-btn { width: 28px; height: 28px; border-radius: 9px; }

.server-section { flex: 1; overflow: hidden; }
.server-list { display: flex; flex-direction: column; gap: 7px; overflow-y: auto; padding: 2px 2px 8px; scrollbar-width: thin; }

.server-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 10px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.server-item:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--border-soft); }
.server-item.active {
  background: linear-gradient(135deg, rgba(87, 214, 255, 0.13), rgba(139, 108, 255, 0.11));
  border-color: rgba(87, 214, 255, 0.32);
  box-shadow: inset 0 0 0 1px rgba(87, 214, 255, 0.06), 0 10px 30px rgba(0, 0, 0, 0.18);
  color: var(--text);
}
.server-item.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.server-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(87, 214, 255, 0.1);
  color: var(--accent);
  border: 1px solid rgba(87, 214, 255, 0.15);
}
.server-item.active .server-avatar { background: rgba(87, 214, 255, 0.18); }
.server-meta { min-width: 0; display: flex; flex-direction: column; }
.server-name { font-weight: 650; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-host { color: var(--faint); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-badges { display: flex; align-items: center; gap: 5px; }
.mini-badge {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(87, 214, 255, 0.12);
  color: var(--accent);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.server-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.server-dot.online { background: var(--green); box-shadow: 0 0 10px rgba(52, 211, 153, 0.7); }
.server-dot.offline { background: var(--red); }
.server-edit { opacity: 0; width: 26px; height: 26px; border-radius: 8px; color: var(--muted); }
.server-item:hover .server-edit { opacity: 1; }
.server-edit:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

.add-server-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px dashed rgba(143, 163, 192, 0.3);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  transition: all 0.16s ease;
}
.add-server-card:hover { border-color: var(--accent); color: var(--accent); background: rgba(87, 214, 255, 0.05); }

.sidebar-hint {
  display: flex;
  gap: 9px;
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-soft);
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.45;
}
.hint-icon { flex: 0 0 auto; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--faint); font-size: 10px; font-weight: 700; margin-top: 1px; }

.sidebar-footer { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; background: linear-gradient(135deg, rgba(87,214,255,.22), rgba(139,108,255,.22)); color: var(--accent); font-weight: 800; border: 1px solid rgba(87,214,255,.18); }
.user-chip div { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-chip strong { font-size: 12.5px; }
.user-chip span { color: var(--faint); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.footer-actions { display: flex; gap: 6px; }
.footer-actions form { flex: 1; }
.footer-actions .btn { width: 100%; }
.version-line { color: #4d5f79; font-size: 10px; text-align: center; letter-spacing: .03em; }

.main { min-width: 0; display: flex; flex-direction: column; }
.sidebar-backdrop { display: none; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 34px;
  background: rgba(7, 11, 19, 0.72);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(18px);
}
.icon-btn.mobile-menu { display: none; }
.page-heading { min-width: 0; flex: 1; }
.eyebrow { color: var(--faint); font-size: 10.5px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-heading h1 { font-size: 21px; font-weight: 720; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.connection-state { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.035); border: 1px solid var(--border-soft); color: var(--muted); font-size: 11.5px; }
.connection-state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.connection-state.online { color: var(--green); border-color: rgba(52,211,153,.25); background: var(--green-soft); }
.connection-state.online .dot { background: var(--green); box-shadow: 0 0 9px rgba(52,211,153,.8); animation: pulse 2.4s infinite; }
.connection-state.offline { color: var(--red); border-color: rgba(251,113,133,.25); background: var(--red-soft); }
.connection-state.offline .dot { background: var(--red); }
.last-updated { color: var(--faint); font-size: 11px; white-space: nowrap; }

.content { width: 100%; max-width: 1560px; margin: 0 auto; padding: 28px 34px 50px; display: flex; flex-direction: column; gap: 28px; }
.section-title { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.section-title h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.section-title .muted { font-size: 11.5px; }
.section-title .spacer { flex: 1; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.035);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.btn:hover { background: rgba(255,255,255,.065); border-color: #2c405f; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #32bce8, #6d68f5); border-color: transparent; color: #04111b; font-weight: 750; box-shadow: 0 8px 24px rgba(87,214,255,.18); }
.btn-primary:hover { color: #04111b; filter: brightness(1.07); }
.btn-danger { background: var(--red-soft); border-color: rgba(251,113,133,.32); color: #ffb1bd; }
.btn-danger:hover { background: rgba(251,113,133,.22); color: #ffd0d7; }
.btn-success { background: var(--green-soft); border-color: rgba(52,211,153,.3); color: #9ff3d7; }
.btn-success:hover { background: rgba(52,211,153,.22); color: #c8ffe9; }
.btn-ghost { background: transparent; }
.btn-small { min-height: 29px; padding: 5px 9px; font-size: 11.5px; border-radius: 8px; }
.btn-icon { width: 34px; height: 34px; padding: 0; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}
.icon-btn:hover { background: rgba(255,255,255,.06); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* ----------------------------------------------------------------- cards */
.card {
  position: relative;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(18, 30, 49, 0.82), rgba(12, 20, 34, 0.86));
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(255,255,255,.035), transparent 34%);
}
.overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { padding: 18px; min-height: 214px; display: flex; flex-direction: column; }
.metric-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; position: relative; z-index: 1; }
.metric-label { display: flex; align-items: center; gap: 8px; color: var(--text-soft); font-size: 12px; font-weight: 650; letter-spacing: .02em; }
.metric-label .label-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--blue-soft); color: var(--accent); }
.metric-label .label-icon svg { width: 15px; height: 15px; }
.metric-open { font-size: 10.5px; color: var(--accent); border: 1px solid rgba(87,214,255,.22); background: rgba(87,214,255,.06); border-radius: 7px; padding: 4px 7px; }
.metric-open:hover { background: rgba(87,214,255,.14); }
.metric-body { position: relative; z-index: 1; flex: 1; display: flex; align-items: center; gap: 16px; margin-top: 12px; }
.ring {
  --pct: 0;
  --ring-color: var(--accent);
  position: relative;
  flex: 0 0 auto;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), rgba(255,255,255,.065) 0);
  display: grid;
  place-items: center;
  transition: background .35s ease;
}
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--panel-solid); box-shadow: inset 0 0 20px rgba(0,0,0,.35); }
.ring-inner { position: relative; text-align: center; line-height: 1.1; }
.ring-value { font-size: 24px; font-weight: 760; letter-spacing: -0.04em; }
.ring-value small { font-size: 11px; font-weight: 650; color: var(--muted); margin-left: 1px; }
.ring-sub { color: var(--faint); font-size: 10px; margin-top: 5px; }
.metric-details { display: flex; flex-direction: column; gap: 7px; min-width: 0; flex: 1; }
.detail-row { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11.5px; }
.detail-row strong { color: var(--text-soft); font-weight: 600; text-align: right; }
.metric-foot { position: relative; z-index: 1; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--border-soft); color: var(--faint); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.temp-list { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; width: 100%; }
.temp-item { padding: 8px 9px; border-radius: 10px; background: rgba(255,255,255,.03); border: 1px solid var(--border-soft); }
.temp-item .temp-name { display: block; color: var(--faint); font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.temp-item .temp-value { display: flex; align-items: baseline; gap: 3px; font-weight: 700; font-size: 16px; letter-spacing: -.02em; }
.temp-item .temp-value small { font-size: 10px; color: var(--muted); font-weight: 500; }
.temp-item.warm .temp-value { color: var(--amber); }
.temp-item.hot .temp-value { color: var(--red); }

.disk-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.disk-row:last-child { margin-bottom: 0; }
.disk-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.disk-head strong { color: var(--text-soft); }
.bar { height: 7px; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s ease; }
.bar.warn > span { background: linear-gradient(90deg, var(--amber), #fb923c); }
.bar.danger > span { background: linear-gradient(90deg, var(--red), #f43f5e); }

/* --------------------------------------------------------------- services */
.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.service-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.service-card:hover { border-color: #2a405f; transform: translateY(-1px); box-shadow: 0 20px 45px rgba(0,0,0,.24); }
.service-top { display: flex; align-items: flex-start; gap: 11px; position: relative; z-index: 1; }
.service-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(87,214,255,.08); border: 1px solid rgba(87,214,255,.13); color: var(--accent); flex: 0 0 auto; }
.service-icon svg { width: 20px; height: 20px; }
.service-icon.flaskfarm { color: #f7b955; background: rgba(247,185,85,.08); border-color: rgba(247,185,85,.15); }
.service-icon.plex { color: #f5c451; background: rgba(245,196,81,.08); border-color: rgba(245,196,81,.15); }
.service-icon.shyni { color: #b592ff; background: rgba(181,146,255,.09); border-color: rgba(181,146,255,.16); }
.service-title { min-width: 0; flex: 1; }
.service-title h3 { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.service-sub { display: flex; align-items: center; gap: 6px; margin-top: 2px; color: var(--faint); font-size: 10.5px; }
.kind-badge { padding: 1px 5px; border-radius: 5px; border: 1px solid var(--border-soft); color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 999px; font-size: 9.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.status-pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-pill.running { color: var(--green); background: var(--green-soft); border: 1px solid rgba(52,211,153,.18); }
.status-pill.stopped { color: var(--muted); background: rgba(255,255,255,.04); border: 1px solid var(--border-soft); }
.status-pill.warning { color: var(--amber); background: var(--amber-soft); border: 1px solid rgba(251,191,36,.18); }
.status-pill.error { color: var(--red); background: var(--red-soft); border: 1px solid rgba(251,113,133,.18); }
.status-pill.unknown { color: var(--faint); background: rgba(255,255,255,.03); border: 1px solid var(--border-soft); }

.service-meta { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 11px 12px; border-radius: 11px; background: rgba(0,0,0,.14); border: 1px solid var(--border-soft); }
.meta-item { min-width: 0; }
.meta-item span { display: block; color: var(--faint); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 2px; }
.meta-item strong { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta-item.full { grid-column: 1 / -1; }
.service-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.service-actions .btn { flex: 1; min-width: 66px; }
.service-actions .btn.update { flex-basis: 100%; color: var(--accent); border-color: rgba(87,214,255,.22); background: rgba(87,214,255,.05); }
.service-actions .btn.update:hover { background: rgba(87,214,255,.11); }
.health-note { display: flex; align-items: center; gap: 5px; color: var(--amber); font-size: 10px; }
.other-services { margin-top: 18px; border: 1px solid var(--border-soft); border-radius: 14px; background: rgba(255,255,255,.018); overflow: hidden; }
.other-head { display: flex; align-items: center; gap: 8px; padding: 12px 15px; width: 100%; background: transparent; border: 0; color: var(--muted); text-align: left; }
.other-head:hover { background: rgba(255,255,255,.025); }
.other-head .count { margin-left: auto; color: var(--faint); font-size: 11px; }
.other-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 14px 14px; }
.other-service { display: flex; align-items: center; gap: 10px; padding: 10px 11px; border: 1px solid var(--border-soft); border-radius: 10px; background: rgba(0,0,0,.1); }
.other-service .service-icon { width: 30px; height: 30px; border-radius: 9px; }
.other-service .service-icon svg { width: 15px; height: 15px; }
.other-service .other-info { flex: 1; min-width: 0; }
.other-service .other-info strong { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.other-service .other-info span { display: block; color: var(--faint); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.other-service .status-pill { font-size: 8.5px; }

/* ---------------------------------------------------------------- skeleton */
.skeleton { position: relative; overflow: hidden; background: rgba(255,255,255,.035); }
.skeleton::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.06) 50%, transparent 80%); animation: shimmer 1.7s infinite; transform: translateX(-100%); }
.skeleton-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.skeleton-grid .skeleton { height: 214px; }
.service-skeleton { height: 250px; }
.spin { animation: spin .9s linear infinite; }

/* ------------------------------------------------------------------ modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(2, 6, 12, 0.72);
  backdrop-filter: blur(8px);
  animation: fadeIn .16s ease;
}
.modal {
  width: min(620px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  border: 1px solid #2a3b57;
  border-radius: 20px;
  background: linear-gradient(165deg, #121d2f, #0b1321 60%);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,.02) inset;
  overflow: hidden;
  animation: modalIn .2s cubic-bezier(.2,.8,.2,1);
}
.modal.wide { width: min(760px, 100%); }
.modal.narrow { width: min(450px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 15px; border-bottom: 1px solid var(--border-soft); }
.modal-title { flex: 1; min-width: 0; }
.modal-title h3 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.modal-title p { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.modal-close { flex: 0 0 auto; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-body::-webkit-scrollbar, .server-list::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-thumb, .server-list::-webkit-scrollbar-thumb { background: rgba(143,163,192,.24); border-radius: 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 15px 22px 20px; border-top: 1px solid var(--border-soft); background: rgba(0,0,0,.08); }
.modal-foot .left { margin-right: auto; }

/* ------------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--text-soft); font-size: 11.5px; font-weight: 600; }
.field small { color: var(--faint); font-size: 10.5px; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], textarea, select {
  width: 100%;
  min-height: 39px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0,0,0,.18);
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:focus, textarea:focus, select:focus { border-color: rgba(87,214,255,.52); box-shadow: 0 0 0 3px rgba(87,214,255,.1); background: rgba(0,0,0,.26); }
input::placeholder, textarea::placeholder { color: #566984; }
textarea { resize: vertical; min-height: 68px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .third { grid-column: span 1; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 60px; }
.password-toggle { position: absolute; right: 5px; top: 5px; bottom: 5px; padding: 0 9px; border: 0; border-radius: 7px; background: rgba(255,255,255,.04); color: var(--muted); font-size: 10.5px; }
.password-toggle:hover { background: rgba(255,255,255,.08); color: var(--text); }
.alert { padding: 10px 12px; border-radius: 10px; font-size: 12px; display: flex; gap: 8px; align-items: flex-start; }
.alert-error { background: var(--red-soft); border: 1px solid rgba(251,113,133,.25); color: #ffb6c0; }
.alert-info { background: var(--blue-soft); border: 1px solid rgba(87,214,255,.2); color: #b5ecff; }
.alert-warn { background: var(--amber-soft); border: 1px solid rgba(251,191,36,.24); color: #ffe6a3; }
.alert-success { background: var(--green-soft); border: 1px solid rgba(52,211,153,.22); color: #a8f5dc; }
.form-note { color: var(--faint); font-size: 11px; line-height: 1.5; }
.form-status { font-size: 11.5px; min-height: 17px; }
.form-status.ok { color: var(--green); }
.form-status.err { color: var(--red); }
.server-form-actions { display: flex; gap: 8px; align-items: center; }
.server-form-actions .spacer { flex: 1; }

/* ------------------------------------------------------------- update view */
.update-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 170px; color: var(--muted); font-size: 12px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(87,214,255,.12); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.update-banner { display: flex; align-items: center; gap: 11px; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--border-soft); background: rgba(255,255,255,.025); margin-bottom: 16px; }
.update-banner .banner-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto; }
.update-banner strong { display: block; font-size: 13px; }
.update-banner span { display: block; color: var(--muted); font-size: 11px; }
.update-banner.available { border-color: rgba(251,191,36,.28); background: var(--amber-soft); }
.update-banner.available .banner-icon { background: rgba(251,191,36,.16); color: var(--amber); }
.update-banner.current { border-color: rgba(52,211,153,.25); background: var(--green-soft); }
.update-banner.current .banner-icon { background: rgba(52,211,153,.14); color: var(--green); }
.update-banner.unknown { border-color: rgba(143,163,192,.22); background: rgba(255,255,255,.025); }
.update-banner.unknown .banner-icon { background: rgba(143,163,192,.12); color: var(--muted); }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare-card { padding: 13px; border: 1px solid var(--border-soft); border-radius: 12px; background: rgba(0,0,0,.12); min-width: 0; }
.compare-card .compare-label { display: flex; justify-content: space-between; color: var(--faint); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.compare-card .compare-version { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compare-card .compare-source { color: var(--muted); font-size: 10px; margin-top: 3px; }
.compare-card dl { margin: 10px 0 0; display: flex; flex-direction: column; gap: 5px; }
.compare-card dl div { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; }
.compare-card dt { color: var(--faint); flex: 0 0 auto; }
.compare-card dd { margin: 0; color: var(--text-soft); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: "SFMono-Regular", Consolas, monospace; font-size: 9.5px; }
.update-notes { margin-top: 13px; display: flex; flex-direction: column; gap: 6px; }
.update-notes .note { display: flex; gap: 6px; color: var(--muted); font-size: 11px; }
.update-notes .note::before { content: "•"; color: var(--faint); }
.release-notes { margin-top: 13px; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border-soft); background: rgba(0,0,0,.1); color: var(--muted); font-size: 11px; max-height: 100px; overflow: auto; white-space: pre-line; }
.update-warning { margin-top: 14px; }

.job-console { margin-top: 12px; border: 1px solid #26364f; border-radius: 12px; background: #060b14; overflow: hidden; }
.job-console-head { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-bottom: 1px solid #1d2a3e; color: var(--faint); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.job-console-head .lights { display: flex; gap: 4px; margin-right: 4px; }
.job-console-head .lights i { width: 6px; height: 6px; border-radius: 50%; background: #2f4058; }
.job-console-body { height: 210px; overflow-y: auto; padding: 10px 12px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 10.5px; line-height: 1.6; color: #a9c0dc; }
.job-console-body .log-line { white-space: pre-wrap; word-break: break-all; }
.job-console-body .log-time { color: #4f6785; margin-right: 7px; }
.job-state { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.job-state.success { color: var(--green); }
.job-state.error { color: var(--red); }
.job-state .spinner { width: 14px; height: 14px; border-width: 2px; }

/* --------------------------------------------------------------- live popup */
.live-window { width: min(820px, 100%); }
.live-window .modal-head { padding: 14px 18px 12px; background: linear-gradient(180deg, rgba(255,255,255,.035), transparent); }
.window-dots { display: flex; gap: 5px; margin-right: 2px; }
.window-dots i { width: 7px; height: 7px; border-radius: 50%; background: #2c405e; }
.window-dots i:first-child { background: #fb7185; }
.window-dots i:nth-child(2) { background: #fbbf24; }
.window-dots i:nth-child(3) { background: #34d399; }
.live-body { padding: 16px 18px 18px; }
.live-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.live-metric { padding: 12px 14px; border: 1px solid var(--border-soft); border-radius: 12px; background: rgba(0,0,0,.14); }
.live-metric-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10.5px; }
.live-metric-value { display: flex; align-items: baseline; gap: 4px; font-size: 29px; font-weight: 760; letter-spacing: -.04em; line-height: 1.2; }
.live-metric-value small { color: var(--muted); font-size: 12px; font-weight: 500; }
.live-metric-foot { color: var(--faint); font-size: 10px; }
.spark-wrap { height: 46px; margin-top: 4px; }
.spark-wrap svg { width: 100%; height: 100%; overflow: visible; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: url(#sparkGradient); stroke: none; }
.spark-line.ram { stroke: var(--accent-2); }
.live-service-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 7px; color: var(--faint); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.live-service-head .muted { font-size: 9.5px; letter-spacing: 0; text-transform: none; }
.live-service-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.live-service-row { display: grid; grid-template-columns: minmax(130px, 1.1fr) minmax(90px, 1.5fr) minmax(92px, .8fr); align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--border-soft); border-radius: 9px; background: rgba(255,255,255,.018); }
.live-service-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.live-service-icon { display: grid; place-items: center; width: 23px; height: 23px; flex: 0 0 23px; border-radius: 7px; background: rgba(87,214,255,.09); color: var(--accent); }
.live-service-icon svg { width: 13px; height: 13px; }
.live-service-label { display: flex; flex-direction: column; min-width: 0; color: var(--text-soft); font-size: 11px; font-weight: 600; line-height: 1.25; }
.live-service-label small { color: var(--faint); font-size: 9px; font-weight: 500; }
.live-service-bar { height: 5px; border-radius: 99px; background: rgba(255,255,255,.05); overflow: hidden; }
.live-service-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2f8fff, #57d6ff); transition: width .35s ease; }
.live-service-bar.ram span { background: linear-gradient(90deg, #6d55d8, #a78bfa); }
.live-service-value { display: flex; flex-direction: column; align-items: flex-end; color: var(--text); font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.live-service-value small { color: var(--faint); font-size: 9px; font-weight: 500; }
.live-service-empty { padding: 12px; border: 1px dashed var(--border-soft); border-radius: 9px; color: var(--muted); font-size: 11px; text-align: center; }
.live-top-service { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-top-service small { color: var(--faint); font-size: 9px; margin-left: 4px; }
.live-table-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 7px; color: var(--faint); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.live-live-dot { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-size: 9.5px; letter-spacing: .08em; }
.live-live-dot i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse 1.6s infinite; }
.live-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.live-table th { color: var(--faint); font-weight: 600; font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--border-soft); }
.live-table th:first-child, .live-table td:first-child { text-align: left; }
.live-table td { padding: 7px 8px; border-bottom: 1px solid rgba(34,49,75,.5); color: var(--text-soft); text-align: right; font-variant-numeric: tabular-nums; }
.live-table tr:first-child td { color: var(--text); background: rgba(87,214,255,.03); }
.live-table tr:first-child td:first-child { border-radius: 6px 0 0 6px; }
.live-table tr:first-child td:last-child { border-radius: 0 6px 6px 0; }
.live-table tbody tr { animation: rowIn .2s ease; }
.live-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.live-foot .muted { font-size: 10.5px; }
.live-foot .spacer { flex: 1; }

/* ---------------------------------------------------------------- dialogs */
.confirm-overlay { z-index: 200; }
.confirm-message { color: var(--text-soft); font-size: 13px; line-height: 1.6; white-space: pre-line; }
.error-panel { padding: 36px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 11px; }
.error-panel .error-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--red-soft); color: var(--red); }
.error-panel h3 { font-size: 16px; }
.error-panel p { color: var(--muted); font-size: 12px; max-width: 500px; }
.error-panel .btn { margin-top: 5px; }

/* ----------------------------------------------------------------- toasts */
.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: 9px; min-width: 250px; max-width: 380px; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: 12px; background: #111c2d; box-shadow: var(--shadow);
  color: var(--text-soft); font-size: 12px; pointer-events: auto; animation: toastIn .22s ease;
}
.toast.success { border-color: rgba(52,211,153,.3); }
.toast.error { border-color: rgba(251,113,133,.35); }
.toast.warn { border-color: rgba(251,191,36,.32); }
.toast .toast-icon { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; }
.toast.success .toast-icon { color: var(--green); }
.toast.error .toast-icon { color: var(--red); }
.toast.warn .toast-icon { color: var(--amber); }
.toast .toast-close { margin-left: auto; color: var(--faint); background: none; border: 0; font-size: 14px; line-height: 1; padding: 0 2px; }

/* ------------------------------------------------------------------ login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 600px at 18% 20%, rgba(87,214,255,.13), transparent 58%),
    radial-gradient(800px 600px at 86% 72%, rgba(139,108,255,.14), transparent 60%),
    #060a12;
  padding: 30px;
  overflow: hidden;
}
.login-rain { position: fixed; inset: 0; pointer-events: none; overflow: hidden; opacity: .5; }
.login-rain span { position: absolute; top: -20%; width: 1px; height: 90px; background: linear-gradient(180deg, transparent, rgba(87,214,255,.5)); animation: rain linear infinite; }
.login-rain span:nth-child(1) { left: 8%; animation-duration: 3.6s; animation-delay: .2s; }
.login-rain span:nth-child(2) { left: 21%; animation-duration: 4.8s; animation-delay: 1.1s; }
.login-rain span:nth-child(3) { left: 36%; animation-duration: 3.1s; animation-delay: .7s; }
.login-rain span:nth-child(4) { left: 52%; animation-duration: 5.2s; animation-delay: 2s; }
.login-rain span:nth-child(5) { left: 68%; animation-duration: 4.1s; animation-delay: .4s; }
.login-rain span:nth-child(6) { left: 79%; animation-duration: 3.8s; animation-delay: 1.6s; }
.login-rain span:nth-child(7) { left: 90%; animation-duration: 4.6s; animation-delay: .9s; }
.login-rain span:nth-child(8) { left: 45%; animation-duration: 3.4s; animation-delay: 2.4s; }
.login-shell { position: relative; z-index: 1; width: min(1050px, 100%); min-height: 600px; display: grid; grid-template-columns: 1.1fr .9fr; border: 1px solid rgba(83,112,153,.24); border-radius: 26px; overflow: hidden; box-shadow: 0 40px 100px rgba(0,0,0,.5); background: rgba(10,16,28,.65); backdrop-filter: blur(18px); }
.login-brand { position: relative; padding: 52px; display: flex; flex-direction: column; background: linear-gradient(145deg, rgba(87,214,255,.08), rgba(139,108,255,.08) 55%, rgba(8,13,23,.2)); border-right: 1px solid rgba(83,112,153,.18); overflow: hidden; }
.login-brand::after { content: ""; position: absolute; width: 420px; height: 420px; right: -160px; bottom: -180px; border-radius: 50%; border: 1px solid rgba(87,214,255,.15); box-shadow: 0 0 0 45px rgba(87,214,255,.025), 0 0 0 90px rgba(139,108,255,.02); }
.login-logo { display: flex; align-items: center; gap: 14px; }
.login-logo img { width: 58px; height: 58px; border-radius: 16px; box-shadow: 0 0 35px rgba(87,214,255,.2); }
.login-logo h1 { font-size: 30px; letter-spacing: .04em; line-height: 1; font-weight: 780; }
.login-logo p { color: var(--muted); font-size: 11px; letter-spacing: .24em; text-transform: uppercase; margin-top: 5px; }
.login-copy { margin-top: auto; margin-bottom: auto; padding: 40px 0; }
.login-copy h2 { font-size: clamp(30px, 3vw, 42px); line-height: 1.25; letter-spacing: -.035em; font-weight: 760; }
.login-copy h2::after { content: ""; display: block; width: 44px; height: 3px; border-radius: 3px; margin-top: 20px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.login-copy p { color: var(--muted); max-width: 390px; margin-top: 20px; font-size: 13px; line-height: 1.75; }
.login-features { display: flex; flex-wrap: wrap; gap: 7px; position: relative; z-index: 1; }
.login-features span { padding: 5px 9px; border-radius: 7px; border: 1px solid rgba(87,214,255,.16); background: rgba(87,214,255,.05); color: #a9dff2; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.login-panel { display: grid; place-items: center; padding: 42px; }
.login-card { width: 100%; max-width: 355px; }
.login-card-head { margin-bottom: 24px; }
.login-badge { display: inline-block; padding: 3px 7px; border-radius: 5px; background: rgba(139,108,255,.14); border: 1px solid rgba(139,108,255,.28); color: #c3b2ff; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.login-card-head h2 { font-size: 23px; margin-top: 12px; letter-spacing: -.02em; }
.login-card-head p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 15px; }
.login-form .field > span { color: var(--muted); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; }
.login-form input { min-height: 44px; }
.login-submit { width: 100%; min-height: 45px; margin-top: 4px; font-size: 13px; }
.login-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border-soft); color: var(--faint); font-size: 10px; }
.login-lock { color: var(--green); }

/* --------------------------------------------------------------- animation */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rowIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@keyframes rain { from { transform: translateY(-10vh); } to { transform: translateY(120vh); } }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1320px) {
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skeleton-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-width); transform: translateX(-105%); transition: transform .22s ease; box-shadow: 20px 0 60px rgba(0,0,0,.4); }
  .sidebar.open { transform: none; }
  .icon-btn.sidebar-close { display: inline-grid; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); display: none; }
  .sidebar-backdrop.show { display: block; }
  .icon-btn.mobile-menu { display: inline-grid; }
  .topbar { padding: 15px 20px; }
  .content { padding: 22px 20px 44px; }
  .login-shell { grid-template-columns: 1fr; min-height: auto; }
  .login-brand { display: none; }
  .login-panel { padding: 34px 24px; }
}
@media (max-width: 720px) {
  .overview-grid, .service-grid, .skeleton-grid, .other-body { grid-template-columns: 1fr; }
  .topbar-actions .last-updated { display: none; }
  .connection-state { display: none; }
  .page-heading h1 { font-size: 18px; }
  .content { padding: 18px 14px 36px; gap: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full, .form-grid .third { grid-column: auto; }
  .modal-overlay { padding: 10px; }
  .modal { max-height: 94vh; border-radius: 16px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .live-summary { grid-template-columns: 1fr; }
  .live-service-row { grid-template-columns: minmax(100px, 1fr) minmax(56px, .9fr) 78px; gap: 7px; padding: 6px 8px; }
  .compare-grid { grid-template-columns: 1fr; }
  .service-meta { grid-template-columns: 1fr 1fr; }
  .login-page { padding: 0; }
  .login-shell { border-radius: 0; min-height: 100vh; border: 0; }
  .login-panel { padding: 30px 22px; }
  .toast-root { right: 12px; left: 12px; bottom: 12px; }
  .toast { max-width: none; }
}
