/* ==========================================================================
   Afghan.xyz — main stylesheet
   Light/dark theming via CSS variables + [data-theme] on <html>
   ========================================================================== */

:root {
  --accent:        #10b981;   /* emerald */
  --accent-strong: #059669;
  --accent-soft:   rgba(16, 185, 129, .12);

  --bg:            #f8fafc;
  --bg-alt:        #f1f5f9;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --border:        #e2e8f0;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --text-faint:    #94a3b8;

  --badge-free:     #16a34a; --badge-free-bg:     rgba(22,163,74,.12);
  --badge-paid:     #dc2626; --badge-paid-bg:     rgba(220,38,38,.10);
  --badge-freemium: #d97706; --badge-freemium-bg: rgba(217,119,6,.12);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 6px 24px -8px rgba(15, 23, 42, .12);
  --shadow-lg: 0 16px 40px -12px rgba(15, 23, 42, .18);

  --radius: 14px;
  --radius-sm: 9px;
  --header-h: 68px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg:         #0b1120;
  --bg-alt:     #0f172a;
  --surface:    #131c31;
  --surface-2:  #1a2540;
  --border:     #24314f;
  --text:       #e6edf7;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --badge-free-bg:     rgba(34,197,94,.16);  --badge-free:     #4ade80;
  --badge-paid-bg:     rgba(248,113,113,.14);--badge-paid:     #f87171;
  --badge-freemium-bg: rgba(251,191,36,.14); --badge-freemium: #fbbf24;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 6px 24px -8px rgba(0,0,0,.5);
  --shadow-lg: 0 16px 40px -12px rgba(0,0,0,.6);
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
input { font: inherit; color: inherit; }
.container { width: min(1200px, 100% - 2.5rem); margin-inline: auto; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; height: 100%; }

.logo { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.22rem; letter-spacing: -.02em; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  color: #fff; font-size: 1.05rem; font-weight: 800;
  box-shadow: var(--shadow-sm);
}
.logo-tld { color: var(--accent); }

.main-nav { display: flex; gap: .25rem; margin-right: auto; }
.nav-link {
  padding: .45rem .85rem; border-radius: 999px;
  font-size: .95rem; font-weight: 500; color: var(--text-muted);
  transition: color .15s, background .15s;
}
.nav-link:hover { color: var(--text); background: var(--bg-alt); }
.nav-link.active { color: var(--accent-strong); background: var(--accent-soft); font-weight: 600; }
[data-theme="dark"] .nav-link.active { color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: .6rem; margin-left: auto; }

/* Header search */
.header-search { position: relative; }
.header-search .search-icon {
  position: absolute; left: .8rem; top: 50%; translate: 0 -50%;
  width: 16px; height: 16px; color: var(--text-faint); pointer-events: none;
}
.header-search input {
  width: 240px; height: 40px;
  padding: 0 .9rem 0 2.4rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-alt); color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s, width .2s ease;
}
.header-search input::placeholder { color: var(--text-faint); }
.header-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); width: 300px; }

.search-results {
  position: absolute; top: calc(100% + .5rem); right: 0;
  width: 340px; max-height: 380px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: .4rem;
}
.search-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .7rem; border-radius: var(--radius-sm);
}
.search-item:hover { background: var(--bg-alt); }
.search-item-icon { font-size: 1.25rem; }
.search-item-body { flex: 1; min-width: 0; line-height: 1.3; }
.search-item-body strong { display: block; font-size: .92rem; }
.search-item-body small { color: var(--text-muted); font-size: .78rem; }
.search-empty { padding: 1rem; text-align: center; color: var(--text-muted); font-size: .9rem; }

/* Theme toggle */
.theme-toggle {
  width: 40px; height: 40px; border-radius: 999px;
  display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--bg-alt);
  transition: background .15s, border-color .15s;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: none; }

