*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f6f8;
  --surface: #fff;
  --header-bg: #111827;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --border: #e5e7eb;
  --border-input: #d1d5db;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --radius: 6px;
}

body {
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Header */
.header {
  background: var(--header-bg);
  color: #fff;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-brand { font-size: 15px; font-weight: 600; letter-spacing: 0.2px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.key-indicator {
  font-size: 12px;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 6px;
}
.key-indicator .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
}
.key-indicator.set .dot { background: #22c55e; }
.key-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid #374151;
  background: transparent;
  color: #d1d5db;
  cursor: pointer;
}
.key-btn:hover { border-color: #6b7280; color: #fff; }

/* Key banner */
.key-banner {
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #92400e;
}
.key-banner input {
  flex: 1;
  max-width: 360px;
  padding: 6px 10px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
}
.key-banner.hidden { display: none; }

/* Main */
.main { padding: 24px; max-width: 1200px; }

/* Page title */
.page-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* Filters */
.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filters select {
  padding: 7px 10px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.filters select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }

/* Table */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  background: #f9fafb;
  color: #374151;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }
tbody td { padding: 10px 12px; font-size: 13px; vertical-align: middle; }

.cell-name { font-weight: 500; }
.cell-muted { color: var(--text-muted); }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-published { background: #bbf7d0; color: #065f46; }
.badge-draft     { background: #fef3c7; color: #92400e; }
.badge-type      { background: #e0e7ff; color: #3730a3; }

/* Links */
.link-github { color: var(--accent); text-decoration: none; font-size: 12px; }
.link-github:hover { text-decoration: underline; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn-primary   { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-input); }
.btn-secondary:hover { background: #f3f4f6; }
.btn-danger    { background: #fff; color: #b91c1c; border-color: #fca5a5; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm        { padding: 4px 10px; font-size: 12px; }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* Form */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  max-width: 560px;
}
.form-row { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #374151;
  margin-bottom: 6px;
}
.form-label .req { color: #ef4444; margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.form-control[readonly] { background: #f9fafb; color: var(--text-muted); cursor: default; }
textarea.form-control { resize: vertical; min-height: 80px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); }
.checkbox-row label { font-size: 13px; cursor: pointer; }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* Alert */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert.hidden { display: none; }

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.stat-item { font-size: 13px; color: var(--text-muted); }
.stat-item strong { color: var(--text); font-weight: 600; }

/* Empty state */
.empty { padding: 40px; text-align: center; color: var(--text-muted); font-size: 13px; }
