:root {
  --bg: #f4f7f8;
  --bg-deep: #e8eef1;
  --ink: #142028;
  --muted: #5a6b75;
  --accent: #0b7a72;
  --accent-soft: #d7f0ed;
  --accent-ink: #043530;
  --danger: #b42318;
  --line: #cdd8de;
  --surface: rgba(255, 255, 255, 0.78);
  --radius: 16px;
  --display: "Outfit", sans-serif;
  --font: "Source Sans 3", sans-serif;
  --mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;
  --shadow: 0 1px 0 rgba(20, 32, 40, 0.04), 0 18px 40px -28px rgba(20, 32, 40, 0.35);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 620px at 8% -10%, rgba(11, 122, 114, 0.15), transparent 58%),
    radial-gradient(900px 480px at 96% 0%, rgba(56, 120, 168, 0.11), transparent 52%),
    linear-gradient(180deg, #f7fafb 0%, var(--bg-deep) 100%);
  animation: atmosphere-drift 18s ease-in-out infinite alternate;
}

@keyframes atmosphere-drift {
  from { transform: scale(1) translate3d(0, 0, 0); }
  to { transform: scale(1.04) translate3d(-1.5%, 1%, 0); }
}

.shell {
  width: min(1080px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: clamp(1.75rem, 5vh, 3rem) 0 3.5rem;
}

/* —— Auth: Marke links, Formular rechts —— */
body.is-auth .shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 420px);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  min-height: calc(100vh - 1rem);
  padding-top: clamp(1.5rem, 6vh, 3rem);
  padding-bottom: 2.5rem;
}

body.is-auth .hero {
  margin: 0;
  animation: rise-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.is-auth .hero-brand {
  display: grid;
  gap: 1.1rem;
}

body.is-auth .logo {
  font-size: clamp(2.8rem, 6vw, 4rem);
}

body.is-auth .auth-surface {
  animation: rise-in 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

/* —— Dashboard: kompakter Header + breites Raster —— */
body.is-dashboard .shell {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

body.is-dashboard .hero {
  margin: 0;
  animation: rise-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.is-dashboard .hero-brand {
  display: flex;
  align-items: baseline;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
}

body.is-dashboard .logo {
  font-size: clamp(1.55rem, 2.8vw, 1.85rem);
}

body.is-dashboard .headline {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--muted);
}

body.is-dashboard .lede {
  display: none;
}

.logo {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.05;
  color: var(--ink);
}

.headline {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.lede {
  margin: 0.55rem 0 0;
  max-width: 28ch;
  color: var(--muted);
  font-size: 1.08rem;
}

.surface {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--line) 70%, white);
  border-radius: var(--radius);
  padding: 1.35rem 1.35rem 1.45rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.15rem;
  padding: 0.25rem;
  background: color-mix(in srgb, var(--bg-deep) 80%, white);
  border-radius: 12px;
}

.tab {
  flex: 1;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  padding: 0.65rem 0.85rem;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.tab:hover { color: var(--ink); }
.tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(20, 32, 40, 0.06);
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0.7rem 1rem;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

button:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
button:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: #f4fffd;
  border-color: transparent;
  font-weight: 600;
  white-space: nowrap;
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, black);
  border-color: transparent;
}

.btn-ghost {
  background: transparent;
}

.btn-ghost.danger,
button.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
}

.form { display: grid; gap: 0.9rem; }
.form.inline {
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
}

input {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hidden { display: none !important; }

.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.gap { gap: 0.55rem; flex-wrap: wrap; }

.dash {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: rise-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both;
}

.session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}

.session-identity {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  min-width: 0;
}

.session-identity .label {
  flex: 0 0 auto;
}

.session-identity .strong {
  margin: 0;
  font-size: 1.05rem;
}

.billing-inline {
  margin: 0;
  padding-left: 0.85rem;
  border-left: 1px solid var(--line);
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.35fr);
  gap: 1rem;
  align-items: start;
}

.dash-grid:has(#instances-list.hidden) {
  grid-template-columns: minmax(280px, 520px);
}

.panel h2 {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.panel-head {
  margin-bottom: 0.35rem;
}

.instances-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.instance-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem 1.25rem;
  align-items: center;
  padding: 1rem 1.05rem;
  border: 1px solid color-mix(in srgb, var(--line) 85%, white);
  border-radius: 12px;
  background: color-mix(in srgb, #fff 70%, var(--bg));
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.instance-item:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}

.instance-item .actions {
  margin: 0;
  justify-content: flex-end;
}

.instance-item .pairing {
  grid-column: 1 / -1;
  margin-top: 0;
}

.label { margin: 0; color: var(--muted); font-size: 0.9rem; }
.muted { color: var(--muted); margin: 0 0 0.9rem; }
.strong { font-weight: 600; margin: 0.15rem 0 0; font-size: 1.05rem; }
.error { color: var(--danger); margin: 0.25rem 0 0; font-weight: 500; }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.75rem;
  margin: 0;
  min-width: 0;
}

.meta div {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.meta dt { color: var(--muted); font-size: 0.82rem; font-weight: 500; }
.meta dd { margin: 0; word-break: break-all; font-size: 0.98rem; }
.meta a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.meta a:hover { text-decoration: underline; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  text-transform: lowercase;
}

.status-pill::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
}

.status-pill.is-online::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.pairing {
  margin-top: 0;
  padding: 1rem 1.05rem;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  animation: rise-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.checkout-hint {
  margin: 0;
}

.code {
  font-family: var(--mono);
  font-size: clamp(1.45rem, 3.5vw, 1.85rem);
  letter-spacing: 0.28em;
  margin: 0.45rem 0;
  color: var(--accent-ink);
  font-weight: 600;
}

code {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.95em;
}

@media (max-width: 860px) {
  body.is-auth .shell {
    grid-template-columns: 1fr;
    align-items: start;
    min-height: auto;
  }

  body.is-auth .hero-copy {
    max-width: 36ch;
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    width: calc(100% - 1.5rem);
  }

  .form.inline { grid-template-columns: 1fr; }

  .billing-inline {
    padding-left: 0;
    border-left: 0;
    flex-basis: 100%;
  }

  .instance-item {
    grid-template-columns: 1fr;
  }

  .instance-item .actions {
    justify-content: flex-start;
  }

  body.is-dashboard .hero-brand {
    flex-direction: column;
    gap: 0.25rem;
  }
}
