@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

:root {
  --bg: #0a1020;
  --bg-2: #0e1730;
  --elevated: #121e3a;
  --line: rgba(160, 185, 255, 0.16);
  --line-strong: rgba(160, 185, 255, 0.28);
  --ink: #eaf1ff;
  --ink-muted: #91a3c7;
  --cyan: #67e8f9;
  --violet: #8b7cff;
  --success: #34d399;
  --danger: #fb7185;
  --warning: #fbbf24;
  --r: 14px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 14px;
}
.hidden { display: none !important; }
.muted { color: var(--ink-muted); }
.small { font-size: 0.78rem; }
.error { color: var(--danger); font-size: 0.85rem; margin-top: 8px; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(103, 232, 249, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(139, 124, 255, 0.08), transparent),
    var(--bg);
}
.login-card {
  width: min(440px, 100%);
  background: rgba(18, 30, 58, 0.92);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px;
  backdrop-filter: blur(12px);
}
.login-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 12px;
}
.login-card h1 {
  font-family: Manrope, sans-serif;
  font-size: 1.6rem;
  margin-bottom: 8px;
}
.login-card p { color: var(--ink-muted); margin-bottom: 24px; line-height: 1.5; }
label { display: block; font-size: 0.82rem; color: var(--ink-muted); margin-bottom: 6px; }
input, select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
  font: inherit;
}
input { margin-bottom: 16px; }
button, .btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}
.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #07101f;
  width: 100%;
}
.btn-secondary {
  background: var(--bg-2);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-danger { background: rgba(251,113,133,.12); color: var(--danger); border: 1px solid rgba(251,113,133,.35); }
.btn-sm { padding: 7px 12px; font-size: 0.8rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.ip-hint { margin-top: 16px; font-size: 0.82rem; }

.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: #0c1428;
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-logo {
  font-family: Manrope, sans-serif;
  font-weight: 700;
  padding: 10px 12px 22px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  box-shadow: 0 0 12px rgba(103,232,249,.6);
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-btn {
  text-align: left;
  background: transparent;
  color: var(--ink-muted);
  border: none;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
}
.nav-btn.active, .nav-btn:hover {
  background: rgba(103,232,249,.08);
  color: var(--ink);
}
.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
}
.foot-label { font-size: 0.72rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .05em; }
.foot-ip { font-family: ui-monospace, monospace; font-size: 0.8rem; margin: 6px 0 10px; word-break: break-all; }

.main { padding: 22px 28px 40px; overflow: auto; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}
.topbar h2 { font-family: Manrope, sans-serif; font-size: 1.4rem; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.card {
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
}
.card-label { font-size: 0.72rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .05em; }
.card-value { font-size: 1.45rem; font-weight: 700; margin-top: 6px; font-family: Manrope, sans-serif; }
.card-sub { font-size: 0.78rem; color: var(--ink-muted); margin-top: 6px; }
.progress {
  height: 6px;
  background: rgba(255,255,255,.06);
  border-radius: 999px;
  margin-top: 12px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
}

.panel {
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 16px;
}
.panel h3 { font-size: 0.95rem; margin-bottom: 0; font-family: Manrope, sans-serif; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.panel-desc { font-size: 0.82rem; margin-bottom: 14px; line-height: 1.5; }

.site-cards { display: grid; gap: 14px; margin-bottom: 16px; }
.site-card {
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
}
.site-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.site-card-head h4 { font-family: Manrope, sans-serif; font-size: 1.05rem; }
.site-meta { display: grid; gap: 4px; font-size: 0.82rem; color: var(--ink-muted); margin-bottom: 14px; }
.site-meta a { color: var(--cyan); text-decoration: none; }
.site-meta a:hover { text-decoration: underline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(52,211,153,.12);
  color: var(--success);
}
.tag.pending, .tag.offline { background: rgba(251,191,36,.12); color: var(--warning); }
.tag.error { background: rgba(251,113,133,.12); color: var(--danger); }

.log-box {
  background: #060a14;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-family: ui-monospace, monospace;
  font-size: 0.74rem;
  max-height: 380px;
  overflow: auto;
  white-space: pre-wrap;
  color: #b8c9e8;
  line-height: 1.45;
}
.muted-box { color: var(--ink-muted); min-height: 60px; }

.file-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.file-table th, .file-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.file-table th { color: var(--ink-muted); font-weight: 500; }
.table-wrap { overflow-x: auto; }
.file-link { color: var(--cyan); cursor: pointer; text-decoration: none; }
.breadcrumb { margin-bottom: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 0.85rem; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; align-items: center; }
.inline-form select { flex: 1; min-width: 180px; }

.ip-list { list-style: none; display: grid; gap: 8px; }
.ip-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
}

.settings-kv { display: grid; gap: 10px; }
.settings-kv div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}
.settings-kv span:last-child { color: var(--ink-muted); text-align: right; word-break: break-all; }

.activity-item {
  display: grid;
  grid-template-columns: 140px 120px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
}
.activity-item .act-time { color: var(--ink-muted); }
.activity-item .act-name { color: var(--cyan); font-weight: 600; }

.backup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
}
.ssl-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
}
.ssl-row:last-child, .backup-row:last-child, .activity-item:last-child { border-bottom: none; }

.toast-host {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  display: grid;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
}
.toast {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--elevated);
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
  animation: toastIn .25s ease;
}
.toast.success { border-color: rgba(52,211,153,.35); }
.toast.error { border-color: rgba(251,113,133,.35); color: #ffd6dc; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ver { font-size: 0.65rem; color: var(--ink-muted); font-weight: 500; margin-left: 4px; }

.alert {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  border: 1px solid;
  font-size: 0.88rem;
  line-height: 1.45;
}
.alert.warning { background: rgba(251,191,36,.08); border-color: rgba(251,191,36,.35); color: #fde68a; }
.alert.critical { background: rgba(251,113,133,.08); border-color: rgba(251,113,133,.35); color: #fecdd3; }
.alert.ok { background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.35); color: #a7f3d0; }

.capacity-panel { font-size: 0.9rem; line-height: 1.5; }
.capacity-panel strong { color: var(--cyan); }

.disk-bar-row { margin-bottom: 10px; }
.disk-bar-label { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 4px; }
.disk-bar-label span:last-child { color: var(--ink-muted); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: grid; place-items: center; z-index: 1000; padding: 20px;
}
.modal {
  width: min(480px, 100%);
  background: var(--elevated);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 24px;
  max-height: 90vh;
  overflow: auto;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h3 { font-family: Manrope, sans-serif; }
.modal label { margin-top: 10px; }
.modal input { margin-bottom: 0; margin-top: 4px; }

.tag.ssl-warn { background: rgba(251,191,36,.12); color: var(--warning); }
.tag.ssl-ok { background: rgba(52,211,153,.12); color: var(--success); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .activity-item { grid-template-columns: 1fr; gap: 4px; }
}

.js-error-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: var(--danger); color: #fff; padding: 12px 16px; text-align: center; font-weight: 600;
}
.alerts-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.alert-item { padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--line); background: rgba(251,113,133,.08); font-size: 0.88rem; }
.alert-item.warning { background: rgba(251,191,36,.08); }
.check-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; cursor: pointer; }
.modal-wide { width: min(720px, 96vw); }
.modal textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--ink); padding: 12px; font-family: ui-monospace, monospace; font-size: 0.82rem; resize: vertical;
}
code { font-size: 0.8rem; color: var(--cyan); }
