:root {
  --bg: #0f1419;
  --surface: #1a2029;
  --surface-2: #252c38;
  --border: #2d3643;
  --text: #e8ecf1;
  --text-muted: #8b95a5;
  --accent: #4c8eff;
  --accent-hover: #6aa1ff;
  --green: #3fb950;
  --red: #f85149;
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

header.topnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header.topnav .brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

header.topnav .brand .tag {
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  margin-left: 10px;
  font-weight: 500;
}

header.topnav nav a {
  color: var(--text-muted);
  text-decoration: none;
  margin-right: 24px;
  font-weight: 500;
}

header.topnav nav a:hover, header.topnav nav a.active { color: var(--text); }

header.topnav .userbox {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

header.topnav .userbox form { margin: 0; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px;
}

h1 { font-size: 22px; font-weight: 600; margin: 0 0 8px 0; letter-spacing: -0.02em; }
h2 { font-size: 16px; font-weight: 600; margin: 28px 0 12px 0; letter-spacing: -0.01em; }
p { color: var(--text-muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.card.totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
.card.totals .metric {
  padding: 6px 24px 6px 0;
  border-right: 1px solid var(--border);
}
.card.totals .metric:last-child { border-right: none; }
.card.totals .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.card.totals .value { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

.num { text-align: right; font-variant-numeric: tabular-nums; }
.green { color: var(--green); }
.red { color: var(--red); }
.ticker {
  font-weight: 600;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 12px;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: var(--accent-hover); }
.btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn.secondary:hover { background: var(--surface-2); }
.btn.small { padding: 4px 10px; font-size: 12px; }

form.stack > * { display: block; width: 100%; margin-bottom: 16px; }
label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; display: block; font-weight: 500; }
input[type="text"], input[type="password"], input[type="number"], select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  width: 100%;
}
input:focus, select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

.side-picker { display: flex; gap: 8px; }
.side-picker input[type="radio"] { display: none; }
.side-picker label {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 10px 16px;
  text-align: center;
  border-radius: var(--radius);
  cursor: pointer;
  margin: 0;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.side-picker input[type="radio"]:checked + label { background: var(--accent); border-color: var(--accent); color: white; }

.login-shell {
  max-width: 400px;
  margin: 80px auto;
  padding: 32px;
}
.login-shell h1 { text-align: center; margin-bottom: 8px; }
.login-shell .sub { text-align: center; color: var(--text-muted); margin-bottom: 32px; font-size: 13px; }

.order-ref {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 13px;
  background: var(--surface-2);
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: inline-block;
  color: var(--accent);
}

.notice {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
}

.error {
  background: rgba(248, 81, 73, 0.1);
  border-left: 3px solid var(--red);
  color: #ffa19c;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
}

.pagination {
  margin-top: 20px;
  text-align: center;
}

.demo-banner {
  background: linear-gradient(90deg, rgba(76,142,255,0.08), transparent);
  border-bottom: 1px solid var(--border);
  padding: 8px 32px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}
.demo-banner strong { color: var(--text); }

/* Login-page two-column layout: contextual "About this demo" panel sitting
   beside the sign-in form. Falls back to a single column under 760px. */
.demo-intro {
  max-width: 920px;
  margin: 56px auto;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 24px;
  align-items: start;
}

/* Both cards share the same padding so their inner content aligns. */
.demo-intro .about,
.demo-intro .login-shell { padding: 32px; }

/* Override the standalone .login-shell defaults when nested in the grid. */
.demo-intro .login-shell {
  max-width: none;
  margin: 0;
}

.demo-intro .about .auth-tag {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* No size overrides on h2/p — inherit the global scale and build hierarchy
   via spacing, weight, and color. */
.demo-intro .about h2 { margin: 0 0 14px; }
.demo-intro .about p {
  margin: 0 0 12px;
  line-height: 1.6;
}
.demo-intro .about p:last-of-type { margin-bottom: 16px; }

.demo-intro .about .siblings {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
}
.demo-intro .about .siblings .label,
.demo-intro .about .siblings .current { color: var(--text); font-weight: 500; }

.demo-intro .about a { color: var(--accent); text-decoration: none; }
.demo-intro .about a:hover { text-decoration: underline; }
.demo-intro .about a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.demo-intro .about code {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 0.92em;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--text);
}

@media (max-width: 760px) {
  .demo-intro {
    grid-template-columns: 1fr;
    margin: 32px auto;
    gap: 16px;
  }
  .demo-intro .about,
  .demo-intro .login-shell { padding: 24px; }
}
