/* Guardrail Gateway: one stylesheet, no frameworks, no scripts (the CSP forbids them).
   Look: a light SaaS dashboard. White top bar, a pale sidebar with icon links, a light grey
   page, and white rounded cards with soft borders. One blue accent; green, amber, and red only
   for status. */

/* Inter, self-hosted (SIL Open Font License), so the look is the same on every system. */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --page: #f4f5f7;
  --sidebar: #f9fafc;
  --surface: #fff;
  --surface-soft: #f8fafc;
  --text: #111827;
  --text-soft: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-soft: #eef0f3;
  --blue: #1d6cf2;
  --blue-dark: #1558cc;
  --blue-pale: #e8effc;
  --blue-wash: #eff6ff;
  --green: #16a34a;
  --green-pale: #dcfce7;
  --amber: #b45309;
  --amber-pale: #fef3c7;
  --red: #dc2626;
  --red-dark: #b91c1c;
  --red-pale: #fee2e2;
  --slate-pale: #f1f5f9;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow-raised: 0 10px 30px rgba(16, 24, 40, 0.12);
  --radius: 10px;
  --radius-small: 8px;
  --topbar-height: 78px;
  --ink: #0e0e10;
  --rail: #e7e7ea;
  --site-width: 1328px;
  --sidebar-width: 268px;
  --font:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

::selection {
  background: rgba(29, 108, 242, 0.18);
}

.icon {
  flex: none;
  width: 22px;
  height: 22px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Type ---------- */

h1 {
  margin: 0 0 0.35rem;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h2 {
  margin: 0 0 0.6rem;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.3;
}

h3 {
  margin: 0 0 0.4rem;
  font-size: 16px;
  font-weight: 600;
}

p {
  margin: 0.5rem 0;
}

strong {
  font-weight: 600;
}

.eyebrow {
  margin: 0 0 0.3rem;
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lead {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 15px;
}

.notice {
  color: var(--muted);
  font-size: 14px;
}

code {
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: var(--slate-pale);
  font-family: var(--mono);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

.page-head {
  margin: 0.25rem 0 1.5rem;
}

.page-head h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.page-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.4rem 0 1.75rem;
}

.page-title-row h1 {
  margin: 0;
  font-size: 20px;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.section-title h2 {
  margin: 0;
}

.section-title .notice {
  margin: 0.3rem 0 0;
}

/* ---------- Buttons ---------- */

form.inline {
  display: inline-block;
  margin: 0;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0 1.25rem;
  border: 1px solid var(--blue);
  border-radius: 12px;
  background: var(--blue);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
  color: #fff;
  font: inherit;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

button:hover,
.button:hover {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
  text-decoration: none;
}

button:focus-visible,
.button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

button .icon,
.button .icon {
  width: 20px;
  height: 20px;
}

button.secondary,
.button.secondary {
  border-color: var(--line-soft);
  background: var(--surface);
  color: var(--text);
}

button.secondary:hover,
.button.secondary:hover {
  border-color: var(--line);
  background: var(--surface-soft);
}

button.danger,
.button.danger {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

button.danger:hover,
.button.danger:hover {
  border-color: var(--red-dark);
  background: var(--red-dark);
}

button.small,
.button.small {
  min-height: 32px;
  padding: 0 0.8rem;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
}

button.big,
.button.big {
  min-height: 48px;
  padding: 0 1.6rem;
  font-size: 16px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

/* ---------- Forms ---------- */

label {
  display: block;
  margin: 0 0 0.35rem;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 108, 242, 0.15);
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: 0;
  accent-color: var(--blue);
}

input[type="hidden"] {
  display: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  margin: 1rem 0;
}

form.box input#confirm {
  max-width: 260px;
  margin-bottom: 0.75rem;
}

fieldset {
  margin: 0.75rem 0 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
}

legend {
  padding: 0 0.35rem;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 600;
}

fieldset label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0;
  font-weight: 400;
}

.field {
  margin: 1rem 0 0;
}

.field .hint {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 13px;
}

.input-unit {
  display: flex;
  align-items: center;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-small);
  background: var(--surface);
}

.input-unit:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 108, 242, 0.15);
}

.input-unit input {
  border: none;
  background: transparent;
}

.input-unit input:focus-visible {
  box-shadow: none;
}

.input-unit .unit {
  padding: 0 0.85rem;
  color: var(--muted);
  font-size: 13.5px;
  white-space: nowrap;
}

.save-bar {
  position: sticky;
  bottom: 1rem;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem 0.85rem 1.25rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-raised);
}