/* Mobile menu button */
.menu-toggle { display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-alt); }
.menu-toggle svg { width: 20px; height: 20px; margin: auto; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 5.5rem 0 4.5rem; text-align: center; }
.hero-glow {
  position: absolute; inset: -40% -20% auto;  height: 130%;
  background:
    radial-gradient(600px 300px at 30% 20%, var(--accent-soft), transparent 70%),
    radial-gradient(500px 280px at 75% 10%, rgba(14,165,233,.10), transparent 70%);
  pointer-events: none;
}
.hero-inner { position: relative; }
.hero-eyebrow {
  display: inline-block; margin-bottom: 1.1rem;
  padding: .35rem 1rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-strong);
  font-size: .85rem; font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
[data-theme="dark"] .hero-eyebrow { color: var(--accent); }
.hero-title { font-size: clamp(2.2rem, 5.5vw, 3.6rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.12; }
.hero-title .accent {
  background: linear-gradient(90deg, var(--accent), #0ea5e9);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-subtitle { max-width: 560px; margin: 1.1rem auto 2rem; color: var(--text-muted); font-size: 1.08rem; }

.hero-search {
  display: flex; align-items: center; gap: .5rem;
  max-width: 620px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: .45rem .45rem .45rem 1.1rem;
  box-shadow: var(--shadow-md);
  transition: border-color .15s, box-shadow .15s;
}
.hero-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-md); }
.hero-search .search-icon { width: 20px; height: 20px; color: var(--text-faint); flex: none; }
.hero-search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 1rem; height: 44px; }
.hero-search input::placeholder { color: var(--text-faint); }

.hero-chips { margin-top: 1.4rem; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; align-items: center; }
.chips-label { color: var(--text-faint); font-size: .88rem; }
.chip {
  padding: .32rem .85rem; border-radius: 999px; font-size: .85rem; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
  transition: all .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
[data-theme="dark"] .chip:hover { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.15rem; border-radius: 999px;
  font-weight: 600; font-size: .92rem; white-space: nowrap;
  transition: all .15s;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.07); box-shadow: var(--shadow-md); translate: 0 -1px; }
