:root {
  --cr-bg: #0b1220;
  --cr-surface: #121c2e;
  --cr-surface-raised: #17253d;
  --cr-border: #223047;
  --cr-text: #eaf0fb;
  --cr-muted: #9fb0c9;
  --cr-primary: #33c2a3;
  --cr-primary-hover: #29a98c;
  --cr-accent: #6f8cff;
  --cr-danger: #ef5b6f;
  --cr-warning: #f0b429;
  --cr-radius: 12px;
  --cr-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cr-bg);
  color: var(--cr-text);
  font-family: var(--cr-font);
  line-height: 1.5;
}

a { color: var(--cr-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1140px; margin: 0 auto; padding: 0 20px; }

/* --- Topbar ------------------------------------------------------------ */
.topbar {
  background: var(--cr-surface);
  border-bottom: 1px solid var(--cr-border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; color: var(--cr-text); }
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 1.3rem; }
.main-nav { display: flex; align-items: center; gap: 18px; }
.main-nav a { color: var(--cr-text); font-weight: 500; }
.nav-cart { font-size: 1.2rem; }
.link-btn { background: none; border: none; color: var(--cr-text); font: inherit; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.inline-form { display: inline; }

/* --- Layout helpers ------------------------------------------------------ */
main { padding: 32px 0 64px; min-height: 70vh; }
.site-footer { border-top: 1px solid var(--cr-border); padding: 24px 0; color: var(--cr-muted); font-size: 0.9rem; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* --- Typography ----------------------------------------------------------- */
h1 { font-size: 2rem; margin: 0 0 8px; }
h2 { font-size: 1.4rem; margin: 32px 0 12px; }
h3 { font-size: 1.1rem; margin: 0 0 8px; }
.lede { color: var(--cr-muted); font-size: 1.05rem; max-width: 640px; }
.muted { color: var(--cr-muted); }
.small { font-size: 0.85rem; }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-block; background: var(--cr-primary); color: #06231c; font-weight: 600;
  padding: 10px 18px; border-radius: var(--cr-radius); border: none; cursor: pointer; font-size: 0.95rem;
}
.btn:hover { background: var(--cr-primary-hover); text-decoration: none; }
.btn-outline { background: transparent; color: var(--cr-text); border: 1px solid var(--cr-border); }
.btn-outline:hover { background: var(--cr-surface-raised); }
.btn-danger { background: var(--cr-danger); color: #2b0710; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-block { width: 100%; text-align: center; }

/* --- Cards ---------------------------------------------------------------- */
.card {
  background: var(--cr-surface); border: 1px solid var(--cr-border); border-radius: var(--cr-radius);
  padding: 24px;
}
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* --- Plugin / plan cards ---------------------------------------------------- */
.plugin-card { display: flex; flex-direction: column; gap: 10px; }
.plugin-card .icon { font-size: 2rem; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600;
  background: rgba(51, 194, 163, 0.15); color: var(--cr-primary); border: 1px solid rgba(51,194,163,0.3);
}
.badge-muted { background: rgba(159,176,201,0.12); color: var(--cr-muted); border-color: var(--cr-border); }
.badge-warning { background: rgba(240,180,41,0.15); color: var(--cr-warning); border-color: rgba(240,180,41,0.3); }
.badge-danger { background: rgba(239,91,111,0.15); color: var(--cr-danger); border-color: rgba(239,91,111,0.3); }

.plan-card { display: flex; flex-direction: column; gap: 12px; }
.plan-price { font-size: 1.6rem; font-weight: 700; }
.plan-cycle { color: var(--cr-muted); font-size: 0.85rem; }
.plan-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.plan-features li::before { content: '✓ '; color: var(--cr-primary); font-weight: 700; }

/* --- Forms ------------------------------------------------------------------ */
form.stacked { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
label { font-size: 0.85rem; color: var(--cr-muted); display: block; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url],
input[type=date], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--cr-border);
  background: var(--cr-surface-raised); color: var(--cr-text); font: inherit;
}
textarea { resize: vertical; min-height: 90px; }
.field { margin-bottom: 4px; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row > .field { flex: 1; min-width: 180px; }

/* --- Alerts ------------------------------------------------------------------ */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9rem; }
.alert-success { background: rgba(51,194,163,0.15); border: 1px solid rgba(51,194,163,0.35); color: #7fe6cf; }
.alert-error { background: rgba(239,91,111,0.15); border: 1px solid rgba(239,91,111,0.35); color: #ff9fac; }

/* --- Tables ----------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--cr-border); }
th { color: var(--cr-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: rgba(255,255,255,0.02); }
.table-wrap { overflow-x: auto; }

/* --- Admin layout ------------------------------------------------------------- */
.admin-shell { display: flex; min-height: calc(100vh - 64px); }
.admin-sidebar {
  width: 230px; flex-shrink: 0; background: var(--cr-surface); border-right: 1px solid var(--cr-border);
  padding: 20px 0;
}
.admin-sidebar a {
  display: block; padding: 10px 24px; color: var(--cr-muted); font-weight: 500; font-size: 0.92rem;
}
.admin-sidebar a:hover, .admin-sidebar a.active { background: var(--cr-surface-raised); color: var(--cr-text); text-decoration: none; }
.admin-sidebar .group-title { padding: 16px 24px 4px; font-size: 0.7rem; text-transform: uppercase; color: var(--cr-muted); letter-spacing: 0.05em; }
.admin-main { flex: 1; padding: 28px 32px; max-width: 1100px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-box { background: var(--cr-surface); border: 1px solid var(--cr-border); border-radius: var(--cr-radius); padding: 18px; }
.stat-box .value { font-size: 1.8rem; font-weight: 700; }
.stat-box .label { color: var(--cr-muted); font-size: 0.85rem; }

.pill-nav { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.pill-nav a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--cr-border); font-size: 0.85rem; color: var(--cr-muted); }
.pill-nav a.active, .pill-nav a:hover { background: var(--cr-primary); color: #06231c; border-color: var(--cr-primary); text-decoration: none; }

code, .code { font-family: 'Consolas', 'SFMono-Regular', monospace; background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }

.hero { padding: 48px 0 16px; }
.hero h1 { font-size: 2.4rem; max-width: 720px; }

.section-title-row { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--cr-muted); }

@media (max-width: 780px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; display: flex; overflow-x: auto; padding: 8px; }
  .admin-sidebar a { padding: 8px 14px; white-space: nowrap; }
  .admin-main { padding: 20px; }
}
