:root {
  --font-heading: "Space Grotesk", "Outfit", sans-serif;
  --font-body: "Public Sans", "Inter", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;

  --bg: #f2f7ff;
  --bg-soft: #e7f0ff;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --surface-muted: rgba(242, 247, 255, 0.92);
  --ink: #101d34;
  --ink-soft: #4a5f84;
  --line: rgba(22, 44, 82, 0.14);
  --line-strong: rgba(22, 44, 82, 0.24);
  --accent: #0f9868;
  --accent-2: #2a6fe8;
  --accent-3: #f37f34;
  --danger: #ce3e4f;
  --success: #148a5d;

  --shadow-soft: 0 20px 40px rgba(17, 34, 62, 0.12);
  --shadow-strong: 0 26px 56px rgba(17, 34, 62, 0.2);

  --radius-2xl: 28px;
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 12px;
  --radius-sm: 10px;
}

:root[data-theme="dark"] {
  --bg: #081324;
  --bg-soft: #0f2038;
  --surface: rgba(12, 27, 47, 0.86);
  --surface-strong: rgba(16, 33, 57, 0.96);
  --surface-muted: rgba(12, 24, 43, 0.92);
  --ink: #e5efff;
  --ink-soft: #9eb3d6;
  --line: rgba(174, 203, 255, 0.15);
  --line-strong: rgba(174, 203, 255, 0.28);
  --accent: #23bd87;
  --accent-2: #60a5ff;
  --accent-3: #f5a24e;
  --danger: #f86f82;
  --success: #48d298;

  --shadow-soft: 0 24px 52px rgba(2, 6, 12, 0.48);
  --shadow-strong: 0 30px 68px rgba(2, 6, 12, 0.62);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(980px 620px at -6% -2%, rgba(35, 189, 135, 0.22), transparent 56%),
    radial-gradient(960px 620px at 110% 8%, rgba(42, 111, 232, 0.24), transparent 58%),
    linear-gradient(178deg, var(--bg) 0%, var(--bg-soft) 68%, var(--bg) 100%);
  padding: 24px clamp(14px, 2.5vw, 34px) 34px;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 38px 38px;
  opacity: 0.18;
  pointer-events: none;
  z-index: -2;
}

.bg-glow {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(10px);
  pointer-events: none;
  opacity: 0.7;
}

.bg-glow.a {
  width: 340px;
  height: 340px;
  top: -100px;
  left: -74px;
  background: radial-gradient(circle at 30% 32%, rgba(35, 189, 135, 0.6), rgba(35, 189, 135, 0));
  animation: floatA 18s ease-in-out infinite;
}

.bg-glow.b {
  width: 430px;
  height: 430px;
  right: -130px;
  bottom: -130px;
  background: radial-gradient(circle at 70% 24%, rgba(96, 165, 255, 0.58), rgba(96, 165, 255, 0));
  animation: floatB 22s ease-in-out infinite;
}

@keyframes floatA {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(14px, 20px, 0);
  }
}

@keyframes floatB {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-18px, -18px, 0);
  }
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

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

.hidden {
  display: none !important;
}

.shell {
  max-width: 1280px;
  margin: 0 auto;
}

.shell.wide {
  max-width: 1460px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 14px 16px;
  backdrop-filter: blur(12px);
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--font-heading);
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 62%, var(--accent-3) 100%);
  box-shadow: 0 14px 24px rgba(20, 67, 132, 0.24);
}

.brand-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

.brand-title {
  font-size: clamp(20px, 2.5vw, 30px);
  line-height: 1.06;
}

.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--surface-muted);
}

.badge.ok {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 45%, transparent);
  background: color-mix(in srgb, var(--success) 16%, transparent);
}

.theme-btn,
.btn {
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 10px 14px;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

.theme-btn:hover,
.btn:hover {
  transform: translateY(-1px);
}

.theme-btn {
  background: var(--surface-muted);
  border-color: var(--line);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 66%, var(--accent-3) 100%);
  box-shadow: 0 16px 26px color-mix(in srgb, var(--accent-2) 32%, transparent);
}

.btn.secondary {
  border-color: var(--line-strong);
  background: var(--surface-strong);
}

.btn.ghost {
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--ink-soft);
}