.save-bar .notice {
  margin: 0;
}

/* ---------- Status: pills, badges, banners, check lists ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.65rem;
  border-radius: 999px;
  background: var(--slate-pale);
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill.ok {
  background: var(--green-pale);
  color: var(--green);
}

.pill.warn {
  background: var(--amber-pale);
  color: var(--amber);
}

.pill.bad {
  background: var(--red-pale);
  color: var(--red);
}

.page-head .lead + .pill {
  margin-top: 0.75rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--blue-pale);
  color: var(--blue);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.live {
  background: var(--red-pale);
  color: var(--red);
}

h1 .badge {
  font-size: 13px;
}

.banner {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1.1rem;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  background: var(--blue-wash);
  color: #1e3a8a;
}

.banner.danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.banner p:first-child {
  margin-top: 0;
}

.banner p:last-child {
  margin-bottom: 0;
}

.banner .button {
  margin-top: 0.5rem;
}

.top-banner {
  margin: 0 0 1.25rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
}

.demo-banner {
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.kill-switch-on {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.top-banner a {
  color: inherit;
  text-decoration: underline;
}

.pass {
  color: var(--green);
}

.fail {
  color: var(--red);
}

.errors {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

.checks {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.checks li {
  position: relative;
  padding: 0.55rem 0 0.55rem 1.9rem;
  border-top: 1px solid var(--line-soft);
  color: var(--text-soft);
}

.checks li:first-child {
  border-top: none;
}

.checks li::before {
  position: absolute;
  top: 0.65rem;
  left: 0;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--slate-pale);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  content: "•";
}

.checks li.pass::before {
  background: var(--green-pale);
  color: var(--green);
  content: "✓";
}

.checks li.fail {
  color: #991b1b;
}

.checks li.fail::before {
  background: var(--red-pale);
  color: var(--red);
  content: "✕";
}

.checks li.unsure::before {
  background: var(--amber-pale);
  color: var(--amber);
  content: "?";
}

.checklist {
  margin: 0.5rem 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  padding: 0.3rem 0;
  color: var(--text-soft);
}

.checklist li.pass {
  color: var(--green);
  font-weight: 500;
}

/* ---------- Tables ---------- */

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

th,
td {
  padding: 0.75rem 0.85rem;
  text-align: left;
  vertical-align: middle;
}

thead th {
  padding-top: 0.4rem;
  padding-bottom: 0.8rem;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}

tbody tr + tr > * {
  border-top: 1px solid var(--line-soft);
}

tbody th {
  width: 38%;
  color: var(--muted);
  font-weight: 500;
}

.data-table thead th {
  font-size: 16px;
  font-weight: 500;
}

.data-table td:first-child,
.data-table th:first-child {
  padding-left: 0.4rem;
}

td form.inline {
  margin: 0;
}

.cell-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* ---------- Public site (home, sign-in, privacy) ----------
   Inspired by the editorial look of snaptrade.com: a framed column with thin rails, full-width
   section rules, a big medium-weight headline, near-black buttons. Our own colours and copy. */

.site {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: clip;
  background: var(--surface);
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--rail);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

.site-nav-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  max-width: var(--site-width);
  height: 84px;
  margin: 0 auto;
  padding: 0 2rem;
}

.site-links {
  display: flex;
  gap: 2rem;
}

