:root {
  --ink: #151515;
  --muted: #676b6f;
  --paper: #f7f8f1;
  --panel: rgba(255, 255, 255, 0.84);
  --line: rgba(21, 21, 21, 0.13);
  --lime: #c8ff4d;
  --blue: #4d83ff;
  --coral: #ff715b;
  --mint: #5ee5b7;
  --yellow: #ffd166;
  --violet: #8d78ff;
  --radius: 8px;
  --shadow: 0 24px 70px rgba(21, 21, 21, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, rgba(200, 255, 77, 0.14), transparent 28%),
    linear-gradient(220deg, rgba(77, 131, 255, 0.16), transparent 31%),
    linear-gradient(180deg, #fbfbf5 0%, #eef2ec 54%, #f7f4ed 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.is-hidden {
  display: none !important;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  gap: 24px;
  padding: 28px;
}

.auth-visual {
  min-height: calc(100vh - 56px);
  min-width: 0;
  display: grid;
  align-content: space-between;
  gap: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  background: linear-gradient(
      135deg,
      rgba(21, 21, 21, 0.98),
      rgba(21, 21, 21, 0.9)
    ),
    linear-gradient(120deg, var(--lime), var(--blue));
  color: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 950;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--lime);
  color: #111;
}

.auth-copy {
  max-width: 720px;
  min-width: 0;
}

