/* Hosting Manager — folha de estilo única, servida pelo próprio binário.
   Sem framework: a CSP do painel proíbe origens externas, e um framework
   administrativo custaria mais do que entrega aqui. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dfe3e8;
  --text: #1c2430;
  --text-dim: #5b6775;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --ok: #17803d;
  --ok-bg: #dcfce7;
  --warn: #a16207;
  --warn-bg: #fef3c7;
  --err: #b91c1c;
  --err-bg: #fee2e2;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2029;
    --surface-2: #222a35;
    --border: #2f3947;
    --text: #e6eaf0;
    --text-dim: #99a4b3;
    --accent: #4f8cff;
    --ok: #4ade80;
    --ok-bg: #0f3d24;
    --warn: #fbbf24;
    --warn-bg: #43330a;
    --err: #f87171;
    --err-bg: #4a1414;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}
.brand {
  font-weight: 650;
  font-size: 15px;
  padding: 0 20px 18px;
  letter-spacing: -0.01em;
}
.brand span { color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; flex: 1; }
.nav a {
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 14px;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent); color: var(--accent-text); }
.nav-foot { padding: 10px; border-top: 1px solid var(--border); margin-top: 10px; }
.nav-foot form { margin: 0; }
.nav-foot button {
  width: 100%; text-align: left; padding: 9px 12px; border-radius: 7px;
  background: none; border: 0; color: var(--text-dim); cursor: pointer;
  font: inherit; font-weight: 500; font-size: 14px;
}
.nav-foot button:hover { background: var(--surface-2); color: var(--text); }

.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
h1 { font-size: 21px; margin: 0; font-weight: 640; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 620; }
.muted { color: var(--text-dim); font-size: 13px; }

/* ---------- cards ---------- */
.grid { display: grid; gap: 14px; }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.card h2 { margin-bottom: 14px; }
.stat .n { font-size: 27px; font-weight: 660; letter-spacing: -0.02em; }
.stat .l { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

/* ---------- badges ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 620; letter-spacing: 0.01em;
  background: var(--surface-2); color: var(--text-dim);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.aviso { background: var(--warn-bg); color: var(--warn); }
.badge.erro { background: var(--err-bg); color: var(--err); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 9px 12px; color: var(--text-dim);
  font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.04em; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.mono, .mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 13.5px; font-weight: 550;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); border-color: var(--err); }
.btn.danger:hover { background: var(--err-bg); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; display: inline; }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
label { display: block; font-weight: 570; margin-bottom: 5px; font-size: 13.5px; }
input[type=text], input[type=password], input[type=url], select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; font-size: 14px;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
}
textarea { font-family: var(--mono); font-size: 13px; min-height: 130px; resize: vertical; }
.hint { color: var(--text-dim); font-size: 12.5px; margin-top: 5px; }
.err-text { color: var(--err); font-size: 12.5px; margin-top: 5px; font-weight: 550; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.check input { width: auto; margin: 0; }
.check label { margin: 0; font-weight: 500; }

/* ---------- alerts ---------- */
.alert {
  padding: 11px 14px; border-radius: 8px; margin-bottom: 16px;
  font-size: 13.5px; border: 1px solid transparent;
}
.alert.ok { background: var(--ok-bg); color: var(--ok); border-color: currentColor; }
.alert.aviso { background: var(--warn-bg); color: var(--warn); border-color: currentColor; }
.alert.erro { background: var(--err-bg); color: var(--err); border-color: currentColor; }

/* ---------- logs ---------- */
pre.log {
  background: #0d1117; color: #c9d1d9; padding: 14px; border-radius: 8px;
  overflow-x: auto; font-family: var(--mono); font-size: 12.5px;
  line-height: 1.5; max-height: 620px; overflow-y: auto; margin: 0;
  white-space: pre-wrap; word-break: break-word;
}

/* ---------- meters ---------- */
.meter { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter.aviso > i { background: var(--warn); }
.meter.atencao > i { background: var(--warn); }
.meter.critico > i { background: var(--err); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; word-break: break-all; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- responsivo ---------- */
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; flex-direction: row; align-items: center;
    padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border);
    overflow-x: auto; gap: 8px;
  }
  .brand { padding: 0 12px 0 0; }
  .nav { flex-direction: row; padding: 0; flex: 0 0 auto; }
  .nav-foot { border-top: 0; margin: 0; padding: 0; }
  .main { padding: 16px; }
}
