:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #fafafa;
  --ink: #111111;
  --ink-soft: #6b6b6b;
  --line: #e8e8e8;
  --line-strong: #d8d8d8;
  --success: #111111;
  --error: #111111;
  --radius: 18px;
  --radius-sm: 14px;
  --font-body: Inter, "Helvetica Neue", Arial, sans-serif;
  --font-display: Inter, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-body);
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

.login-page,
.app-page {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.login-shell,
.app-shell {
  width: min(720px, calc(100vw - 24px));
  padding: 12px 0 32px;
}

.login-shell {
  display: grid;
  place-items: center;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.login-panel {
  width: min(420px, 100%);
  padding: 24px;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 600;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 8vw, 2.6rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.lede {
  margin-top: 12px;
  max-width: 34ch;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.45;
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

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

.field span,
.subpanel-head p,
.panel-head p,
.message,
dt {
  color: var(--ink-soft);
}

input,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  padding: 13px 14px;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.button {
  appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 13px 18px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 120ms ease,
    color 120ms ease,
    border-color 120ms ease;
}

.button:hover {
  border-color: var(--ink);
}

.button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.button-primary {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
}

.button-secondary {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.hero {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.builder {
  padding: 16px;
}

.panel-head,
.subpanel-head {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

.template-list {
  display: grid;
  gap: 8px;
}

.template-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
  text-align: left;
}

.template-card {
  min-height: 88px;
}

.template-card strong {
  display: block;
  font-size: 1rem;
}

.template-card span {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.template-card.is-active {
  border-color: var(--ink);
  background: var(--surface-muted);
}

.details-accordion {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.details-accordion summary {
  list-style: none;
  cursor: pointer;
  padding: 14px;
  font-weight: 600;
}

.details-accordion summary::-webkit-details-marker {
  display: none;
}

.details-accordion summary::after {
  content: "+";
  float: right;
  color: var(--ink-soft);
}

.details-accordion[open] summary::after {
  content: "−";
}

.details-body {
  margin-top: 16px;
  display: grid;
  gap: 14px;
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}

.image-picker {
  display: grid;
  gap: 12px;
}

.image-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  padding: 8px 12px;
  font-size: 0.92rem;
}

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

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.member-copy {
  display: grid;
  gap: 4px;
}

.member-row strong,
.result-grid dd,
.result-json {
  word-break: break-word;
}

.member-row strong,
.member-row span {
  display: block;
}

.member-row span {
  color: var(--ink-soft);
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.message {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.message.error {
  color: var(--error);
}

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

.result-card {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 16px 0;
}

dt {
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.result-json {
  overflow-x: auto;
  border-radius: 12px;
  background: #111111;
  color: #ffffff;
  padding: 16px;
  font-size: 0.9rem;
}

.template-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (min-width: 700px) {
  .login-shell,
  .app-shell {
    width: min(760px, calc(100vw - 32px));
  }

  .login-panel,
  .builder {
    padding: 24px;
  }

  .inline-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  }
}
