/* ============================================================
   OneKitApp design system
   Professional, minimal, icon-free. Light + dark aware.
   ============================================================ */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f2f3f6;
  --border: #e5e7eb;
  --border-strong: #d5d8de;
  --text: #171a21;
  --text-soft: #565d6b;
  --text-faint: #8b909b;
  --brand: #2f5cff;
  --brand-strong: #2445d6;
  --brand-soft: #eef2ff;
  --ok: #167a4b;
  --ok-soft: #e6f5ec;
  --danger: #c0362c;
  --danger-soft: #fbeceb;
  --ring: rgba(47, 92, 255, 0.28);
  --shadow-sm: 0 1px 2px rgba(20, 24, 33, 0.05);
  --shadow: 0 6px 20px rgba(20, 24, 33, 0.07);
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1160px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --surface-2: #1e222a;
    --border: #272b34;
    --border-strong: #333844;
    --text: #e8eaef;
    --text-soft: #a2a9b6;
    --text-faint: #727884;
    --brand: #6f8bff;
    --brand-strong: #90a4ff;
    --brand-soft: #1a2033;
    --ok: #4ade80;
    --ok-soft: #10261a;
    --danger: #f2938b;
    --danger-soft: #2a1513;
    --ring: rgba(111, 139, 255, 0.32);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

h1, h2, h3, h4 { letter-spacing: -0.02em; font-weight: 700; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: 24px;
}

.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); }
.center { text-align: center; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 62px;
}
.logo {
  font-weight: 800;
  font-size: 1.18rem;
  color: var(--text);
  letter-spacing: -0.03em;
}
.logo:hover { text-decoration: none; }
.logo b { color: var(--brand); font-weight: 800; }
.nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
}
.nav a {
  color: var(--text-soft);
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.92rem;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--brand); }
.nav-toggle { display: none; }

