/* StarQR brand tokens + base. Deep blue night sky, orange star. */
:root {
  --rs-night: #050d24;
  --rs-navy: #0b1f4d;
  --rs-blue: #12306e;
  --rs-blue-2: #1c4596;
  --rs-sky: #2f6bff;
  --rs-orange: #ff8a1f;
  --rs-orange-2: #ffb347;
  --rs-gold: #ffe2b0;
  --rs-star: #f5f7ff;

  --bg: #f4f6fc;
  --surface: #ffffff;
  --surface-2: #eef2fb;
  --border: #d8dfef;
  --text: #0e1a3a;
  --text-2: #4a5878;
  --muted: #7c89a8;
  --accent: var(--rs-orange);
  --accent-ink: #5a2a00;
  --link: #1c4596;

  --ok: #1f9d55;
  --ok-bg: #e3f6ec;
  --warn: #b26b00;
  --warn-bg: #fff2dc;
  --bad: #c62f2f;
  --bad-bg: #fde7e7;
  --info: #1c4596;
  --info-bg: #e5edff;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(11, 31, 77, 0.06), 0 6px 20px rgba(11, 31, 77, 0.07);
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fredoka', 'Nunito', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #071233;
    --surface: #0d1d47;
    --surface-2: #12275c;
    --border: #23397a;
    --text: #eef2ff;
    --text-2: #b7c3e6;
    --muted: #8796c2;
    --link: #8fb0ff;
    --ok-bg: #0f3a2a;
    --warn-bg: #3b2a0a;
    --bad-bg: #3f1616;
    --info-bg: #142c66;
    --ok: #4fd18b;
    --warn: #ffb347;
    --bad: #ff7b7b;
    --info: #8fb0ff;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--link); }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  padding: 0.6em 1.1em; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  background: var(--surface-2); color: var(--text);
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: linear-gradient(180deg, var(--rs-orange-2), var(--rs-orange)); color: #3a1a00; }
.btn--blue { background: var(--rs-blue-2); color: #fff; }
.btn--ghost { background: transparent; border-color: var(--border); }
.btn--danger { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.btn--sm { padding: 0.35em 0.8em; font-size: 0.875rem; }
.btn--lg { padding: 0.85em 1.6em; font-size: 1.05rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.inline-form { display: inline; }

/* Forms */
.form { display: grid; gap: 1rem; max-width: 640px; }
.form-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.field label, .field .label { display: block; font-weight: 700; margin-bottom: 0.3rem; font-size: 0.95rem; }
.field .hint { color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; }
/* input:not([type]) covers the many fields that rely on the default text type */
input:not([type]), input[type=text], input[type=email], input[type=number], input[type=tel], input[type=date],
input[type=datetime-local], input[type=time], input[type=search], input[type=password], input[type=url],
input[type=file], select, textarea {
  width: 100%; padding: 0.6em 0.75em; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
textarea { min-height: 90px; }
input[type=file] { padding: 0.4em; color: var(--text-2); cursor: pointer; }
input[type=file]::file-selector-button {
  margin-right: 0.75em; padding: 0.35em 0.8em; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--border); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--rs-sky); outline-offset: 1px; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: 0.85rem; margin: 0.25rem 0 0; }
.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.check input { width: 1.1rem; height: 1.1rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.5rem; }

/* Cards, badges, flash */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
:is(.grid-2, .grid-3, .steps, .industries) > .card + .card { margin-top: 0; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.badge { display: inline-block; padding: 0.15em 0.6em; border-radius: 999px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.01em; }
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--bad { background: var(--bad-bg); color: var(--bad); }
.badge--info { background: var(--info-bg); color: var(--info); }
.badge--muted { background: var(--surface-2); color: var(--muted); }
.flash { padding: 0.8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-weight: 600; }
.flash--success { background: var(--ok-bg); color: var(--ok); }
.flash--error { background: var(--bad-bg); color: var(--bad); }
.flash--info { background: var(--info-bg); color: var(--info); }
.flash--warn { background: var(--warn-bg); color: var(--warn); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 800; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:hover td { background: var(--surface-2); }
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface-2); display: block; }

/* Starfield hero (marketing, login, signup) */
.sky {
  position: relative; overflow: hidden; color: var(--rs-star);
  background: radial-gradient(ellipse at 50% 120%, var(--rs-blue-2) 0%, var(--rs-navy) 45%, var(--rs-night) 100%);
}
.sky canvas[data-starfield] { position: absolute; inset: 0; width: 100%; height: 100%; }
.sky > .sky__content { position: relative; z-index: 1; }
.sky a:not(.btn) { color: var(--rs-orange-2); }
.btn--on-dark { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.btn--on-dark:hover { background: rgba(255, 255, 255, 0.08); }

/* Site header (public) */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 2.5rem); }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; color: inherit; font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; }
.brand img { width: 40px; height: 40px; }
.brand span b { color: var(--rs-orange); font-weight: 700; }
.site-nav { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.site-nav a:not(.btn) { color: inherit; text-decoration: none; font-weight: 700; padding: 0.4rem 0.6rem; }
.site-footer { padding: 2rem clamp(1rem, 4vw, 2.5rem); color: var(--muted); font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; }
.site-footer a { color: inherit; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.grid-3 { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-2 { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

@media (max-width: 640px) {
  .site-nav a:not(.btn) { display: none; }
}
