:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --border: #e3e6ef;
  --text: #171a23;
  --muted: #656c85;
  --accent: #3b5bdb;
  --accent-soft: #e7ecfd;
  --danger: #c92a2a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 26, 35, .06), 0 8px 24px rgba(23, 26, 35, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

a { color: var(--accent); }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 62px;
}

.brand {
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -.01em;
}

.brand span { color: var(--accent); }

.site-header nav {
  margin-left: auto;
  display: flex;
  gap: 18px;
  font-size: 14px;
}

.site-header nav a {
  text-decoration: none;
  color: var(--muted);
}

.site-header nav a:hover { color: var(--text); }

/* hero */
.hero {
  padding: 40px 0 24px;
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 30px;
  letter-spacing: -.02em;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

/* controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 8px;
}

.search {
  flex: 1 1 260px;
  padding: 11px 14px;
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}

.search:focus { border-color: var(--accent); }

select.filter {
  padding: 11px 12px;
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
}

.count {
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0 18px;
}

/* cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding-bottom: 60px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -.01em;
}

.card .desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  flex: 1;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.tag.neutral {
  background: #f0f1f5;
  color: var(--muted);
}

.card-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.danger {
  color: var(--danger);
  border-color: #f3d3d3;
}

.btn:disabled { opacity: .55; cursor: not-allowed; }

.meta {
  font-size: 12px;
  color: var(--muted);
}

/* empty / loading */
.state {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* admin */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
}

.field textarea { min-height: 72px; resize: vertical; }

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.msg {
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 14px;
  margin-bottom: 14px;
}

.msg.ok { background: #e6f7ed; color: #1a7f45; }
.msg.err { background: #fdecec; color: var(--danger); }
.msg.info { background: var(--accent-soft); color: var(--accent); }

.uid {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: #f0f1f5;
  padding: 2px 6px;
  border-radius: 5px;
  user-select: all;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.admin-row .grow { flex: 1; min-width: 0; }

.admin-row strong {
  display: block;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 560px) {
  .row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 24px; }
}
