:root {
  --bg: #050505;
  --panel: #111111;
  --panel-2: #181818;
  --line: rgba(255, 255, 255, 0.06);
  --ink: #f5f5f5;
  --muted: #8d8d8d;
  --quiet: #5c5c5c;
  --accent-a: #6aa8ff;
  --accent-b: #86e0c8;
  --danger: #e38a80;
  --gain: #9ad7b8;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.28);
  outline-offset: 2px;
}

a {
  color: inherit;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 24px;
  background: var(--panel);
}

.login-links {
  margin: 18px 0 0;
  text-align: center;
}

.login-links a {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.login-links a:hover {
  color: var(--ink);
}

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

.mark,
.product-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #4d7cff, #78d4c6);
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 28px 22px;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  width: 36px;
  height: 36px;
  color: var(--ink);
}

.logo svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.nav-item.is-current {
  color: var(--ink);
  background: var(--panel);
}

.nav-icon {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: #2a2a2a;
}

.nav-item.is-current .nav-icon {
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
}

.sidebar-end {
  margin-top: auto;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: var(--panel);
}

.user-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-b);
}

.user-chip strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.user-chip .btn-ghost {
  margin-top: 2px;
  font-size: 12px;
}

.workspace {
  padding: 22px 28px 48px;
}

.workspace-head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
}

.menu-toggle,
.menu-close {
  display: none;
}

.nav-scrim {
  display: none;
}

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

.product-name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.product-meta,
.status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.block-head {
  margin-bottom: 22px;
}

