:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --surface: #ffffff;
  --surface-muted: #eef2ec;
  --ink: #18211c;
  --muted: #5a665f;
  --line: #d9ded7;
  --accent: #19675d;
  --accent-strong: #124b44;
  --accent-soft: #dcefed;
  --danger-soft: #f8e5df;
  --danger: #8d3322;
  --shadow: 0 12px 36px rgba(24, 33, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 8px 0 20px;
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  padding: 4px;
  border-radius: 6px;
  background: var(--accent);
}

.eyebrow,
.panel-label {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1;
  letter-spacing: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 22px;
  align-items: start;
  padding-top: 22px;
}

.admin-form,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-form {
  padding: 20px;
}

.auth-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  margin: 0;
  padding: 0 0 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.mode-row,
.button-row,
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mode-row {
  padding: 18px 0;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

input,
select {
  min-height: 44px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.primary-button,
.secondary-button,
.secondary-link,
.mode-button {
  min-height: 44px;
  border-radius: 6px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-decoration: none;
}

.primary-button {
  border: 0;
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button,
.secondary-link,
.mode-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent);
}

.secondary-button:hover,
.secondary-link:hover,
.mode-button:hover,
.mode-button.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.button-row {
  justify-content: flex-end;
  padding-top: 18px;
}

.result-panel {
  position: sticky;
  top: 18px;
  padding: 20px;
}

pre {
  min-height: 260px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  font-size: 0.9rem;
}

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

@media (max-width: 880px) {
  .topbar,
  .workspace,
  .auth-row,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .brand-lockup {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
  }

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

  .primary-button,
  .secondary-button,
  .secondary-link,
  .mode-button {
    width: 100%;
  }

  .result-panel {
    position: static;
  }
}