.site-links a {
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-links a:hover {
  color: var(--blue);
  text-decoration: none;
}

.site-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.site button,
.site .button {
  min-height: 50px;
  padding: 0 1.6rem;
  border-color: var(--ink);
  border-radius: 14px;
  background: var(--ink);
  box-shadow: none;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.site button:hover,
.site .button:hover {
  border-color: #2a2a2e;
  background: #2a2a2e;
  transform: translateY(-1px);
}

.site button.secondary,
.site .button.secondary {
  border-color: var(--rail);
  background: var(--surface);
  color: var(--ink);
}

.site button.secondary:hover,
.site .button.secondary:hover {
  border-color: #c9c9cf;
  background: var(--surface);
}

.site button.big,
.site .button.big {
  min-height: 56px;
  padding: 0 1.9rem;
}

.site-frame {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  max-width: var(--site-width);
  margin: 0 auto;
  border-right: 1px solid var(--rail);
  border-left: 1px solid var(--rail);
}

.site-main {
  flex: 1;
  padding: 4.5rem 3.5rem 5rem;
}

.site-main:has(> .site-section) {
  padding: 0;
}

.site-main .page-head h1 {
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* Full-width rules between sections, drawn past the rails like a blueprint. */
.site-section {
  position: relative;
  padding: 6rem 3.5rem;
}

.site-section + .site-section::before {
  position: absolute;
  top: 0;
  right: -100vw;
  left: -100vw;
  border-top: 1px solid var(--rail);
  content: "";
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1.25rem;
  color: var(--blue);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kicker::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px var(--blue-pale);
  content: "";
}

.display {
  margin: 0;
  color: var(--ink);
  font-size: clamp(38px, 5.2vw, 60px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.06;
}

.display-2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(30px, 3.6vw, 44px);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.12;
}

.accent {
  color: var(--blue);
}

.hero-section {
  padding-top: 5.5rem;
}

.hero-copy {
  max-width: 860px;
}

/* The blue sentence always starts its own line, so a word never dangles at the end of line one. */
.hero-copy .display .accent {
  display: block;
}

.hero-lead {
  max-width: 560px;
  margin: 1.5rem 0 0;
  color: #3f3f46;
  font-size: 18px;
  line-height: 1.6;
}

.hero-section .choices {
  margin: 2rem 0 1.5rem;
}

.hero-facts {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.section-intro {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.section-intro.left {
  margin: 0;
  text-align: left;
}

.section-intro > p:last-child {
  margin: 1.25rem 0 0;
  color: #52525b;
  font-size: 17px;
  line-height: 1.6;
}

.step-row,
.limit-row {
  display: grid;
  margin: 3.5rem 0 0;
  padding: 0;
  border-top: 1px solid var(--rail);
  border-bottom: 1px solid var(--rail);
  list-style: none;
}

.step-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.limit-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.step,
.limit {
  padding: 2rem 1.75rem 2.25rem;
  border-left: 1px solid var(--rail);
  transition: background-color 0.25s ease;
}

.step:first-child,
.limit:first-child {
  border-left: none;
}

.step:hover,
.limit:hover {
  background: #fafbfd;
}

.step h3,
.limit h3 {
  margin: 0.9rem 0 0.6rem;
  color: var(--ink);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.step p,
.limit p {
  margin: 0;
  color: #52525b;
  font-size: 15px;
  line-height: 1.6;
}

.step-number {
  color: var(--blue);
  font-family: var(--mono);
  font-size: 13px;
}

.limit {
  text-align: center;
}

.limit-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--blue-pale);
  color: var(--blue);
}

.split-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 4rem;
}

.audit-preview {
  margin: 0;
  padding: 0;
  border: 1px solid var(--rail);
  border-radius: 16px;
  background: var(--surface);
  list-style: none;
}

.audit-preview li {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 0.2rem 1rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--rail);
  font-size: 14px;
}

.audit-preview li:first-child {
  border-top: none;
}

.audit-preview .audit-time {
  grid-row: span 2;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.audit-preview code {
  justify-self: start;
}

.cta-band {
  background: #f3f7fe;
  text-align: center;
}

.cta-band > p {
  max-width: 560px;
  margin: 1.25rem auto 0;
  color: #52525b;
  font-size: 17px;
}

.cta-band .choices {
  justify-content: center;
  margin-top: 2rem;
}

.site-footer {
  margin: 0;
  padding: 4.5rem 3.5rem 2.5rem;
  border-top: 1px solid var(--rail);
  color: var(--muted);
}

.site-footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2.5rem;
}

.site-footer-tagline {
  max-width: 340px;
  margin: 1rem 0 0;
  color: #52525b;
}

.site-footer-links {
  display: flex;
  gap: 4rem;
}

.site-footer-links div {
  display: grid;
  align-content: start;
  gap: 0.6rem;
}

.site-footer-links a {
  color: var(--ink);
  font-size: 14px;
}

.site-footer-heading {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rail);
  font-size: 13px;
}

.site-footer-bottom p {
  margin: 0;
}

/* Motion, CSS only: the hero rises in on load; sections reveal as they scroll into view where
   the browser supports scroll-driven animations (elsewhere they are simply visible). */
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.hero-copy > * {
  animation: rise-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-copy > :nth-child(2) {
  animation-delay: 0.06s;
}

.hero-copy > :nth-child(3) {
  animation-delay: 0.12s;
}

.hero-copy > :nth-child(4) {
  animation-delay: 0.18s;
}

.hero-copy > :nth-child(5) {
  animation-delay: 0.24s;
}

@supports (animation-timeline: view()) {
  .section-intro,
  .step,
  .limit,
  .audit-preview {
    animation: rise-in linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 35%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-copy > *,
  .section-intro,
  .step,
  .limit,
  .audit-preview {
    animation: none;
  }

  .site button,
  .site .button,
  .step,
  .limit {
    transition: none;
  }

  .site button:hover,
  .site .button:hover {
    transform: none;
  }
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: var(--topbar-height);
  padding: 0 1.75rem 0 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar-start {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  width: var(--sidebar-width);
  padding: 0 0.9rem 0 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
}

.brand-mark .icon {
  width: 21px;
  height: 21px;
}

.brand-accent {
  color: var(--blue);
}

.collapse-button {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-small);
  color: var(--text-soft);
  cursor: pointer;
}

.collapse-button:hover {
  background: var(--slate-pale);
}

.sidebar-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sidebar-toggle:focus-visible + .topbar .collapse-button {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.search form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 250px;
  height: 42px;
  padding: 0 1.1rem 0 1.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
}

.search form:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 108, 242, 0.15);
}

.search .icon {
  width: 20px;
  height: 20px;
}

.search input {
  width: 100%;
  min-width: 0;
  height: auto;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
}

.search input:focus-visible {
  outline: none;
  box-shadow: none;
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-left: auto;
}

.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
}

