:root {
  --bg: #0f1115;
  --panel: #161922;
  --panel-2: #1d2230;
  --border: #2a2f3e;
  --text: #e7e9ee;
  --muted: #8a93a6;
  --accent: #7c9cff;
  --accent-hover: #95b1ff;
  --ok: #4ade80;
  --warn: #facc15;
  --err: #f87171;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
code { background: var(--panel-2); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
small.muted, .muted { color: var(--muted); }

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 600; font-size: 16px; }
.topbar nav {
  display: flex; align-items: center; gap: 4px;
}
.topbar nav a, .topbar nav .link {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--muted);
}
.topbar nav a:hover, .topbar nav .link:hover { color: var(--text); background: var(--panel-2); }
.topbar nav a.on { color: var(--text); background: var(--panel-2); }
.topbar nav form.inline { margin: 0; }
.link {
  background: none; border: 0; cursor: pointer;
  font: inherit; color: var(--muted); padding: 6px 12px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card.narrow { max-width: 420px; margin: 80px auto; }
.card h1 { margin: 0 0 4px; font-size: 22px; }
.card h2 { margin: 0 0 10px; font-size: 17px; color: var(--muted); font-weight: 500; }

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 6px;
  margin: 0 0 14px;
}
legend { padding: 0 8px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }

label, .field {
  display: block;
  margin-bottom: 12px;
}
.field-label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 11px;
  border-radius: 6px;
  font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: transparent;
}
textarea {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.55;
  resize: vertical;
  min-height: 320px;
}

button, .btn-secondary {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}
button:hover, .btn-secondary:hover { background: #252b3d; border-color: #3a4358; }
button.primary { background: var(--accent); border-color: var(--accent); color: #0c1023; font-weight: 600; }
button.primary:hover { background: var(--accent-hover); }

.row { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.row.spread { justify-content: space-between; }
.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; }

.flash-stack { margin-bottom: 14px; }
.flash {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 8px;
  border: 1px solid transparent;
}
.flash-success { background: rgba(74, 222, 128, 0.08); border-color: rgba(74, 222, 128, 0.35); }
.flash-error   { background: rgba(248, 113, 113, 0.08); border-color: rgba(248, 113, 113, 0.4); }
.flash-info    { background: rgba(124, 156, 255, 0.08); border-color: rgba(124, 156, 255, 0.35); }

.status-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 14px; font-size: 16px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-on { background: var(--ok); box-shadow: 0 0 8px rgba(74, 222, 128, 0.5); }
.dot-off { background: var(--err); }
.status-label { font-weight: 600; }

.props { display: grid; grid-template-columns: 220px 1fr; gap: 4px 12px; font-size: 13px; margin: 6px 0 16px; }
.props dt { color: var(--muted); }
.props dd { margin: 0; word-break: break-all; }

.links { padding-left: 18px; }
.tips { padding-left: 18px; color: var(--muted); }
.tips li { margin-bottom: 4px; }

.skill-list { list-style: none; padding: 0; margin: 0; }
.skill-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.skill-item:last-child { border-bottom: 0; }
.skill-meta { flex: 1; min-width: 0; }
.skill-name { font-weight: 600; font-size: 15px; }
.skill-desc { font-size: 13.5px; margin-top: 2px; }
.skill-triggers { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-block;
  padding: 2px 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}
.skill-actions { display: flex; gap: 6px; flex-shrink: 0; }
.skill-actions form.inline { margin: 0; }

pre.logs {
  background: #0a0c12;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  max-height: 70vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
