:root {
  --bg0: #0f1419;
  --bg1: #172029;
  --bg2: #1e2a35;
  --line: #2a3a48;
  --text: #e8eef4;
  --muted: #8fa3b5;
  --accent: #3db8a0;
  --accent-2: #f0a05a;
  --danger: #e57373;
  --ok: #7ec8a3;
  --fav: #f0c14a;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  --radius: 14px;
  --font: "IBM Plex Sans", "PingFang SC", "Noto Sans SC", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(61, 184, 160, 0.14), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(240, 160, 90, 0.1), transparent 50%),
    linear-gradient(180deg, var(--bg0), #121820 40%, var(--bg0));
  min-height: 100vh;
}

.page {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.brand { display: flex; gap: 14px; align-items: center; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #2a8f9e 55%, var(--accent-2));
  box-shadow: var(--shadow);
}
.brand h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  letter-spacing: -0.02em;
}
.sub { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; }

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.meta { color: var(--muted); font-size: 0.85rem; font-family: var(--mono); }
.mgr-stats { color: var(--accent-2); font-size: 0.8rem; font-family: var(--mono); }

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  margin-bottom: 16px;
  background: rgba(15, 20, 25, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  min-height: 42px;
}
.search-wrap input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.98rem;
  min-width: 0;
}
.search-wrap kbd {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
}

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters select {
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}
.chk {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
}
.count {
  color: var(--muted);
  font-size: 0.86rem;
  font-family: var(--mono);
  white-space: nowrap;
}

.status {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(229, 115, 115, 0.12);
  border: 1px solid rgba(229, 115, 115, 0.35);
  color: #ffc9c9;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(30, 42, 53, 0.95), rgba(23, 32, 41, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover {
  border-color: rgba(61, 184, 160, 0.45);
  transform: translateY(-1px);
}
.card.is-fav { border-color: rgba(240, 193, 74, 0.45); }

.avatar-link { display: block; width: 72px; height: 72px; }
.avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg2);
  border: 2px solid rgba(61, 184, 160, 0.35);
}

.body { min-width: 0; }
.title-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.name {
  font-weight: 650;
  font-size: 1.02rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.handle {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.84rem;
  margin-top: 2px;
}
.badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.badge {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.badge.ok { color: var(--ok); border-color: rgba(126, 200, 163, 0.45); }
.badge.warn { color: var(--danger); border-color: rgba(229, 115, 115, 0.45); }
.badge.fav { color: var(--fav); border-color: rgba(240, 193, 74, 0.5); }

.bio {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3.7em;
  white-space: pre-wrap;
}

.note-line {
  margin-top: 6px;
  color: #d7c7a2;
  font-size: 0.8rem;
  line-height: 1.35;
}
.tag-line {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tag-chip {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(61, 184, 160, 0.12);
  border: 1px solid rgba(61, 184, 160, 0.28);
  color: var(--accent);
}

.stats {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-family: var(--mono);
}

.actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.82rem;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn.primary {
  background: linear-gradient(135deg, #2f9f8d, #247f86);
  border-color: transparent;
  color: #f4fffb;
  font-weight: 600;
}
.btn.danger {
  border-color: rgba(229, 115, 115, 0.5);
  color: #ffb4b4;
}
.btn.ghost:hover, .btn.primary:hover { filter: brightness(1.08); }
.btn.copied { border-color: var(--ok); color: var(--ok); }
.btn.on-fav { color: var(--fav); border-color: rgba(240, 193, 74, 0.55); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.dlg {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #152029;
  color: var(--text);
  padding: 0;
  width: min(560px, calc(100vw - 24px));
  box-shadow: var(--shadow);
}
.dlg::backdrop { background: rgba(0, 0, 0, 0.55); }
.dlg-inner { padding: 16px 18px 18px; display: grid; gap: 10px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dlg-head h2 { margin: 0; font-size: 1.1rem; }
.muted { color: var(--muted); font-size: 0.88rem; margin: 0; }
.dlg label { font-size: 0.86rem; color: var(--muted); }
.dlg input[type="url"],
.dlg input[type="text"],
.dlg textarea {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  padding: 9px 10px;
}
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.export-box {
  max-height: 180px;
  overflow: auto;
  background: #0e151b;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-size: 0.75rem;
  color: var(--muted);
}

@media (max-width: 820px) {
  .toolbar { grid-template-columns: 1fr; }
  .count { justify-self: start; }
  .page { width: min(100%, calc(100% - 16px)); padding-top: 14px; }
  .card { grid-template-columns: 60px 1fr; }
  .avatar-link, .avatar { width: 60px; height: 60px; }
  .bio { -webkit-line-clamp: 4; min-height: 0; }
  .header-right { align-items: flex-start; }
}
