:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --ink: #20231f;
  --muted: #62685f;
  --panel: #ffffff;
  --line: #d9ddd5;
  --accent: #176b5b;
  --accent-strong: #0f4f44;
  --accent-soft: #dff1ec;
  --warn: #f5a524;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

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

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

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

h2 {
  margin-bottom: 6px;
  font-size: 1.15rem;
}

.status {
  min-width: 92px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.logout {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 18px;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 22px;
}

.login-card h1 {
  margin-bottom: 10px;
  font-size: 2.1rem;
}

.login-card p {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 16px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 0.95rem;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.login-error {
  min-height: 22px;
  margin: 0;
  color: #b94335;
  font-weight: 800;
}

.status.ready {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status.mock {
  background: #fff5df;
  color: #7b4f00;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.tab,
.button-row button,
.submit {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.tab {
  font-weight: 800;
}

.tab.active,
.button-row button.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

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

.panel,
.summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.panel {
  display: none;
}

.panel.active {
  display: grid;
  gap: 16px;
}

.panel-head p {
  margin-bottom: 0;
  color: var(--muted);
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend,
label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.button-row.stacked {
  grid-template-columns: 1fr;
}

.button-row.intensity {
  grid-template-columns: repeat(5, 1fr);
}

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

.button-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  font-weight: 800;
  text-align: center;
}

.button-row.color-grid button {
  justify-content: flex-start;
  min-width: 0;
  padding-inline: 12px;
}

.color-swatch {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 1px solid rgba(0, 0, 0, 0.22);
  border-radius: 4px;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.color-swatch.pale {
  border-color: rgba(0, 0, 0, 0.28);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbf9;
  color: var(--ink);
  padding: 12px;
}

select {
  min-height: 48px;
}

textarea {
  resize: vertical;
}

.submit,
.delete-last {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 900;
}

.delete-last {
  min-height: 44px;
  border: 1px solid #b94335;
  border-radius: 8px;
  background: #b94335;
  cursor: pointer;
}

.delete-last[hidden] {
  display: none;
}

.submit:disabled,
.delete-last:disabled {
  opacity: 0.65;
  cursor: wait;
}

.summary {
  display: grid;
  gap: 10px;
  align-content: start;
}

pre {
  min-height: 120px;
  margin: 0;
  overflow: auto;
  border-radius: 8px;
  background: #1f2521;
  color: #e9f1ec;
  padding: 12px;
  font-size: 0.82rem;
  white-space: pre-wrap;
}

@media (min-width: 760px) {
  .shell {
    padding: 28px;
  }

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

  .tabs {
    width: 520px;
  }

  .panel {
    min-height: 560px;
  }

  .button-row.stacked {
    grid-template-columns: repeat(2, 1fr);
  }

}