.btn-lg { padding: .8rem 1.7rem; font-size: 1rem; }
.btn-visit {
  background: var(--accent-soft); color: var(--accent-strong);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: .42rem .95rem; font-size: .86rem;
}
[data-theme="dark"] .btn-visit { color: var(--accent); }
.btn-visit:hover { background: var(--accent); color: #fff; }

/* ---------- Sections ---------- */
.section { padding: 3.5rem 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.8rem; }
.section-title { font-size: 1.55rem; font-weight: 750; letter-spacing: -.02em; }
.section-sub { color: var(--text-muted); font-size: .95rem; margin-top: .15rem; }
.see-all { color: var(--accent-strong); font-weight: 600; font-size: .92rem; white-space: nowrap; }
[data-theme="dark"] .see-all { color: var(--accent); }
.see-all:hover { text-decoration: underline; }

/* ---------- Tool cards ---------- */
.tool-grid {
  display: grid; gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
}
.tool-card {
  display: flex; flex-direction: column; gap: .8rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.15rem;
  box-shadow: var(--shadow-sm);
  transition: translate .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tool-card:hover { translate: 0 -3px; box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }

.tool-card-top { display: flex; align-items: center; gap: .8rem; }
.tool-logo {
  width: 46px; height: 46px; flex: none;
  border-radius: 12px; display: grid; place-items: center;
  font-size: 1.45rem; background: var(--tint, var(--bg-alt));
}
.tool-meta { flex: 1; min-width: 0; }
.tool-name { font-size: 1.04rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.tool-name a:hover { color: var(--accent-strong); }
[data-theme="dark"] .tool-name a:hover { color: var(--accent); }
.tool-cat { display: block; font-size: .8rem; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  flex: none; padding: .22rem .62rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
}
.badge-free     { background: var(--badge-free-bg);     color: var(--badge-free); }
.badge-paid     { background: var(--badge-paid-bg);     color: var(--badge-paid); }
.badge-freemium { background: var(--badge-freemium-bg); color: var(--badge-freemium); }

.tool-desc {
  color: var(--text-muted); font-size: .92rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tool-tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag {
  font-size: .74rem; padding: .18rem .6rem; border-radius: 999px;
  background: var(--bg-alt); color: var(--text-muted); border: 1px solid var(--border);
}
.tool-card-bottom {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: .8rem; border-top: 1px solid var(--border);
}
.tool-stats { font-size: .8rem; color: var(--text-faint); }

/* ---------- For Afghans section ---------- */
.afghan-section { padding-top: 0; }
.afghan-banner {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  padding: 2rem 1.6rem 1.6rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.afghan-banner::before {                 /* flag tricolor accent */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg,
    #1c1c1c 0 33.3%, #b91c1c 33.3% 66.6%, #047737 66.6% 100%);
}
.afghan-banner::after {                  /* soft green wash behind the header */
  content: ""; position: absolute; inset: 0 auto auto 0; width: 100%; height: 140px;
  background: radial-gradient(420px 140px at 12% 0%, rgba(4,119,55,.10), transparent 70%);
  pointer-events: none;
}
.afghan-banner .section-head,
.afghan-banner .tool-grid { position: relative; }
.afghan-banner .tool-card { background: var(--surface-2); }
.flag-svg {
  width: 27px; height: 18px; border-radius: 3px;
  display: inline-block; vertical-align: -2px;
  box-shadow: 0 0 0 1px var(--border);
}
.flag-svg-sm { width: 19px; height: 13px; vertical-align: -2px; }
.chip-afghan { display: inline-flex; align-items: center; gap: .4rem; }

/* ---------- Category grid ---------- */
.category-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.category-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: .3rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: translate .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.category-card:hover { translate: 0 -3px; box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.cat-icon {
  font-size: 1.6rem; margin-bottom: .35rem;
  width: 52px; height: 52px; display: grid; place-items: center;
  background: var(--bg-alt); border-radius: 14px;
  transition: background .18s;
}
.category-card:hover .cat-icon { background: var(--accent-soft); }
.cat-name { font-weight: 700; font-size: 1rem; letter-spacing: -.01em; }
.category-card-afghan { border-color: color-mix(in srgb, #047737 35%, var(--border)); }
.category-card-afghan .cat-icon { background: rgba(4,119,55,.10); }
.cat-count { font-size: .82rem; color: var(--text-faint); }

/* ---------- CTA strip ---------- */
.cta-strip {
  margin: 1rem 0 0;
  background:
    radial-gradient(500px 200px at 15% 0%, rgba(255,255,255,.14), transparent 60%),
    linear-gradient(135deg, var(--accent-strong), #0284c7);
  color: #fff;
}
.cta-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: 2.8rem 0; flex-wrap: wrap;
}
.cta-title { font-size: 1.5rem; font-weight: 750; letter-spacing: -.02em; }
.cta-sub { opacity: .85; margin-top: .2rem; }
.cta-strip .btn-primary { background: #fff; color: var(--accent-strong); }
.cta-strip .btn-primary:hover { filter: none; translate: 0 -1px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--border); margin-top: 0; }
.footer-grid {
  display: grid; gap: 2.5rem;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  padding: 3rem 0 2rem;
}
.footer-about p { color: var(--text-muted); font-size: .92rem; margin-top: .9rem; max-width: 300px; }
.footer-col h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); margin-bottom: .9rem; }
.footer-col ul { list-style: none; display: grid; gap: .5rem; }
.footer-col ul a { color: var(--text-muted); font-size: .92rem; }
.footer-col ul a:hover { color: var(--accent-strong); }
[data-theme="dark"] .footer-col ul a:hover { color: var(--accent); }

.social-links { display: flex; gap: .6rem; margin-top: 1.1rem; }
.social-links a {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
  transition: all .15s;
}
.social-links a:hover { color: var(--accent-strong); border-color: var(--accent); translate: 0 -2px; }
.social-links svg { width: 16px; height: 16px; }

.footer-bottom {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1.3rem 0; border-top: 1px solid var(--border);
  color: var(--text-faint); font-size: .86rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .header-search input { width: 170px; }
  .header-search input:focus { width: 200px; }
}

@media (max-width: 720px) {
  .menu-toggle { display: grid; place-items: center; }
  .main-nav {
    position: fixed; inset: var(--header-h) 0 auto 0; z-index: 40;
    flex-direction: column; gap: .2rem;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: .8rem 1.2rem 1.1rem; box-shadow: var(--shadow-lg);
    display: none;
  }
  .main-nav.open { display: flex; }
  .nav-link { padding: .7rem 1rem; border-radius: 10px; }

  .header-search { display: none; }           /* hero search covers mobile */
  .hero { padding: 3.5rem 0 3rem; }
  .hero-search { flex-wrap: nowrap; }
  .hero-search .btn { padding-inline: .95rem; }
  .section { padding: 2.5rem 0; }
  .section-head { flex-direction: column; align-items: flex-start; gap: .3rem; }
  .see-all { margin-top: .2rem; }
  .cta-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; gap: 1.8rem; }
  .tool-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr 1fr; }
}


/* ==========================================================================
   Inner pages (category, tool detail, search, static, contact)
   ========================================================================== */

.container-narrow { width: min(880px, 100% - 2.5rem); margin-inline: auto; }

.breadcrumbs { font-size: .86rem; color: var(--text-faint); margin-bottom: 1.4rem; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent-strong); }
.breadcrumbs span { margin: 0 .35rem; opacity: .5; }

.page-head { margin-bottom: 1.8rem; }
.page-title { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.page-sub { color: var(--text-muted); margin-top: .35rem; }

.cat-desc { font-size: .84rem; color: var(--text-muted); margin-top: .3rem; }

/* Filters */
.filter-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.1rem; }
.chip-active { background: var(--accent); border-color: var(--accent); color: #fff !important; }
.filter-bar {
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .8rem 1.1rem; margin-bottom: 1.6rem; box-shadow: var(--shadow-sm);
}
.filter-bar label { display: flex; align-items: center; gap: .5rem; font-size: .88rem; color: var(--text-muted); font-weight: 500; }
.filter-bar select {
  font: inherit; color: var(--text); background: var(--bg-alt);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .4rem .6rem; outline: none; cursor: pointer;
}
.filter-bar select:focus { border-color: var(--accent); }
.filter-count { margin-left: auto; font-size: .86rem; color: var(--text-faint); }

/* Pagination */
.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 2.2rem; flex-wrap: wrap; }
.page-link {
  min-width: 40px; padding: .5rem .8rem; text-align: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: .9rem; font-weight: 600; color: var(--text-muted);
}
.page-link:hover { border-color: var(--accent); color: var(--accent-strong); }
.page-link.current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Empty states */
.empty-state { text-align: center; padding: 3.5rem 1rem; color: var(--text-muted); }
.empty-state p { margin-bottom: 1rem; font-size: 1.05rem; }
.empty-hint a { color: var(--accent-strong); font-weight: 600; }
.empty-404 .err-code { font-size: 5rem; font-weight: 800; color: var(--accent); line-height: 1; margin-bottom: .5rem; }

/* Tool detail */
.tool-detail {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.8rem; box-shadow: var(--shadow-sm);
}
.tool-detail-head { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.tool-logo-lg { width: 72px; height: 72px; font-size: 2.2rem; border-radius: 18px; }
.tool-logo-img { background: var(--bg-alt); overflow: hidden; }
.tool-logo-img img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.tool-detail-meta { flex: 1; min-width: 200px; }
.tool-detail-name { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.tool-detail-cat { color: var(--text-muted); font-size: .92rem; }
.tool-detail-cat a { color: var(--accent-strong); font-weight: 500; }
[data-theme="dark"] .tool-detail-cat a { color: var(--accent); }
.tool-detail-stats {
  display: flex; gap: 1.4rem; flex-wrap: wrap;
  margin: 1.2rem 0; padding: .8rem 0; border-block: 1px solid var(--border);
  font-size: .88rem; color: var(--text-muted);
}
.tool-detail-short { font-size: 1.06rem; font-weight: 500; }
.tool-detail-body { margin-bottom: 1.2rem; }
.tool-detail-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.4rem; flex-wrap: wrap; }
.tool-detail-url { color: var(--text-faint); font-size: .9rem; }

/* Prose (static pages) */
.prose { color: var(--text); line-height: 1.75; }
.prose p { margin-bottom: 1rem; }

/* Forms (contact + admin) */
.form { display: grid; gap: 1.1rem; max-width: 640px; }
.form label { display: grid; gap: .35rem; font-weight: 600; font-size: .92rem; }
.form input[type="text"], .form input[type="email"], .form input[type="url"],
.form input[type="password"], .form input[type="number"], .form textarea, .form select {
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .65rem .8rem; outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.form-hint { font-weight: 400; font-size: .8rem; color: var(--text-faint); }
.hp-field { position: absolute !important; left: -9999px !important; height: 0; overflow: hidden; }

/* Alerts */
.alert { border-radius: var(--radius-sm); padding: .9rem 1.1rem; margin-bottom: 1.2rem; font-size: .95rem; }
.alert p { margin: 0; }
.alert-success { background: var(--badge-free-bg); color: var(--badge-free); border: 1px solid color-mix(in srgb, var(--badge-free) 30%, transparent); }
.alert-error { background: var(--badge-paid-bg); color: var(--badge-paid); border: 1px solid color-mix(in srgb, var(--badge-paid) 30%, transparent); }

/* ==========================================================================
   Admin
   ========================================================================== */

.admin-topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: .7rem 0;
}
.admin-topbar-inner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.admin-brand { font-weight: 800; letter-spacing: -.02em; margin-right: .6rem; }
.admin-brand .logo-tld { color: var(--accent); }
.admin-nav { display: flex; gap: .2rem; flex-wrap: wrap; margin-right: auto; }
.admin-nav a { padding: .4rem .75rem; border-radius: 8px; font-size: .9rem; font-weight: 500; color: var(--text-muted); }
.admin-nav a:hover { background: var(--bg-alt); color: var(--text); }
.admin-nav a.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
[data-theme="dark"] .admin-nav a.active { color: var(--accent); }

.admin-main { padding: 2rem 0 4rem; }
.admin-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: 1.4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.admin-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow-sm);
  margin-bottom: 1.4rem;
}
.admin-card h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 1rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.6rem; }
.stat-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm);
}
.stat-tile .stat-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.stat-tile .stat-label { font-size: .84rem; color: var(--text-muted); }

