:root {
  --bg: #13110e;
  --bg-2: #1b1814;
  --panel: #221e19;
  --line: #3a332b;
  --text: #f3ece3;
  --muted: #a89b8c;
  --accent: #e2a355;
  --up: #6fbf73;
  --down: #e15d4a;
  --unknown: #d4b15c;
  --disabled: #7c746b;
  --danger: #c94b3c;
  --radius: 14px;
  --font: "Segoe UI", "PT Sans", "Helvetica Neue", sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", "SFMono-Regular", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 10% -10%, #2a2118 0%, transparent 55%),
    var(--bg);
  color: var(--text);
}

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

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.nav {
  padding: 1.4rem 1rem;
  border-right: 1px solid var(--line);
  background: rgba(19, 17, 14, 0.9);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1.15rem;
  margin-bottom: 1.5rem;
}
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); }

.nav nav { display: flex; flex-direction: column; gap: 0.35rem; }
.nav nav a {
  color: var(--muted);
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
}
.nav nav a.is-active,
.nav nav a:hover {
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}

.content { padding: 1.6rem 1.8rem 3rem; }

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.2rem;
}
h1 { margin: 0 0 0.3rem; font-size: 1.7rem; font-weight: 650; }
h2 { margin: 0 0 0.8rem; font-size: 1.1rem; }
h3 { margin: 1rem 0 0.4rem; font-size: 1rem; }
.muted { color: var(--muted); margin: 0; }
.tiny { font-size: 0.75rem; }
.mono { font-family: var(--mono); font-size: 0.88em; }
.nowrap { white-space: nowrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 10px;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  font: inherit;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: #1a140c; border-color: transparent; font-weight: 650; }
.btn-small { padding: 0.28rem 0.55rem; font-size: 0.8rem; }
.btn-danger { color: #ffd7d1; border-color: #6e3a33; }

.summary { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1rem; }
.chip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
}
.chip-up { border-color: #2f5c36; }
.chip-down { border-color: #6e332c; }
.chip-unknown { border-color: #5d4c24; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.table-wrap { overflow-x: auto; }
.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.grid th, .grid td {
  text-align: left;
  padding: 0.65rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.grid th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.empty { color: var(--muted); text-align: center !important; padding: 1.4rem !important; }
.is-disabled { opacity: 0.62; }
.name { color: var(--text); font-weight: 600; }
.error-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.status-up { background: #1c3b22; color: var(--up); }
.status-down { background: #4a221c; color: #ffb1a6; }
.status-unknown { background: #3d3418; color: var(--unknown); }
.status-disabled { background: #2a2723; color: var(--disabled); }

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.actions.wrap { max-width: 280px; }
.banner {
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
}
.banner.ok { background: #1c3b22; color: #c8ecc9; }
.banner.bad { background: #4a221c; color: #ffd0c8; }

.form { display: grid; gap: 0.75rem; max-width: 720px; }
.form.compact { max-width: none; }
.form label, fieldset { display: grid; gap: 0.3rem; color: var(--muted); font-size: 0.88rem; }
.form .hint {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.35;
}
.form input, .form select, .form textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.check { display: flex; align-items: center; gap: 0.5rem; }
.check input { width: auto; }
fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
}
.form-actions { display: flex; gap: 0.6rem; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.group-card {
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding-top: 0.8rem;
}
.inline-edit { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.inline-edit input { min-width: 140px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 0.4rem 1rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.file-list { margin: 0; padding-left: 1.1rem; }
.meta-grid { margin-bottom: 1rem; }

.nav-user {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.nav-username {
  font-weight: 650;
  margin-bottom: 0.5rem;
  word-break: break-all;
}
.nav-user .btn { width: 100%; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem 1.5rem 1.8rem;
}
.auth-card .brand { margin-bottom: 1rem; }
.auth-card h1 { margin-bottom: 0.4rem; }
.auth-card .form { max-width: none; margin-top: 1rem; }
.smart-captcha-wrap {
  min-height: 102px;
  max-width: 100%;
  overflow: hidden;
}
.smart-captcha-wrap .smart-captcha {
  max-width: 100%;
}
.otp-input { letter-spacing: 0.35em; font-size: 1.2rem; font-family: var(--mono); }
.resend-form { margin-top: 0.8rem; }
.resend-form .btn { width: 100%; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav nav { flex-direction: row; flex-wrap: wrap; }
  .nav-user { margin-top: 1rem; border-top: 0; display: flex; align-items: center; gap: 0.8rem; }
  .nav-user .btn { width: auto; }
  .nav-username { margin-bottom: 0; }
  .split, .row { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
}