.icon-button:hover {
  background: var(--surface-soft);
  text-decoration: none;
}

.count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

/* Drop-down menus (<details>, so they work without JavaScript). */
.user-menu,
.card-menu {
  position: relative;
}

.user-menu summary,
.card-menu summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  list-style: none;
  cursor: pointer;
}

.user-menu summary::-webkit-details-marker,
.card-menu summary::-webkit-details-marker {
  display: none;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 0 0 1px var(--line);
  color: #fff;
  font-weight: 600;
}

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  min-width: 210px;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-raised);
}

.menu a,
.menu .menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 0;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: 6px;
  background: none;
  box-shadow: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  text-align: left;
  justify-content: flex-start;
}

.menu a:hover,
.menu .menu-item:hover {
  background: var(--slate-pale);
  text-decoration: none;
}

.menu .icon {
  width: 18px;
  height: 18px;
}

.menu-head {
  margin: 0 0 0.25rem;
  padding: 0.4rem 0.65rem 0.55rem;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* ---------- Sidebar and page shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-height));
}

.sidebar {
  position: sticky;
  top: var(--topbar-height);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-height));
  padding: 2.75rem 1.25rem 1.5rem;
  overflow-y: auto;
  border-right: 1px solid var(--line-soft);
  background: var(--sidebar);
}

.nav-list {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  min-height: 38px;
  padding: 0.45rem 0.6rem;
  border: none;
  border-radius: 5px;
  background: none;
  box-shadow: none;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  justify-content: flex-start;
  cursor: pointer;
}

.nav-link:hover {
  background: var(--slate-pale);
  text-decoration: none;
}

.nav-link.active {
  background: var(--blue-pale);
  color: var(--blue);
}

.nav-divider {
  width: 100%;
  margin: 1.6rem 0;
  border: none;
  border-top: 1px solid var(--line);
}

.nav-status {
  display: grid;
  gap: 0.5rem;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 5px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
}

.status-row:hover {
  background: var(--slate-pale);
  text-decoration: none;
}

.nav-bottom {
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 2rem;
}

.nav-bottom .nav-link {
  color: var(--text-soft);
  font-size: 15px;
}

.nav-bottom form.inline {
  display: block;
}

/* The collapse button (a CSS-only toggle) shrinks the sidebar to its icons. */
.sidebar-toggle:checked ~ .shell {
  grid-template-columns: 84px minmax(0, 1fr);
}

.sidebar-toggle:checked ~ .shell .sidebar {
  padding-right: 0.75rem;
  padding-left: 0.75rem;
}

.sidebar-toggle:checked ~ .shell .nav-text {
  display: none;
}

.sidebar-toggle:checked ~ .shell .nav-link,
.sidebar-toggle:checked ~ .shell .status-row {
  justify-content: center;
}

.sidebar-toggle:checked ~ .shell .status-row .badge {
  padding: 0.2rem 0.4rem;
  font-size: 0;
}

.sidebar-toggle:checked ~ .shell .status-row .badge::before {
  margin: 0;
}

.main {
  min-width: 0;
  padding: 1.5rem 1.75rem 2rem;
}