/* Tables */
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th, .admin-table td { text-align: left; padding: .65rem .7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.admin-table tr:hover td { background: var(--bg-alt); }
.admin-table .cell-actions { white-space: nowrap; text-align: right; }
.admin-table input[type="number"] { width: 70px; }
.admin-table input[type="text"] { width: 100%; min-width: 120px; }

.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-secondary { background: var(--bg-alt); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent-strong); }
.btn-danger { background: var(--badge-paid-bg); color: var(--badge-paid); border: 1px solid color-mix(in srgb, var(--badge-paid) 30%, transparent); }
.btn-danger:hover { background: var(--badge-paid); color: #fff; }

.status-pill { font-size: .74rem; font-weight: 700; padding: .18rem .6rem; border-radius: 999px; }
.status-published { background: var(--badge-free-bg); color: var(--badge-free); }
.status-draft { background: var(--bg-alt); color: var(--text-faint); border: 1px solid var(--border); }

.bulk-bar { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin: 1rem 0; }
.bulk-bar select { font: inherit; padding: .4rem .6rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-alt); color: var(--text); }

.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; }
.login-card {
  width: min(400px, 100%); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 2rem; box-shadow: var(--shadow-lg);
}
.login-card .logo { justify-content: center; display: flex; margin-bottom: 1.4rem; }

.form-inline { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; }
.form-inline label { flex: 1; min-width: 140px; }
