/* ==========================================================================
   Magbenta AI - shared site theme
   Reuse on any page:  <link rel="stylesheet" href="/assets/theme.css">
   Change the colors in :root below and every page follows.
   No external fonts or CDNs (works with a strict "self only" security policy).
   ========================================================================== */

:root {
  /* Backgrounds */
  --bg-1: #060b18;
  --bg-2: #0b1120;
  --surface: #0f172a;
  --surface-2: #131c33;
  --surface-3: #1a2440;
  --border: rgba(148, 163, 184, .15);
  --border-strong: rgba(148, 163, 184, .28);

  /* Brand */
  --primary: #2563eb;
  --primary-hover: #3b82f6;
  --accent: #22d3ee;
  --beta: #f59e0b;

  /* Text */
  --text: #e2e8f0;
  --text-strong: #f8fafc;
  --muted: #94a3b8;

  /* Status */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #e11d48;
  --info: #38bdf8;

  /* Shape */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 10px 30px rgba(2, 6, 23, .45);
  --focus: 0 0 0 3px rgba(34, 211, 238, .55);

  /* Type */
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Consolas", "SFMono-Regular", Menlo, monospace;

  --maxw: 1120px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg-1);
  background-image: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
}
main { flex: 1 0 auto; }
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--text-strong); line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.3rem, 3vw, 1.75rem); letter-spacing: -.01em; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
code, .mono { font-family: var(--mono); }
small, .small { font-size: .875rem; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-xs); }

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