.app-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.app-footer p {
  margin: 0.2rem 0;
}

/* ---------- Cards ---------- */

.main > section:not(.banner),
.box,
.card {
  margin: 0 0 1.5rem;
  padding: 1.35rem 1.4rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.box .box {
  background: var(--surface-soft);
  box-shadow: none;
}

.box > .eyebrow {
  margin-bottom: 0.4rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-grid > * {
  margin: 0;
}

section.danger-zone {
  border-color: #fecaca;
}

.danger-zone > .eyebrow {
  color: var(--red);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.card-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.card-note {
  color: var(--muted);
  font-size: 13px;
}

.card-icon {
  color: var(--blue);
}

.card-menu summary {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--text-soft);
}

.card-menu summary:hover {
  background: var(--slate-pale);
}

/* ---------- Stat cards ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1rem, 2.4vw, 2.25rem);
  margin-bottom: 1.5rem;
}

.stat-card {
  display: grid;
  gap: 0.8rem;
  padding: 1.1rem 1rem 1.15rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-small);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
}

.stat-card:hover {
  border-color: #cfdcf5;
  text-decoration: none;
}

.stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.stat-label {
  font-size: 17px;
  font-weight: 500;
}

.stat-icon {
  color: var(--blue);
}

.stat-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
}

.stat-value {
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.stat-detail {
  color: var(--text-soft);
  font-size: 14px;
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--slate-pale);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.trend::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.trend.ok {
  background: var(--green-pale);
  color: var(--green);
}

.trend.warn {
  background: var(--amber-pale);
  color: var(--amber);
}

.trend.bad {
  background: var(--red-pale);
  color: var(--red);
}

/* ---------- Charts, recent orders, and the AI card ---------- */

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.05fr) minmax(0, 1fr);
  gap: 1.5rem 1.85rem;
  margin-bottom: 1.5rem;
}

.overview-grid > .card {
  margin: 0;
}

.chart-card .card-head {
  margin: 0.6rem 0 0.75rem;
}

.chart {
  margin: 0;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-svg text {
  fill: #4b5563;
  font-family: var(--font);
  font-size: 11.5px;
}

.chart-svg .grid {
  stroke: #e5e7eb;
  stroke-dasharray: 3 3;
}

.chart-svg .line {
  fill: none;
  stroke-width: 1.6;
}

.chart-svg .point {
  fill: #fff;
  stroke-width: 1.3;
}

.series.cyan .line,
.series.cyan .point {
  stroke: #38bdf8;
}

.series.green .line,
.series.green .point {
  stroke: #22c55e;
}

.bar.blue {
  fill: var(--blue);
}

.bar.sky {
  fill: #60a5fa;
}

.bar.pale {
  fill: #bfdbfe;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.25rem;
  margin: 0.75rem 0 0;
  padding: 0;
  color: #4b5563;
  font-size: 13px;
  list-style: none;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.swatch {
  display: inline-block;
}

.swatch.dot {
  width: 9px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.swatch.square {
  width: 10px;
  height: 10px;
  border-radius: 1px;
  background: currentColor;
}

.swatch.cyan {
  color: #38bdf8;
}

.swatch.green {
  color: #22c55e;
}

.swatch.blue {
  color: var(--blue);
}

.swatch.sky {
  color: #60a5fa;
}

.swatch.pale {
  color: #bfdbfe;
}

.table-card .card-head {
  margin: 0.3rem 0 1.4rem;
}

.order-id {
  color: var(--text);
  white-space: nowrap;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.order-name {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;
}

.side-chip {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 28px;
  padding: 0 0.5rem;
  border-radius: 6px;
  background: var(--blue-pale);
  color: var(--blue);
  font-size: 12.5px;
  font-weight: 600;
}

.side-chip.sell {
  background: #fdf2e9;
  color: #c2410c;
}

.order-id:hover {
  color: var(--blue);
}

.box button + .notice {
  margin-left: 0.6rem;
}

.ai-card {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 50% 34%, rgba(29, 108, 242, 0.1), transparent 52%), var(--surface);
}

.ai-card .card-head {
  margin: 0.3rem 0 0;
}

.orb {
  flex: none;
  width: 58px;
  height: 58px;
  margin: 1.4rem auto 1.6rem;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #5b9bff 0%, #2563eb 48%, #1d4ed8 78%);
  box-shadow:
    0 0 0 9px rgba(29, 108, 242, 0.07),
    0 0 36px 16px rgba(29, 108, 242, 0.22),
    inset 0 -5px 10px rgba(12, 40, 120, 0.35);
}

.ai-steps {
  margin: 0 0 0.9rem;
  color: var(--text-soft);
  font-size: 13.5px;
}

.ask-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.9rem;
  padding: 0.4rem 0.45rem 0.4rem 1.1rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.06);
}

.ask-pill code {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-soft);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
}

