:root {
  --bg: #0f1419;
  --card: #1a2332;
  --line: #2b3a4f;
  --text: #e7eef8;
  --muted: #8aa0b8;
  --primary: #3b82f6;
  --danger: #ef4444;
  --ok: #22c55e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #0b1220, #121a27 40%, #0f1419);
  color: var(--text);
  min-height: 100vh;
}
.hidden { display: none !important; }
.wrap { min-height: 100vh; display:grid; place-items:center; padding:24px; }
.card {
  background: rgba(26,35,50,.92);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}
.login-card { width: min(420px, 100%); }
label { display:block; margin: 10px 0 6px; color: var(--muted); font-size: 13px; }
input, select, button, textarea {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0d1522;
  color: var(--text);
  padding: 10px 12px;
}
input, select { width: 100%; }
button {
  background: var(--primary);
  border-color: transparent;
  cursor: pointer;
  font-weight: 600;
}
button.secondary { background: #243247; }
button.danger { background: var(--danger); }
.row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.top {
  display:flex; justify-content:space-between; align-items:center;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: rgba(10,16,28,.85); position: sticky; top:0; backdrop-filter: blur(8px);
}
.layout { display:grid; grid-template-columns: 180px 1fr; min-height: calc(100vh - 58px); }
.side { border-right: 1px solid var(--line); padding: 12px; display:flex; flex-direction:column; gap:8px; }
.nav { text-align:left; background:#162033; }
.nav.active { background: var(--primary); }
.main { padding: 16px; }
.panel { display:none; }
.panel.active { display:block; }
.muted { color: var(--muted); font-size: 13px; }
.msg { margin-top: 10px; min-height: 1.2em; color: var(--muted); white-space: pre-wrap; }
.msg.ok { color: var(--ok); }
.msg.err { color: #fca5a5; }
.table-wrap { overflow:auto; margin-top: 12px; }
table { width:100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align:left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.codes {
  background:#0b1220; border:1px solid var(--line); border-radius:10px;
  padding:12px; overflow:auto; max-height:220px;
}
h1,h3 { margin: 0 0 10px; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { flex-direction: row; overflow:auto; border-right:none; border-bottom:1px solid var(--line); }
}


.md-preview {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b1220;
  line-height: 1.65;
}
.md-preview h1,.md-preview h2,.md-preview h3 { margin: 0.8em 0 0.4em; }
.md-preview p { margin: 0.5em 0; }
.md-preview code {
  background: #162033; padding: 1px 6px; border-radius: 6px; font-family: ui-monospace, monospace;
}
.md-preview pre {
  background: #0a101a; padding: 10px; border-radius: 8px; overflow:auto;
}
.md-preview pre code { background: transparent; padding: 0; }
.md-preview a { color: #93c5fd; }
.md-preview ul, .md-preview ol { padding-left: 1.4em; }
textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
}
.field { margin-bottom: 10px; }


.pager {
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  margin-top: 12px;
}
.pager .page-btn {
  min-width: 34px;
  padding: 6px 10px;
  background: #162033;
}
.pager .page-btn.active { background: var(--primary); }
.pager .page-info { color: var(--muted); font-size: 13px; }