.block-head h1,
.login-card h1 {
  margin: 0;
  font-size: 40px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.block-head p,
.login-card > .muted {
  margin: 8px 0 0;
  max-width: 440px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.login-card h1 {
  margin-bottom: 8px;
  font-size: 32px;
}

.panel {
  padding: 22px;
  border-radius: 24px;
  background: var(--panel);
}

.panel-head {
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.cards article {
  min-height: 132px;
  padding: 18px;
  border-radius: 22px;
  background: var(--panel);
}

.cards span {
  color: var(--muted);
  font-size: 13px;
}

.cards strong {
  display: block;
  margin-top: 18px;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.cards .is-gain {
  color: var(--gain);
}

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

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

th,
td {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

td:first-child {
  font-weight: 500;
}

tr:last-child td {
  border-bottom: 0;
  padding-bottom: 0;
}

.origin-cell {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.stat-row {
  cursor: pointer;
}

.stat-row:hover td,
.stat-row:focus td {
  background: rgba(255, 255, 255, 0.03);
}

.stat-row:focus {
  outline: none;
}

.stat-row td,
.events-table td,
.events-table th {
  padding-right: 16px;
  white-space: nowrap;
}

.events-table td.is-gain {
  color: var(--gain);
}

.back-link {
  display: inline-flex;
  align-items: center;
  height: 32px;
  margin-bottom: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.back-link:hover {
  color: var(--ink);
}

.empty {
  margin: 8px 0 0;
  color: var(--quiet);
  font-size: 14px;
}

.clients-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.create-stack {
  display: grid;
  gap: 14px;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
}

label span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

input {
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--ink);
}

.btn,
.btn-quiet,
.chip {
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn {
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  color: #102018;
}

.btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #d8d8d8;
  color: #111;
}

.btn-ghost {
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.btn-ghost:hover {
  color: var(--ink);
}

.chip {
  height: 32px;
  padding: 0 12px;
  background: var(--panel-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}

.chip.is-danger {
  color: var(--danger);
}

.error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.ok {
  margin: 0;
  color: var(--gain);
  font-size: 13px;
}

.key-box {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
  background: #0c0c0c;
}

.key-kicker {
  margin: 0;
  color: var(--gain);
  font-size: 12px;
  font-weight: 600;
}

.key-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.key-row {
  display: grid;
  gap: 10px;
}

input.key-value {
  width: 100%;
  height: auto;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
}

.key-box .btn-quiet {
  justify-self: start;
  height: 34px;
}

.client-list {
  display: grid;
  gap: 10px;
}

.client-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-radius: 18px;
  background: var(--panel-2);
}

.client-card.is-off {
  opacity: 0.62;
}

.client-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.client-title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.pill {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(154, 215, 184, 0.12);
  color: var(--gain);
  font-size: 11px;
  font-weight: 600;
}

.pill.is-off {
  background: rgba(227, 138, 128, 0.12);
  color: var(--danger);
}

.client-origin,
.key-prefix {
  margin: 6px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.key-prefix {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #0c0c0c;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.account-panel {
  width: min(460px, 100%);
}

.section {
  display: none;
}

.section.is-current {
  display: block;
}

@media (max-width: 1100px) {
  .cards,
  .clients-layout,
  .settings,
  .studio-cards {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 840px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .workspace-head {
    position: sticky;
    top: 0;
    z-index: 20;
    grid-template-columns: auto 1fr;
    gap: 12px;
    margin: -18px -16px 18px;
    padding: 14px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }

  .workspace-head .status,
  .workspace-head .product-meta {
    display: none;
  }

  .menu-toggle,
  .menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: var(--panel);
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
  }

  .menu-close {
    width: 36px;
    padding: 0;
  }

  .nav-scrim {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(5, 5, 5, 0.64);
  }

  body.is-menu-open {
    overflow: hidden;
  }

  body.is-menu-open .nav-scrim {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 40;
    width: min(300px, 86vw);
    height: 100dvh;
    padding: 22px 18px;
    overflow: auto;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    background: #0c0c0c;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  body.is-menu-open .sidebar {
    transform: translateX(0);
  }

  nav {
    grid-template-columns: 1fr;
  }

  .cards,
  .clients-layout,
  .client-card {
    grid-template-columns: 1fr;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .block-head h1 {
    font-size: 32px;
  }

  .workspace {
    padding: 18px 16px 36px;
  }

  .studio-top,
  .settings,
  .studio-cards,
  .try-previews {
    grid-template-columns: 1fr;
  }

  .hero,
  .hero-empty {
    min-height: 320px;
  }
}

.studio-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.studio-top .block-head {
  margin-bottom: 0;
}

.studio-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#download {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: #d8d8d8;
  color: #111;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

#submit {
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  color: #102018;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

#submit:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 420px;
  border-radius: 28px;
  background:
    radial-gradient(ellipse 36% 28% at 78% 38%, rgba(186, 198, 216, 0.28), transparent 70%),
    radial-gradient(ellipse 58% 42% at 82% 72%, #3f5474 0%, transparent 68%),
    linear-gradient(180deg, #141820 0%, #0c0f14 58%, #08090c 100%);
}

.hero[data-empty="false"] {
  background: #0c0c0c;
}

.hero input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.hero.is-over {
  outline: 1px solid rgba(255, 255, 255, 0.16);
  outline-offset: -1px;
}

.hero-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 48px;
}

.hero-copy h2 {
  margin: 0 0 10px;
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.hero-copy p {
  margin: 0 0 22px;
  color: #b9b9b9;
  font-size: 16px;
  line-height: 1.45;
}

.preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.compare {
  position: absolute;
  inset: 0;
  container-type: size;
}

.compare img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.before-clip {
  position: absolute;
  inset: 0 auto 0 0;
  width: 50%;
  overflow: hidden;
}

.before-clip img {
  width: 100cqi;
  height: 100cqb;
  max-width: none;
}

.compare-slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}

.compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(255, 255, 255, 0.88);
  pointer-events: none;
}

.compare-handle span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}

.badge {
  position: absolute;
  top: 18px;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(8, 8, 8, 0.7);
  color: #fff;
  font-size: 12px;
}

.badge.before {
  left: 18px;
}

.badge.after {
  right: 18px;
}

.file-chip {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 2;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(8, 8, 8, 0.72);
  color: #fff;
  font-size: 12px;
}

.hero.is-busy::after {
  content: "Traitement…";
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(8, 8, 8, 0.72);
  color: #fff;
  font-size: 12px;
}

.studio-block {
  margin-top: 22px;
  padding: 18px;
  border-radius: 24px;
  background: var(--panel);
}

.settings {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 0.9fr 0.9fr auto auto;
  gap: 14px;
  align-items: end;
}

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

.field span,
.switch span,
.studio-cards dt {
  color: var(--muted);
  font-size: 13px;
}

select,
input[type="number"] {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--ink);
}

input[type="range"] {
  width: 100%;
  accent-color: #cfcfcf;
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
}

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

.studio-cards div {
  min-height: 112px;
  padding: 16px;
  border-radius: 18px;
  background: var(--panel-2);
}

.studio-cards dd {
  margin: 16px 0 0;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.studio-cards .is-gain {
  color: var(--gain);
}

.studio-cards .is-loss {
  color: var(--danger);
}

.try-lib {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.try-lib input[type="file"] {
  padding: 10px;
  height: auto;
}

.try-result {
  margin-top: 18px;
}

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

.try-previews figure {
  margin: 0;
  padding: 12px;
  border-radius: 18px;
  background: #0c0c0c;
}

.try-previews img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 12px;
}

.try-previews figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.docs {
  display: grid;
  gap: 14px;
}

.doc-card h3 {
  margin: 18px 0 10px;
  font-size: 15px;
  font-weight: 600;
}

.doc-card .table-wrap + .doc-list {
  margin-top: 16px;
}

.doc-lead,
.doc-list,
.doc-steps {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.doc-list,
.doc-steps {
  padding-left: 18px;
}

.endpoint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 13px;
}

.endpoint b {
  color: var(--gain);
}

.snippet {
  position: relative;
}

.snippet + .snippet {
  margin-top: 16px;
}

.snippet pre {
  margin: 0;
  padding: 18px 52px 18px 18px;
  border-radius: 18px;
  background: #0c0c0c;
  overflow: auto;
  color: #ececec;
  font: 12.5px/1.5 var(--mono);
  white-space: pre;
}

.snippet button {
  position: absolute;
  top: 10px;
  right: 10px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: #d8d8d8;
  color: #111;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.docs-page {
  min-height: 100vh;
}

.docs-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.docs-top .product {
  text-decoration: none;
}

.docs-main {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.docs-login {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

@media (max-width: 840px) {
  .docs-top {
    padding: 14px 16px;
  }
}
