:root {
  --bg: #060606;
  --bg-alt: #101010;
  --panel: rgba(12, 12, 12, 0.9);
  --panel-soft: rgba(18, 18, 18, 0.78);
  --text: #f5f2ed;
  --muted: #b0a8a0;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #e10600;
  --accent-strong: #ff4d42;
  --accent-dark: #660300;
  --ok: #16a34a;
  --warn: #f59e0b;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.32);
}

:root[data-theme="light"] {
  --bg: #f3efe8;
  --bg-alt: #fff8f3;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-soft: rgba(255, 255, 255, 0.82);
  --text: #111111;
  --muted: #57534e;
  --line: rgba(17, 17, 17, 0.08);
  --accent: #cb0000;
  --accent-strong: #1a1a1a;
  --accent-dark: #6b0400;
  --ok: #15803d;
  --warn: #b45309;
  --shadow: 0 24px 64px rgba(121, 95, 78, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(225, 6, 0, 0.22), transparent 32%),
    radial-gradient(circle at top right, rgba(255, 77, 66, 0.14), transparent 22%),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-alt) 100%);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent);
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.page-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(9, 9, 9, 0.52);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

:root[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.74);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-copy h1,
.brand-copy p,
.hero-copy h2,
.hero-copy p,
.section-head h3,
.section-head p,
.status-value,
.result-box h3,
.history-card h3,
.label,
.login-side h1,
.login-side p,
.login-card h2,
.logo-badge span {
  margin: 0;
}

.brand-copy h1,
.hero-copy h2,
.section-head h3,
.login-side h1,
.login-card h2 {
  font-family: "Bahnschrift", "Franklin Gothic Medium", "Arial Narrow", sans-serif;
  letter-spacing: 0.03em;
}

.brand-copy h1 {
  font-size: clamp(1.7rem, 2vw, 2.3rem);
  text-transform: uppercase;
}

.brand-copy p,
.hero-copy p,
.section-head p,
.muted,
.hint,
.login-side p,
.login-footer,
.history-meta,
.status-label,
.status-copy {
  color: var(--muted);
}

.brand-logo {
  width: 168px;
  max-width: 38vw;
  display: block;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.28));
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
}

.theme-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.theme-rail {
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(90deg, #111111, #737373);
  position: relative;
}

.theme-rail::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 180ms ease;
}

.theme-switch input:checked + .theme-rail::after {
  transform: translateX(24px);
}

.chip,
.provider-badge,
.logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.provider-badge.live {
  color: #d1fae5;
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.25);
}

.provider-badge.demo {
  color: #fee2e2;
  background: rgba(225, 6, 0, 0.14);
  border-color: rgba(225, 6, 0, 0.24);
}

.provider-badge.warn {
  color: #ffedd5;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.24);
}

.button,
.button-ghost,
.button-light {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 16px;
  border: 0;
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.button {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 14px 28px rgba(225, 6, 0, 0.28);
}

.button:hover,
.button-light:hover,
.button-ghost:hover {
  transform: translateY(-1px);
}

.button:disabled,
.button-light:disabled,
.button-ghost:disabled {
  cursor: wait;
  opacity: 0.72;
}

.button-light {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

:root[data-theme="light"] .button-light {
  background: rgba(17, 17, 17, 0.04);
}

.button-ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  margin-bottom: 18px;
}

.hero-panel,
.card,
.login-side,
.login-card {
  border-radius: 28px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 28px;
  background:
    linear-gradient(145deg, rgba(225, 6, 0, 0.94), rgba(35, 4, 4, 0.94)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent);
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -10% -26% auto;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 65%);
}

.hero-kicker,
.logo-badge {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
}

.hero-copy h2 {
  font-size: clamp(2rem, 3.3vw, 3rem);
  line-height: 0.95;
  margin-top: 14px;
  margin-bottom: 14px;
  text-transform: uppercase;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.hero-stat {
  padding: 18px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-stat strong {
  display: block;
  font-size: 1.6rem;
  font-family: "Bahnschrift", "Franklin Gothic Medium", "Arial Narrow", sans-serif;
  margin-bottom: 6px;
}

.hero-side {
  display: grid;
  gap: 18px;
}

.card {
  background: var(--panel);
  padding: 24px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.section-head h3 {
  font-size: 1.35rem;
  text-transform: uppercase;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .field-full {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 8px;
}

.label {
  font-weight: 700;
  font-size: 0.94rem;
}

.input,
.textarea,
.select {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 14px 16px;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: rgba(225, 6, 0, 0.55);
  box-shadow: 0 0 0 4px rgba(225, 6, 0, 0.16);
}

:root[data-theme="light"] .input,
:root[data-theme="light"] .textarea,
:root[data-theme="light"] .select {
  background: rgba(17, 17, 17, 0.03);
}

.textarea {
  resize: vertical;
  min-height: 166px;
}

.preview-box,
.result-box,
.status-list,
.history-list,
.login-note {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-soft);
}

.preview-box,
.result-box {
  padding: 18px;
}

.preview-box strong,
.result-box strong {
  display: block;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

.preview-text,
.result-text {
  font-size: 1.08rem;
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.status-list,
.history-list {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.status-row,
.history-item {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

:root[data-theme="light"] .status-row,
:root[data-theme="light"] .history-item {
  background: rgba(17, 17, 17, 0.03);
}

.status-row strong,
.history-item strong {
  font-size: 0.98rem;
}

.status-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.status-value {
  font-size: 1rem;
}

.result-box.ok {
  border-color: rgba(22, 163, 74, 0.32);
}

.result-box.error {
  border-color: rgba(225, 6, 0, 0.32);
}

.result-meta,
.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  font-size: 0.86rem;
}

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

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
}

.login-side {
  padding: 34px;
  background:
    linear-gradient(145deg, rgba(225, 6, 0, 0.92), rgba(24, 4, 4, 0.92)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent);
  position: relative;
  overflow: hidden;
}

.login-side::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  bottom: -120px;
  right: -70px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.24), transparent 70%);
}

.login-side h1 {
  margin-top: 22px;
  margin-bottom: 14px;
  font-size: clamp(2.2rem, 4.2vw, 3.8rem);
  line-height: 0.92;
  text-transform: uppercase;
}

.login-card {
  padding: 34px;
  background: var(--panel);
}

.login-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-note {
  margin-top: 18px;
  padding: 16px 18px;
}

.login-footer {
  margin-top: 20px;
  font-size: 0.92rem;
}

.banner-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.logo-badge {
  width: fit-content;
  margin-bottom: 16px;
}

.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;
}

@media (max-width: 1024px) {
  .hero,
  .grid,
  .login-shell {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 12px;
  }

  .topbar,
  .card,
  .hero-panel,
  .login-side,
  .login-card {
    border-radius: 22px;
  }

  .topbar,
  .section-head,
  .brand-lockup,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }
}