@media (max-width: 760px) {
  .nav {
    position: absolute;
    top: 62px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px 16px;
    display: none;
    box-shadow: var(--shadow);
  }
  .nav.open { display: flex; }
  .nav a { padding: 11px 12px; }
  .nav-toggle {
    display: inline-grid;
    place-items: center;
    margin-left: auto;
    width: 40px; height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 0.83rem; }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero {
  padding: 56px 0 40px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.hero h1 {
  font-size: clamp(1.9rem, 4.4vw, 2.7rem);
  line-height: 1.12;
  margin: 0 0 14px;
  font-weight: 800;
}
.hero p.lead {
  font-size: clamp(1rem, 2vw, 1.12rem);
  color: var(--text-soft);
  max-width: 600px;
  margin: 0 auto 28px;
}
.hero-stats {
  margin-top: 22px;
  color: var(--text-faint);
  font-size: 0.86rem;
  font-weight: 500;
}

/* ---------- Search ---------- */
.search {
  position: relative;
  max-width: 620px;
  margin: 0 auto;
}
.search input {
  width: 100%;
  padding: 15px 18px;
  font-size: 1.02rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 60;
  text-align: left;
  display: none;
}
.search-results.show { display: block; }
.search-results a {
  display: block;
  padding: 11px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover,
.search-results a.active { background: var(--surface-2); text-decoration: none; }
.search-results .sr-name { display: block; font-weight: 600; font-size: 0.94rem; }
.search-results .sr-cat { display: block; font-size: 0.76rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 1px; }
.search-results .sr-empty { padding: 16px; color: var(--text-soft); font-size: 0.92rem; }
.search-hint { margin-top: 12px; font-size: 0.84rem; color: var(--text-faint); }
.search-hint a { color: var(--text-soft); }

/* ---------- Category quick-nav (directory) ---------- */
.cat-quicknav {
  position: sticky;
  top: 62px;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.cat-quicknav .track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-quicknav .track::-webkit-scrollbar { display: none; }
.cat-quicknav a {
  white-space: nowrap;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.86rem;
  font-weight: 500;
}
.cat-quicknav a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

/* ---------- Sections ---------- */
.section { padding: 40px 0; }
.section-sep { border-top: 1px solid var(--border); }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.section-head h2 { font-size: 1.3rem; margin: 0; }
.section-head p { margin: 3px 0 0; color: var(--text-soft); font-size: 0.92rem; }
.section-head .link-all { font-weight: 600; font-size: 0.88rem; white-space: nowrap; }

/* ---------- Directory category block ---------- */
.dir-block { padding: 34px 0; scroll-margin-top: 120px; }
.dir-block + .dir-block { border-top: 1px solid var(--border); }
.dir-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.dir-head h2 { font-size: 1.22rem; margin: 0; }
.dir-head a { font-size: 0.86rem; font-weight: 600; white-space: nowrap; }
.dir-desc { color: var(--text-soft); font-size: 0.92rem; margin: 0 0 18px; max-width: 640px; }

/* ---------- Tool grid / tiles (icon-free) ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}
.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
  height: 100%;
}
.tool-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.tool-card h3 { margin: 0 0 3px; font-size: 1.0rem; font-weight: 700; }
.tool-card h3 a { color: var(--text); }
.tool-card h3 a:hover { color: var(--brand); text-decoration: none; }
.tool-card .tool-cat { font-size: 0.76rem; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.tool-card p.desc {
  margin: 10px 0 14px;
  font-size: 0.88rem;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tool-card .tool-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tool-open { font-size: 0.86rem; font-weight: 600; color: var(--brand); }
.tool-card:hover .tool-open { text-decoration: underline; }

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-featured { background: var(--brand-soft); color: var(--brand-strong); }
.badge-new { background: var(--ok-soft); color: var(--ok); }

/* ---------- Tags ---------- */
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  border: 1px solid var(--border-strong);
}
a.tag:hover { text-decoration: none; border-color: var(--brand); color: var(--brand); }
a.tag.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Breadcrumb ---------- */
.crumb {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-faint);
  padding: 22px 0 4px;
  flex-wrap: wrap;
}
.crumb a { color: var(--text-soft); }
.crumb .sep { opacity: 0.6; }

/* ---------- Page header ---------- */
.page-head { padding: 18px 0 26px; border-bottom: 1px solid var(--border); margin-bottom: 30px; }
.page-head h1 { font-size: clamp(1.6rem, 3.6vw, 2.1rem); margin: 0 0 8px; }
.page-head p { margin: 0; color: var(--text-soft); max-width: 680px; }

/* ---------- Tool detail ---------- */
.tool-detail {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: start;
  padding-bottom: 40px;
}
@media (max-width: 900px) { .tool-detail { grid-template-columns: 1fr; } }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.panel h2 { margin-top: 0; font-size: 1.1rem; }
.tool-hero h1 { margin: 0 0 6px; font-size: 1.7rem; }
.tool-meta-row { display: flex; gap: 18px; flex-wrap: wrap; color: var(--text-faint); font-size: 0.85rem; margin: 0 0 18px; }
.aside-sticky { position: sticky; top: 82px; display: grid; gap: 18px; }
.stat-line { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.stat-line:last-child { border-bottom: 0; }
.stat-line span:first-child { color: var(--text-soft); }
.stat-line span:last-child { font-weight: 600; }

/* ---------- Ad slots ---------- */
.ad-slot {
  display: grid;
  place-items: center;
  margin: 24px auto;
  min-height: 90px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-faint);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  overflow: hidden;
}
.ad-slot ins { display: block; width: 100%; }
.ad-slot--sidebar { min-height: 250px; }
.ad-slot--infeed { grid-column: 1 / -1; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 16px; }
.field label { display: block; font-weight: 600; font-size: 0.87rem; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--text-faint); font-size: 0.82rem; }
.field input[type="text"],
.field input[type="url"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.94rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.field textarea { min-height: 96px; resize: vertical; }
.field-check { display: flex; align-items: center; gap: 10px; }
.field-check input { width: 17px; height: 17px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 18px; border: 1px solid transparent; }
.alert-success { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-info { background: var(--brand-soft); color: var(--brand-strong); }

/* ---------- Tables (admin) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.89rem; }
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th { color: var(--text-soft); font-weight: 600; background: var(--surface-2); }
table.data tr:last-child td { border-bottom: 0; }
table.data td.actions { display: flex; gap: 8px; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-card .n { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-card .l { color: var(--text-soft); font-size: 0.84rem; margin-top: 2px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-soft); }
.empty h1 { font-size: 1.8rem; margin: 0 0 6px; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 20px; border-top: 1px solid var(--border); background: var(--surface); padding: 44px 0 28px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 28px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-grid h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin: 0 0 12px; font-weight: 600; }
.footer-grid a { display: block; color: var(--text-soft); padding: 4px 0; font-size: 0.9rem; }
.footer-grid a:hover { color: var(--brand); }
.footer-brand .logo { font-size: 1.1rem; }
.footer-brand p { color: var(--text-soft); font-size: 0.89rem; max-width: 280px; margin-top: 12px; }
.footer-bottom { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--text-faint); font-size: 0.84rem; }

/* ---------- Cookie consent ---------- */
.cookie-banner {
  position: fixed;
  left: 16px; right: 16px; bottom: 16px;
  max-width: 720px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 80;
  flex-wrap: wrap;
}
.cookie-banner p { margin: 0; font-size: 0.88rem; color: var(--text-soft); flex: 1 1 260px; }
.cookie-banner .cookie-actions { display: flex; gap: 10px; }
.cookie-banner[hidden] { display: none; }

/* ---------- Prose ---------- */
.prose { max-width: 740px; margin: 0 auto; }
.prose h1 { font-size: 2rem; }
.prose h2 { margin-top: 32px; font-size: 1.25rem; }
.prose p, .prose li { color: var(--text-soft); }
.prose a { text-decoration: underline; }

/* ---------- Admin shell ---------- */
.admin-top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
.admin-top-inner { display: flex; align-items: center; gap: 18px; height: 58px; }
.admin-nav { display: flex; gap: 2px; margin-left: 10px; flex-wrap: wrap; }
.admin-nav a { color: var(--text-soft); padding: 7px 12px; border-radius: var(--radius-sm); font-size: 0.89rem; font-weight: 500; }
.admin-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.admin-nav a.active { background: var(--brand-soft); color: var(--brand); }
.admin-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.admin-right .who { font-size: 0.83rem; color: var(--text-faint); }
.admin-main { padding: 30px 0 60px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.admin-head h1 { font-size: 1.4rem; margin: 0; }

.login-wrap { min-height: 82vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow-sm); }

.chip { display: inline-flex; align-items: center; font-size: 0.74rem; font-weight: 600; padding: 2px 9px; border-radius: 4px; }
.chip-on { background: var(--ok-soft); color: var(--ok); }
.chip-off { background: var(--surface-2); color: var(--text-faint); }
.inline-form { display: inline; }

.pill-count { display: inline-block; min-width: 20px; padding: 1px 8px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 0.72rem; font-weight: 700; text-align: center; }

.stack-sm > * + * { margin-top: 10px; }
.hidden { display: none !important; }
