:root {
  color-scheme: dark;
  --bg: #0d1017;
  --panel: #141923;
  --panel-2: #191f2b;
  --line: #273040;
  --text: #e7ecf5;
  --muted: #95a1b5;
  --accent: #49d3a2;
  --accent-2: #6ca7ff;
  --danger: #ff6b6b;
  --warn: #f7b955;
  --ok: #4dd484;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  border-right: 1px solid var(--line);
  background: #10151e;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #06120d;
  font-weight: 800;
}
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); margin-top: 2px; }
.nav { display: grid; gap: 6px; }
.nav a {
  padding: 11px 12px;
  border-radius: 6px;
  color: var(--muted);
}
.nav a.active, .nav a:hover {
  color: var(--text);
  background: var(--panel);
}
.sidebar-foot {
  margin-top: auto;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
}
.dot.muted { background: var(--muted); }
.dot.bad { background: var(--danger); }

.main { padding: 24px; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 28px; }
h2 { margin-bottom: 6px; font-size: 22px; }
h3 { margin-bottom: 0; font-size: 17px; }
.top-actions, .form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.primary-btn, .ghost-btn, .icon-btn {
  border: 1px solid var(--line);
  min-height: 38px;
  border-radius: 6px;
  color: var(--text);
  background: var(--panel-2);
  padding: 0 14px;
}
.primary-btn {
  background: var(--accent);
  color: #06120d;
  border-color: transparent;
  font-weight: 750;
}
.ghost-btn:hover, .icon-btn:hover { border-color: var(--accent-2); }
.icon-btn { width: 38px; padding: 0; }
.full { width: 100%; }

.notice {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-2);
  border-radius: 6px;
  color: var(--muted);
  background: var(--panel);
}
.hidden { display: none !important; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-head p { color: var(--muted); margin-bottom: 0; }
.site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.site-card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.site-card { overflow: hidden; }
.card-main {
  display: block;
  padding: 16px;
}
.card-main:hover { background: rgba(255,255,255,.02); }
.card-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.status-pill.success { color: var(--ok); border-color: rgba(77,212,132,.45); }
.status-pill.error { color: var(--danger); border-color: rgba(255,107,107,.45); }
.status-pill.pending { color: var(--warn); border-color: rgba(247,185,85,.45); }
.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 0;
}
dt { color: var(--muted); font-size: 12px; }
dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.toggle-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line);
}
.toggle-row button {
  height: 38px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}
.toggle-row button:last-child { border-right: 0; }
.toggle-row button.on { color: #06120d; background: var(--accent); }
.toggle-row button.unknown { color: var(--warn); }

.detail-layout { max-width: 1180px; }
.panel { padding: 18px; }
.panel.narrow { max-width: 760px; }
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tabs button {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.kv div, .log-row, .memory-note {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--panel-2);
}
.log-list, .memory-list { display: grid; gap: 10px; }
.log-row small, .memory-note small { color: var(--muted); display: block; margin-bottom: 6px; }

.form-grid {
  display: grid;
  gap: 14px;
}
label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0d121b;
  color: var(--text);
  padding: 10px 12px;
}
textarea { resize: vertical; }
.form-error { min-height: 20px; color: var(--danger); margin: 8px 0 0; }

.login-body {
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-shell { width: min(420px, 100%); }
.login-panel {
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.login-brand { margin-bottom: 4px; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 12px;
  }
  .nav { grid-template-columns: 1fr 1fr; }
  .sidebar-foot { display: none; }
  .main { padding: 16px; }
  .topbar, .section-head { align-items: flex-start; }
}