.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-xs); }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text-strong); font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.gradient-text, .ai {
  background: linear-gradient(90deg, var(--primary-hover) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.badge-beta {
  display: inline-block;
  background: var(--beta);
  color: #1a1203;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
  line-height: 1.6;
}

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(6, 11, 24, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.nav-links { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav-links a { color: var(--muted); padding: 6px 12px; border-radius: 999px; font-size: .95rem; }
.nav-links a:hover, .nav-links a.active { color: var(--text-strong); background: var(--surface-2); text-decoration: none; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 72px 0 48px; text-align: center; overflow: hidden; }
.hero::before {
  content: "";
  position: absolute; left: 50%; top: -120px; transform: translateX(-50%);
  width: 900px; height: 600px; max-width: 160vw;
  background: radial-gradient(closest-side, rgba(37, 99, 235, .35), rgba(34, 211, 238, .12) 55%, transparent 75%);
  pointer-events: none; z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.hero-logo { width: 88px; height: 88px; border-radius: 20px; box-shadow: 0 0 40px rgba(34, 211, 238, .25); margin-bottom: 18px; }
.hero h1 { margin-bottom: .25em; }
.tagline { font-size: clamp(1.1rem, 2.4vw, 1.4rem); color: var(--text); margin-bottom: .6em; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 640px; margin: 0 auto 1.5em; }

/* ---------- Sections / cards ---------- */
.section { padding: 32px 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 20px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-title h2, .card-title h3 { margin: 0; }
.card-subtle { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }

.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 8px 0 0; padding: 0; list-style: none; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: left; }
.feature h3 { margin-bottom: .3em; font-size: 1.02rem; }
.feature p { margin: 0; color: var(--muted); font-size: .95rem; }
.feature-icon { display: inline-flex; width: 34px; height: 34px; border-radius: 10px; align-items: center; justify-content: center; background: rgba(37, 99, 235, .18); color: var(--accent); font-weight: 800; margin-bottom: 10px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-strong);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-success { background: #047857; border-color: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-warning { background: transparent; border-color: var(--warning); color: var(--warning); }
.btn-warning:hover { background: rgba(245, 158, 11, .12); }
.btn-danger { background: transparent; border-color: var(--danger); color: #fb7185; }
.btn-danger:hover { background: rgba(225, 29, 72, .14); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #be123c; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-strong); }
.btn-sm { padding: 6px 10px; font-size: .85rem; border-radius: var(--radius-xs); }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }
.btn-block { display: flex; width: 100%; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-weight: 600; font-size: .92rem; color: var(--text-strong); }
.field .opt { color: var(--muted); font-weight: 400; }
.help { color: var(--muted); font-size: .85rem; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
  width: 100%;
  font: inherit; font-size: .97rem;
  color: var(--text-strong);
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: 44px;
}
input[type=date] { color-scheme: dark; }
textarea { min-height: 90px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #64748b; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--danger); }
.error-text { color: #fb7185; font-size: .85rem; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--primary); }
.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form input, .inline-form select { width: auto; min-height: 36px; padding: 6px 10px; }
.inline-form input[type=number] { width: 90px; }
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 0 16px; border: 1px solid; }
.alert-success { background: rgba(16, 185, 129, .12); border-color: rgba(16, 185, 129, .45); color: #a7f3d0; }
.alert-error { background: rgba(225, 29, 72, .12); border-color: rgba(225, 29, 72, .45); color: #fecdd3; }
.alert-warning { background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .45); color: #fde68a; }
.alert-info { background: rgba(56, 189, 248, .10); border-color: rgba(56, 189, 248, .40); color: #bae6fd; }
.alert ul { margin: .4em 0 0; padding-left: 1.2em; }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; border: 1px solid; letter-spacing: .02em; white-space: nowrap; }
.badge-active { color: #6ee7b7; border-color: rgba(16, 185, 129, .5); background: rgba(16, 185, 129, .12); }
.badge-expiring { color: #fcd34d; border-color: rgba(245, 158, 11, .5); background: rgba(245, 158, 11, .12); }
.badge-expired { color: #cbd5e1; border-color: rgba(148, 163, 184, .45); background: rgba(148, 163, 184, .12); }
.badge-revoked, .badge-disabled { color: #fda4af; border-color: rgba(225, 29, 72, .5); background: rgba(225, 29, 72, .12); }
.badge-pending { color: #7dd3fc; border-color: rgba(56, 189, 248, .5); background: rgba(56, 189, 248, .12); }
.badge-nokey { color: var(--muted); border-color: var(--border-strong); background: transparent; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(148, 163, 184, .05); }
.table .nowrap { white-space: nowrap; }
.kv { width: 100%; border-collapse: collapse; font-size: .93rem; }
.kv th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 12px 6px 0; width: 38%; vertical-align: top; }
.kv td { padding: 6px 0; word-break: break-word; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; color: var(--text); }
a.stat:hover { border-color: var(--border-strong); text-decoration: none; }
.stat-value { font-size: 1.7rem; font-weight: 800; color: var(--text-strong); line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .82rem; }
.stat-warning .stat-value { color: var(--warning); }
.stat-danger .stat-value { color: #fb7185; }
.stat-success .stat-value { color: var(--success); }
.stat-info .stat-value { color: var(--accent); }

/* ---------- License key box ---------- */
.key-box {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  background: var(--bg-2);
  border: 1px dashed rgba(34, 211, 238, .55);
  border-radius: var(--radius);
  padding: 18px;
  margin: 12px 0 18px;
}
.key-value { font-family: var(--mono); font-size: clamp(1.25rem, 5.2vw, 2rem); font-weight: 700; letter-spacing: .08em; color: var(--text-strong); user-select: all; word-break: break-all; text-align: center; }
.key-inline { font-family: var(--mono); font-size: .88rem; letter-spacing: .03em; color: var(--text-strong); white-space: nowrap; }

/* ---------- Terms ---------- */
.terms-box {
  max-height: 300px; overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-size: .88rem;
}
.terms-doc h1 { font-size: clamp(1.4rem, 3.5vw, 2rem); }
.terms-doc h2 { font-size: 1.08rem; margin-top: 1.6em; color: var(--accent); letter-spacing: .02em; }
.terms-doc p { color: var(--text); }
.terms-doc p.caps { font-size: .9em; color: #cbd5e1; }
.terms-doc p.indent { padding-left: 1.4em; }
.terms-box.terms-doc h1 { font-size: 1.15rem; }
.terms-box.terms-doc h2 { font-size: .95rem; }

/* ---------- Steps ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; position: relative; padding: 4px 0 14px 46px; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 2px;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(37, 99, 235, .2); color: var(--accent); font-weight: 800;
  border: 1px solid rgba(34, 211, 238, .35);
}

/* ---------- Admin ---------- */
.admin-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 24px 0 16px; }
.admin-bar h1 { margin: 0; font-size: 1.6rem; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 1 1 240px; width: auto; }
.toolbar select { width: auto; }
.action-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.action-group:last-child { border-bottom: 0; }
.action-group .label { min-width: 150px; }
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
details.more { margin-top: 10px; }
details.more summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.danger-zone { border-color: rgba(225, 29, 72, .45); }
.event-detail { color: var(--muted); word-break: break-word; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 24px 0; color: var(--muted); font-size: .88rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--text-strong); }

/* ---------- Utilities ---------- */
.hidden { display: none !important; }
.muted { color: var(--muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: #fb7185; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-center { justify-content: center; }
.row-between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.w-auto { width: auto; }
.break { word-break: break-word; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .features { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .container, .container-narrow { padding: 0 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .hero { padding: 48px 0 32px; }
  .hero-logo { width: 72px; height: 72px; }
  .nav-inner { min-height: 56px; padding-top: 6px; padding-bottom: 6px; }
  .action-group .label { min-width: 100%; }
  .btn-lg { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Client portal ---------- */
.pp-score { font-size: 2rem; font-weight: 800; color: var(--success); line-height: 1; }
.pp-score small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.pp-pre { white-space: pre-wrap; }
.pp-transcript { max-height: 70vh; overflow-y: auto; font-size: .93rem; }
.pp-transcript p { margin: 0 0 8px; }
.pp-t { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.pp-who { font-weight: 700; font-size: .8rem; letter-spacing: .03em; margin-right: 4px; }
.pp-you { color: #60a5fa; }
.pp-them { color: var(--accent); }
.pp-code { font-size: .85rem; line-height: 1.5; min-height: 480px; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
a.stat:hover { border-color: var(--accent); text-decoration: none; }
a.stat .stat-value, a.stat .stat-label { display: block; }
.pp-biz { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 4px; }
.pp-biz-btn { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 600; font-size: .92rem; }
.pp-biz-btn:hover { border-color: var(--accent); text-decoration: none; }
.pp-biz-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
/* Questionnaire: the question sits inside its card (not on the border), answers below it. */
.pp-q { border: 1px solid var(--border); margin: 0; min-width: 0; padding: 22px 24px; }
.pp-q-bad { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.pp-q-title { float: left; width: 100%; padding: 0; margin: 0 0 14px; font-weight: 700; color: var(--text-strong); font-size: 1.05rem; line-height: 1.4; }
.pp-q-title + * { clear: both; }
.pp-q .check { margin: 0 0 10px; }
.pp-q .check:last-child { margin-bottom: 0; }
.pp-q textarea { width: 100%; }
/* 1-5 and 0-10 scales as large buttons. */
.pp-scale { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pp-scale-ends { display: flex; justify-content: space-between; width: 100%; margin-top: 6px; }
.pp-scale-opt { position: relative; cursor: pointer; }
.pp-scale-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pp-scale-opt span { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 6px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-strong); font-weight: 700; font-size: 1rem; }
.pp-scale-opt:hover span { border-color: var(--accent); }
.pp-scale-opt input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.pp-scale-opt input:focus-visible + span { box-shadow: var(--focus); }
@media (max-width: 600px) { .pp-q { padding: 18px 16px; } .pp-scale-opt span { min-width: 38px; height: 40px; } }
.pp-scale-wrap { display: inline-block; max-width: 100%; }
.pp-other { display: none; margin: -2px 0 12px 30px; max-width: 420px; }
.pp-q .check:has(input:checked) + .pp-other { display: block; }
