@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #09090b;
  --bg-subtle: #0e0e11;
  --surface: #131316;
  --surface-hover: #1a1a1e;
  --border: #27272a;
  --border-hover: #3f3f46;
  --text: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #22c55e;
  --accent-muted: rgba(34, 197, 94, 0.15);
  --warning: #eab308;
  --warning-muted: rgba(234, 179, 8, 0.15);
  --danger: #ef4444;
  --danger-muted: rgba(239, 68, 68, 0.12);
  --radius: 6px;
  --radius-lg: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; }
code, .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.9em; }

.wrap {
  width: min(1100px, calc(100% - 48px));
  margin: 0 auto;
}

/* ── Nav ───────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  background: #1a1a1a;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.1s ease;
}

.btn:hover {
  background: var(--surface);
  border-color: var(--border-hover);
  color: var(--text);
}

.btn.primary {
  background: var(--accent);
  color: var(--bg);
  border-color: transparent;
  font-weight: 600;
}

.btn.primary:hover {
  background: #4ade80;
}

.btn.danger {
  background: var(--danger-muted);
  color: var(--danger);
  border-color: transparent;
}

.btn.danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* ── Hero ──────────────────────────────── */
.hero {
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--border);
}

.kicker {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

h1 {
  font-size: clamp(32px, 5vw, 42px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 12px;
}

.lead {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 520px;
}

.stats {
  display: flex;
  gap: 40px;
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.stat { display: flex; flex-direction: column; }
.stat b { font-size: 20px; font-weight: 600; }
.stat span { font-size: 13px; color: var(--text-muted); }

/* ── Search ────────────────────────────── */
.search-row {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.search-input {
  width: 100%;
  max-width: 400px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.1s ease;
}

.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent); }

/* ── Plugin Grid ───────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  padding: 24px 0 64px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all 0.1s ease;
}

.card:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.card-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  object-fit: cover;
}

.card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 4px;
}

.badge {
  display: inline-flex;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge.active { background: var(--accent-muted); color: var(--accent); }
.badge.archived { background: var(--warning-muted); color: var(--warning); }
.badge.wip { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }

.wip-box {
  padding: 48px 8px;
  max-width: 520px;
}
.wip-box h1 { margin: 12px 0 8px; }
.wip-box .plugin-actions { margin-top: 24px; }

.desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.loader-tag {
  padding: 3px 8px;
  background: var(--bg);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.downloads {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ── Plugin Detail ─────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 40px;
  padding: 24px 0 64px;
}

.sidebar {
  position: sticky;
  top: 80px;
  height: fit-content;
}

.sidebar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-nav { display: flex; flex-direction: column; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.1s ease;
}

.sidebar-link:hover { background: var(--surface); color: var(--text); }
.sidebar-link.active { background: var(--accent-muted); color: var(--accent); }
.sidebar-link img { width: 22px; height: 22px; border-radius: 4px; }

.content { min-width: 0; }

.plugin-header {
  display: flex;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.plugin-header img {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.plugin-header h1 {
  font-size: 26px;
  margin: 4px 0 6px;
}

.plugin-header .lead {
  font-size: 14px;
  margin: 0;
}

.plugin-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.plugin-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ── Sections ──────────────────────────── */
.section {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.section:last-child { border-bottom: 0; }

.section h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.section p {
  color: var(--text-secondary);
  line-height: 1.7;
}

.list {
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 14px;
}

.list li { margin-bottom: 4px; }
.list li::marker { color: var(--accent); }

/* ── Tables ────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-subtle);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table tr:last-child td { border-bottom: 0; }

.table td:first-child {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
}

.table td.perm {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--warning);
}

/* ── Code ──────────────────────────────── */
pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  overflow-x: auto;
}

/* ── Footer ────────────────────────────── */
.footer {
  padding: 24px 0;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.footer a:hover { color: var(--text); }

/* ── Admin ─────────────────────────────── */
.admin-shell { padding: 24px 0 64px; }

.admin-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
}

.admin-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  height: fit-content;
  position: sticky;
  top: 80px;
}

.admin-panel .kicker {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
}

.admin-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  text-align: left;
  transition: all 0.1s ease;
}

.admin-list-item:hover { background: var(--surface-hover); color: var(--text); }
.admin-list-item.active { background: var(--accent-muted); color: var(--accent); }
.admin-list-item img { width: 24px; height: 24px; border-radius: 4px; }

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.form-card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.full { grid-column: 1 / -1; }

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

input, textarea, select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.1s ease;
}

input:focus, textarea:focus, select:focus { border-color: var(--accent); }

textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
textarea.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

.repeat { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }

.repeat-row {
  display: grid;
  grid-template-columns: 180px 1fr 140px 36px;
  gap: 8px;
}

.repeat-row.two { grid-template-columns: 180px 1fr 36px; }

.repeat-row input { padding: 7px 10px; font-size: 13px; }
.repeat-row .btn { padding: 7px; justify-content: center; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.status-text { font-size: 13px; color: var(--accent); }
.status-text.error { color: var(--danger); }

/* ── Login ─────────────────────────────── */
.login-wrap {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .muted { margin-bottom: 20px; font-size: 13px; }

.muted { color: var(--text-secondary); }
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}

/* ── Responsive ────────────────────────── */
@media (max-width: 800px) {
  .layout, .admin-grid { grid-template-columns: 1fr; }
  .sidebar, .admin-panel { position: static; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; padding-bottom: 8px; }
  .sidebar-link { white-space: nowrap; }
  .hide-sm { display: none; }
  .stats { gap: 24px; }
  .form-grid { grid-template-columns: 1fr; }
  .repeat-row, .repeat-row.two { grid-template-columns: 1fr; }
  .plugin-header { flex-direction: column; }
}