.link {
  color: var(--accent-2);
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.note {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.note.error {
  color: var(--danger);
}

.note.success {
  color: var(--success);
}

.auth-layout {
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 18px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-strong);
}

.auth-card,
.info-card {
  padding: clamp(18px, 3.2vw, 34px);
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.auth-card h2 {
  margin-top: 12px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.03;
}

.auth-card .subtitle {
  margin-top: 10px;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.52;
}

.stack {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.input-wrap {
  display: grid;
  gap: 6px;
}

.input-wrap label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  padding: 11px 12px;
}

.input:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent-2) 44%, transparent);
  outline-offset: 1px;
}

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

.actions {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.divider {
  margin: 2px 0;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
}

.panel-list {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.feature {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface-muted) 92%, transparent);
  padding: 12px;
}

.feature h3 {
  font-size: 17px;
}

.feature p {
  margin-top: 6px;
  color: var(--ink-soft);
  line-height: 1.45;
  font-size: 14px;
}

.links-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 13px;
}

.docs-layout {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 14px;
}

.sidebar,
.viewer,
.quickflow {
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  background: var(--surface);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
}

.sidebar {
  min-height: 72vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
}

.sidebar-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.search {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--surface-strong);
}

.zone-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.zone-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--surface-muted);
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-soft);
}

.zone-btn.active {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent-2) 60%, transparent);
  background: color-mix(in srgb, var(--accent-2) 18%, transparent);
}

.section-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

.doc-list {
  padding: 12px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.doc-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-align: left;
  padding: 10px;
  background: color-mix(in srgb, var(--surface-strong) 90%, transparent);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}

.doc-item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent-2) 46%, transparent);
}

.doc-item.active {
  border-color: color-mix(in srgb, var(--accent) 56%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.doc-title {
  display: block;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
}

.doc-meta {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: var(--ink-soft);
  word-break: break-word;
}

.viewer-stack {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.quickflow {
  padding: 14px;
}

.quickflow h2 {
  font-size: clamp(20px, 2vw, 28px);
}

.quickflow .subtitle {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 14px;
}

.flow-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.flow-btn {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface-muted) 90%, transparent);
  padding: 10px;
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}

.flow-btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent-2) 52%, transparent);
}

.flow-step {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--ink-soft);
}

.flow-title {
  margin-top: 5px;
  display: block;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
}

.flow-desc {
  margin-top: 4px;
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.35;
}

.viewer {
  min-height: 62vh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.viewer-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.viewer-head h2 {
  font-size: clamp(24px, 2.8vw, 38px);
  line-height: 1.04;
}

.viewer-path {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 13px;
  word-break: break-word;
}

.viewer-body {
  padding: 22px;
  overflow: auto;
}

.placeholder {
  color: var(--ink-soft);
}

.md h1,
.md h2,
.md h3,
.md h4,
.md h5,
.md h6 {
  margin: 22px 0 10px;
  line-height: 1.2;
}

.md h1 {
  font-size: 34px;
}

.md h2 {
  font-size: 28px;
}

.md h3 {
  font-size: 22px;
}

.md p {
  margin: 10px 0;
  line-height: 1.66;
}

.md ul,
.md ol {
  margin: 10px 0;
  padding-left: 22px;
}

.md li {
  margin: 6px 0;
  line-height: 1.55;
}

.md hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

.md blockquote {
  margin: 12px 0;
  border-left: 3px solid color-mix(in srgb, var(--accent-2) 58%, transparent);
  background: color-mix(in srgb, var(--accent-2) 11%, transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 12px;
  color: var(--ink-soft);
}

.md code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--line-strong) 32%, transparent);
}

.md pre {
  margin: 12px 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 12px;
  background: #09172a;
  color: #d8e7ff;
  overflow: auto;
}

.md pre code {
  padding: 0;
  background: transparent;
}

.md a {
  color: var(--accent-2);
  text-decoration: none;
}

.md a:hover {
  text-decoration: underline;
}

.fade-in {
  animation: riseIn 260ms ease;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 1080px) {
  .auth-layout,
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: 46vh;
  }

  .viewer {
    min-height: 56vh;
  }
}

@media (max-width: 760px) {
  body {
    padding: 14px 10px 24px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

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

  .viewer-head {
    flex-direction: column;
  }

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