/* Toolhive · light, violet, card-grid directory. */
:root {
  --bg: #f6f4ff;
  --panel: #ffffff;
  --ink: #171327;
  --muted: #6b6785;
  --line: #e6e1f7;
  --brand: #6d28d9;
  --brand-ink: #ffffff;
  --brand-soft: #f0eaff;
  --accent: #db2777;
  --ok: #047857;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 19, 39, .06), 0 8px 24px rgba(79, 42, 161, .07);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; }
img, svg { max-width: 100%; }
.boot { padding: 60px 20px; text-align: center; color: var(--muted); }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---- header ---- */
.top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .wrap { display: flex; align-items: center; gap: 14px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.logo {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), var(--accent)); color: #fff; font-weight: 800; font-size: 18px;
}
.brand b { font-size: 18px; letter-spacing: -.01em; }
.brand .who { min-width: 0; }
.brand .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.navlink { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 8px 10px; border-radius: 9px; }
.navlink:hover { background: var(--brand-soft); color: var(--brand); }

/* ---- buttons ---- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 14px; padding: 9px 14px; border-radius: 10px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 7px; line-height: 1.2;
}
.btn:hover { border-color: #cfc5ee; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: #5b21b6; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: transparent; background: transparent; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---- hero ---- */
.hero { padding: 42px 0 10px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.08; margin: 0 0 10px; letter-spacing: -.02em; }
.hero h1 em { font-style: normal; background: linear-gradient(120deg, var(--brand), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0 0 20px; color: var(--muted); font-size: 17px; max-width: 54ch; }
.kicker { font: 600 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--brand); margin-bottom: 12px; }

/* ---- filters ---- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 8px; }
.search { position: relative; flex: 1 1 280px; min-width: 0; }
.search input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); font: inherit; color: var(--ink); }
.search input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
select, input[type=text], input[type=email], input[type=password], input[type=url], textarea {
  font: inherit; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; width: 100%;
}
select:focus, input:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
textarea { resize: vertical; min-height: 96px; }
.selwrap { flex: 0 1 190px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
.chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font: 600 13px/1 inherit; padding: 9px 13px; border-radius: 999px; cursor: pointer;
}
.chip:hover { border-color: #cfc5ee; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---- tool grid ---- */
.sectitle { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 14px; }
.sectitle h2 { font-size: 19px; margin: 0; letter-spacing: -.01em; }
.sectitle .count { color: var(--muted); font-size: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow);
  text-align: left; font: inherit; color: inherit; cursor: pointer; min-width: 0;
}
.card:hover { border-color: #cbbcf0; transform: translateY(-1px); }
.card .head { display: flex; gap: 11px; align-items: flex-start; }
.ico { width: 42px; height: 42px; border-radius: 11px; flex: none; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px; }
.card h3 { margin: 0; font-size: 16px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.card .tl { color: var(--muted); font-size: 14px; margin: 2px 0 0; overflow-wrap: anywhere; }
.card .foot { display: flex; align-items: center; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.tag { font: 600 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 5px 8px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); }
.price { font: 600 12px/1 inherit; padding: 5px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.price.free { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.price.paid { background: #ede9fe; color: #5b21b6; border-color: transparent; }
.price.freemium, .price.trial { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.star { margin-left: auto; font: 600 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.vote {
  margin-left: auto; display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 6px 10px;
  font: 700 13px/1.1 inherit; color: var(--ink); cursor: pointer; flex: none;
}
.vote:hover { border-color: var(--brand); color: var(--brand); }
.vote.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.vote .arrow { font-size: 11px; line-height: 1; }
.empty { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); padding: 38px 18px; text-align: center; color: var(--muted); }

/* ---- detail ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 14px; }
.back { display: inline-block; margin: 20px 0 14px; color: var(--muted); font-size: 14px; text-decoration: none; }
.back:hover { color: var(--brand); }
.detail-head { display: flex; gap: 15px; align-items: flex-start; flex-wrap: wrap; }
.detail-head .ico { width: 58px; height: 58px; border-radius: 15px; font-size: 23px; }
.detail-head h1 { margin: 0; font-size: clamp(24px, 4vw, 32px); letter-spacing: -.02em; overflow-wrap: anywhere; }
.detail-head .tl { color: var(--muted); margin: 5px 0 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 0; }
.facts { margin: 14px 0 0; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 14px; font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.about { margin: 14px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- forms ---- */
.form { display: grid; gap: 14px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--muted); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.note { background: var(--brand-soft); color: #4c1d95; border-radius: 10px; padding: 11px 13px; font-size: 14px; }
.note.good { background: var(--ok-soft); color: var(--ok); }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.page-head { margin: 26px 0 16px; }
.page-head h1 { margin: 0 0 6px; font-size: clamp(24px, 4vw, 32px); letter-spacing: -.02em; }
.page-head p { margin: 0; color: var(--muted); }
.narrow { max-width: 640px; margin: 0 auto; }

/* ---- auth ---- */
.auth { min-height: 86vh; display: grid; place-items: center; padding: 24px 16px; }
.auth .panel { width: 100%; max-width: 400px; }
.auth h1 { font-size: 23px; margin: 12px 0 18px; }

/* ---- admin ---- */
.adminbar { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.adminbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); background: var(--panel); }
.tabs .wrap { display: flex; gap: 2px; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; font: 600 14px/1 inherit; color: var(--muted);
  padding: 14px 13px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); }
.badge { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 2px 7px; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 20px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; }
.stat b { display: block; font-size: 27px; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 13px; }
.rows { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; gap: 12px; align-items: center; padding: 13px 15px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.row:first-child { border-top: 0; }
.row .main { flex: 1 1 240px; min-width: 0; }
.row .main b { display: block; overflow-wrap: anywhere; }
.row .meta { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.row .ops { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font: 600 11px/1 inherit; padding: 4px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.pill.live { background: var(--ok-soft); color: var(--ok); }
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.rejected { background: var(--bad-soft); color: var(--bad); }
.pill.featured { background: #fce7f3; color: var(--accent); }
.admin-main { padding: 6px 0 56px; }

/* ---- dialog + toast ---- */
dialog { border: 0; border-radius: var(--radius); padding: 0; max-width: 560px; width: calc(100% - 28px); background: var(--panel); color: var(--ink); box-shadow: 0 24px 60px rgba(23, 19, 39, .28); }
dialog::backdrop { background: rgba(23, 19, 39, .45); }
.dlg-head { padding: 17px 20px; border-bottom: 1px solid var(--line); font-weight: 700; }
.dlg-body { padding: 18px 20px; max-height: 65vh; overflow: auto; }
.dlg-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; display: grid; gap: 8px; z-index: 60; width: max-content; max-width: calc(100% - 28px); }
.toast { background: #171327; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); }
.toast.good { background: var(--ok); }

/* ---- footer ---- */
.foot-note { color: var(--muted); font-size: 14px; text-align: center; padding: 34px 16px 46px; }

@media (max-width: 640px) {
  .top .wrap { min-height: 58px; }
  .brand .sub { display: none; }
  .hero { padding: 28px 0 6px; }
  .facts { grid-template-columns: 1fr; gap: 2px 0; }
  .facts dt { margin-top: 8px; }
  .row .ops { width: 100%; }
}