.auth-copy h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.92;
  letter-spacing: 0;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.auth-copy p {
  margin: 18px 0 0;
  max-width: 620px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 17px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

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

.auth-stat {
  min-height: 112px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  padding: 15px;
  background: rgba(255, 255, 255, 0.08);
}

.auth-stat strong {
  display: block;
  font-size: 24px;
  line-height: 1;
  color: var(--lime);
  font-weight: 950;
}

.auth-stat span {
  display: block;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.auth-panel {
  align-self: stretch;
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 16px;
  min-height: calc(100vh - 56px);
}

.auth-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.auth-card {
  min-width: 0;
  padding: 22px;
}

.auth-card h2,
.panel h2,
.panel h3,
p {
  margin: 0;
}

.auth-card h2,
.panel h2 {
  font-size: 19px;
  line-height: 1.2;
  font-weight: 950;
}

.subcopy {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.48;
}

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

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

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

.field-wrap.span-2 {
  grid-column: span 2;
}

.label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.field {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.field:focus {
  border-color: rgba(77, 131, 255, 0.64);
  box-shadow: 0 0 0 4px rgba(77, 131, 255, 0.12);
}

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

.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 13px;
  background: #151515;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn.primary {
  background: var(--lime);
  color: #111;
}
.btn.blue {
  background: var(--blue);
  color: #fff;
}
.btn.coral {
  background: var(--coral);
  color: #111;
}
.btn.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

.log {
  min-height: 40px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.login-note {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.social-auth {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  padding: 14px;
}

.social-auth h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 950;
}

.social-auth-mount {
  margin-top: 12px;
  min-height: 44px;
}

.note-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 9px;
  align-items: start;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.note-dot {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #151515;
  color: var(--lime);
}

.note-dot svg {
  width: 15px;
  height: 15px;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  position: sticky;
  top: 0;
  padding: 22px;
  background: rgba(21, 21, 21, 0.97);
  color: #fff;
}

.side-copy {
  margin-top: 20px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 13px;
  line-height: 1.5;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.nav-link {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: var(--radius);
  padding: 0 11px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 14px;
  font-weight: 850;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.nav-link svg {
  width: 17px;
  height: 17px;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1;
  font-weight: 950;
}

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

.status-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--coral);
}

.dot.ok {
  background: var(--mint);
}

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

.panel {
  padding: 18px;
  overflow: hidden;
}

.span-3 {
  grid-column: span 3;
}
.span-4 {
  grid-column: span 4;
}
.span-5 {
  grid-column: span 5;
}
.span-6 {
  grid-column: span 6;
}
.span-7 {
  grid-column: span 7;
}
.span-8 {
  grid-column: span 8;
}
.span-9 {
  grid-column: span 9;
}
.span-12 {
  grid-column: span 12;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.metric {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
}

.metric strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 27px;
  line-height: 1;
  font-weight: 950;
}

.metric.compact strong {
  font-size: 14px;
  line-height: 1.25;
}

.metric span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.checklist {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.check-item {
  min-height: 42px;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  padding: 8px 10px;
}

.check-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(21, 21, 21, 0.08);
}

.check-icon.ok {
  background: var(--mint);
}
.check-icon.warn {
  background: var(--yellow);
}

.check-item strong {
  display: block;
  font-size: 13px;
  font-weight: 950;
}

.check-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.tag {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  background: #151515;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.tag.ok {
  background: #0e6b4c;
}
.tag.warn {
  background: #7b5a00;
}
.tag.off {
  background: #9f2f22;
}

.code {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: #101011;
  color: #f8f8ef;
}

.code-head {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 900;
}

pre {
  margin: 0;
  max-height: 270px;
  overflow: auto;
  padding: 14px;
  font:
    12px/1.65 "SFMono-Regular",
    Consolas,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 6px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

td {
  overflow-wrap: anywhere;
}

.flow {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.flow-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
}

.flow-index {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #151515;
  color: var(--lime);
  font-weight: 950;
}

.flow-step h3 {
  font-size: 14px;
  font-weight: 950;
}

.flow-step p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.portal-footer {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.portal-footer a {
  color: var(--ink);
  text-decoration: none;
}

@media (max-width: 1080px) {
  .auth-gate {
    grid-template-columns: minmax(0, 1fr);
  }
  .auth-visual,
  .auth-panel {
    min-height: auto;
  }
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    min-height: auto;
    position: relative;
  }
  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .topbar-actions {
    justify-content: flex-start;
  }
  .span-3,
  .span-4,
  .span-5,
  .span-6,
  .span-7,
  .span-8,
  .span-9,
  .span-12 {
    grid-column: span 12;
  }
}

@media (max-width: 680px) {
  body {
    overflow-x: hidden;
  }

  .auth-gate,
  .main {
    padding: 14px;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .auth-visual,
  .auth-panel,
  .auth-card {
    width: 100%;
    max-width: calc(100vw - 28px);
  }

  .auth-copy,
  .auth-copy h1,
  .auth-copy p,
  .auth-stat {
    width: 100%;
    max-width: 100%;
  }

  .auth-strip,
  .metric-row,
  .form,
  .nav-list {
    grid-template-columns: minmax(0, 1fr);
  }
  .field-wrap.span-2 {
    grid-column: span 1;
  }
  .auth-copy h1 {
    font-size: 38px;
    line-height: 1;
  }
  .btn {
    min-width: 0;
    white-space: normal;
    text-align: center;
  }
  .check-item {
    grid-template-columns: 30px 1fr;
  }
  .check-item .tag {
    grid-column: 2;
    width: max-content;
  }
}

/* Login: collapsed advanced (API URL), out of the user's way but available. */
.auth-card details.advanced { margin: 4px 0 2px; }
.auth-card details.advanced > summary {
  cursor: pointer; font-size: 12px; color: var(--muted, #9bb0a3);
  list-style: none; user-select: none; padding: 4px 0;
}
.auth-card details.advanced > summary::-webkit-details-marker { display: none; }
.auth-card details.advanced[open] > summary { margin-bottom: 8px; }

/* Login: Clerk-primary layout helpers */
.auth-card .social-auth { margin-top: 4px; }
.auth-card .social-auth-mount { min-height: 8px; }
.auth-card .muted-line { color: var(--muted, #9bb0a3); font-size: 12px; margin: 8px 0 0; }
.auth-card .link-btn {
  background: none; border: 0; padding: 4px 0; margin-top: 6px;
  color: var(--muted, #9bb0a3); font: inherit; font-size: 12px; cursor: pointer;
  text-decoration: underline;
}
.auth-card .link-btn:hover { color: var(--fg, #eef2ee); }

/* How-to-use guide steps */
.steps { display: flex; flex-direction: column; gap: 18px; margin-top: 10px; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step-n {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--accent, #22c55e); color: #04110a;
}
.step-body { flex: 1; min-width: 0; }
.step-body strong { display: block; margin-bottom: 4px; }
.guide-code {
  margin-top: 8px; padding: 12px 14px; border-radius: 10px;
  background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  white-space: pre-wrap; word-break: break-word; overflow-x: auto;
}
