:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #263449;
  --line: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --chip: #334155;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
a { color: #60a5fa; }
header.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  padding: 10px 20px; background: linear-gradient(180deg,#0e1830,#0b1220);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
header.topbar .brand { display: flex; align-items: center; gap: 12px; }
header.topbar h1 { font-size: 18px; margin: 0; letter-spacing: .01em; }
header.topbar .sub { color: var(--muted); font-size: 12px; }
.nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav-tabs { display: flex; align-items: center; gap: 4px; background: #0b1220;
  border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.nav-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 7px; font-size: 14px; font-weight: 600;
  color: var(--muted); text-decoration: none; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-tab:hover { background: var(--panel-2); color: var(--text); }
.nav-tab.active { background: var(--accent); color: #fff; box-shadow: 0 1px 4px rgba(37,99,235,.4); }
.nav-divider { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.nav .whoami { font-size: 13px; }
@media (max-width: 720px) {
  header.topbar { padding: 10px 14px; }
  .nav-tab { padding: 7px 11px; font-size: 13px; }
}
.wrap { max-width: 1050px; margin: 0 auto; padding: 20px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 820px) { .grid { grid-template-columns: 1fr; } }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px; margin-bottom: 18px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
input, textarea, select {
  width: 100%; padding: 9px 11px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 7px; color: var(--text); font-size: 14px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
button {
  cursor: pointer; border: 0; border-radius: 7px; padding: 9px 14px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
}
button:hover { background: var(--accent-2); }
button.secondary { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
button.danger { background: var(--bad); }
button.good { background: var(--good); }
button.small { padding: 5px 9px; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--chip); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 5px 11px; font-size: 12px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip.section { color: var(--muted); }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.search-box { position: relative; }
.results {
  border: 1px solid var(--line); border-radius: 8px; margin-top: 8px;
  max-height: 380px; overflow-y: auto; background: var(--panel-2);
}
.result {
  padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.result:last-child { border-bottom: 0; }
.result:hover, .result.active { background: #31415c; }
.result .name { font-weight: 600; }
.result .section { color: #93c5fd; font-size: 13px; }
.result .title { color: var(--text); font-size: 13px; }
.result .desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.result .meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.badge {
  font-size: 10px; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em;
}
.badge.cat { background: #1e3a8a; color: #bfdbfe; }
.badge.match { background: #334155; color: var(--muted); }
.badge.unverified { background: #7c2d12; color: #fed7aa; }
.badge.verified { background: #14532d; color: #bbf7d0; }
.badge.nolink { background: #4c1d95; color: #ddd6fe; }
.notice {
  background: #422006; border: 1px solid #92400e; color: #fde68a;
  padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px;
}
.notice.verify { background: #450a0a; border-color: #991b1b; color: #fecaca; }
.preview { border: 1px solid var(--accent); border-radius: 10px; padding: 14px; background: #172033; margin-top: 10px; }
.preview .section { color: #93c5fd; font-weight: 700; }
.preview .full { white-space: pre-wrap; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 7px; padding: 10px; margin-top: 8px; font-size: 13px; color: #cbd5e1; }
.muted { color: var(--muted); font-size: 12px; }
.added-list { list-style: none; padding: 0; margin: 0; }
.added-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: var(--panel-2);
}
.added-list .v-main { font-size: 13px; }
.added-list .v-sub { color: var(--muted); font-size: 11px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
tr.inactive { opacity: .5; }
.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--panel); border: 1px solid var(--line);
  padding: 12px 16px; border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.4); z-index: 50; max-width: 360px;
}
.toast.good { border-color: var(--good); }
.toast.bad { border-color: var(--bad); }
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none;
  align-items: center; justify-content: center; z-index: 40; padding: 20px;
}
.modal-bg.open { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; max-width: 720px; width: 100%; max-height: 88vh; overflow-y: auto; }
.hide { display: none !important; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.pill-action { display: inline-flex; gap: 6px; }
.pill-action button { padding: 6px 10px; font-size: 12px; }
.stat { display: inline-block; margin-right: 18px; }
.stat b { font-size: 20px; }