.send-button {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
}

.send-button .icon {
  width: 17px;
  height: 17px;
}

/* ---------- Approval page ---------- */

/* The one line a person reads first, in the same dark card the home page shows. */
.order-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.6rem 1.75rem;
  border-color: #111317;
  border-radius: 16px;
  background: #111317;
  box-shadow: 0 24px 50px -28px rgba(29, 108, 242, 0.55);
  color: #fff;
}

.order-hero p {
  margin: 0;
}

.order-hero .big {
  margin-top: 0.25rem;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.order-hero .value {
  margin-top: 0.25rem;
  font-size: 28px;
  font-weight: 500;
  text-align: right;
}

.card .label {
  color: var(--muted);
  font-size: 13.5px;
}

.card.order-hero .label {
  color: #9ca3af;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  align-items: start;
  gap: 1.5rem;
}

.split > * {
  margin: 0;
}

.stack {
  display: grid;
  gap: 1.5rem;
}

.stack > * {
  margin: 0;
}

.sticky {
  position: sticky;
  top: calc(var(--topbar-height) + 1.25rem);
}

.decision-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* ---------- Dashboard lists ---------- */

.list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line-soft);
}

.list-row:first-child {
  border-top: none;
}

.list-title {
  margin: 0;
  font-weight: 600;
}

.list-meta {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.empty {
  padding: 0.95rem 1.25rem 1.25rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-soft);
  text-align: center;
}

.empty p {
  margin: 0.3rem 0 0;
}

.box form + p {
  margin-top: 0.75rem;
}

/* ---------- Guided demo ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.steps > .box {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.steps > .box form {
  margin-top: auto;
  padding-top: 0.75rem;
}

[id] {
  scroll-margin-top: calc(var(--topbar-height) + 1rem);
}

/* ---------- Smaller screens ---------- */

@media (max-width: 1180px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Below ~900px the sidebar becomes a scrolling row of links under the top bar. */
@media (max-width: 900px) {
  :root {
    --topbar-height: 64px;
  }

  .topbar {
    gap: 0.75rem;
    padding: 0 1rem;
  }

  .topbar-start {
    width: auto;
    padding: 0;
  }

  .collapse-button {
    display: none;
  }

  .search {
    flex: 1;
    min-width: 0;
  }

  .search form {
    width: 100%;
    padding-left: 1rem;
  }

  .shell,
  .sidebar-toggle:checked ~ .shell {
    display: block;
  }

  .sidebar {
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    height: auto;
    padding: 0.5rem 1rem;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--line-soft);
  }

  .nav-list,
  .nav-bottom {
    display: flex;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
  }

  .nav-link {
    gap: 0.45rem;
    font-size: 14px;
  }

  .nav-link .icon {
    width: 18px;
    height: 18px;
  }

  .nav-divider {
    display: none;
  }

  .nav-status {
    display: flex;
    flex: none;
  }

  .sidebar-toggle:checked ~ .shell .nav-text {
    display: inline;
  }

  .main {
    padding: 1.25rem 1rem 2rem;
  }

  .card-grid,
  .split,
  .steps,
  .form-grid,
  .split-section,
  .step-row,
  .limit-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .site-links {
    display: none;
  }

  .site-nav-inner {
    grid-template-columns: auto 1fr;
    padding: 0 1rem;
  }

  .site-section,
  .site-main {
    padding: 4rem 1.25rem;
  }

  .step,
  .limit {
    border-top: 1px solid var(--rail);
    border-left: none;
  }

  .step:first-child,
  .limit:first-child {
    border-top: none;
  }

  .sticky {
    position: static;
  }
}

@media (max-width: 640px) {
  .brand > span:last-child {
    display: none;
  }

  .topbar-end {
    gap: 0.5rem;
  }

  .icon-button,
  .avatar {
    width: 38px;
    height: 38px;
  }

  .user-menu summary .icon {
    display: none;
  }

  .stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-actions,
  .page-actions .button,
  .page-actions form,
  .page-actions button {
    width: 100%;
  }

  .order-hero .value {
    text-align: left;
  }
}
