:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #17202e;
  --muted: #667285;
  --border: #d9e0e8;
  --accent: #13795b;
  --accent-dark: #0d5f48;
  --blue: #245ea8;
  --amber: #a76b00;
  --red: #b3261e;
  --shadow: 0 18px 44px rgba(24, 33, 47, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

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

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  width: min(1080px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
}

.rail,
.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.rail {
  padding: 24px;
  align-self: start;
  position: sticky;
  top: 16px;
}

.brand {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 4px;
  font-size: 1.18rem;
  line-height: 1.2;
}

.brand p,
.hint,
.step-label,
.copy-status,
.timer-wrap p,
.quota-panel span {
  color: var(--muted);
}

.brand p {
  margin-bottom: 0;
  font-size: 0.92rem;
  line-height: 1.35;
}

.quota-panel {
  display: grid;
  gap: 4px;
  margin-bottom: 22px;
  padding: 12px;
  border: 1px solid #b8d8cc;
  border-radius: var(--radius);
  background: #eef8f4;
}

.quota-panel strong {
  font-size: 0.95rem;
}

.steps {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.steps li {
  border-left: 4px solid var(--border);
  padding: 9px 10px;
  color: var(--muted);
  font-weight: 650;
}

.steps li.active {
  border-color: var(--accent);
  color: var(--text);
  background: #eef8f4;
}

.steps li.done {
  border-color: var(--blue);
  color: var(--text);
}

.surface {
  padding: 32px;
  min-height: 640px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.screen-head {
  margin-bottom: 26px;
}

.step-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.86rem;
  font-weight: 750;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 2.6vw, 2.35rem);
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 6px;
  font-size: 0.92rem;
  line-height: 1.25;
  color: var(--muted);
  text-transform: uppercase;
}

label {
  display: block;
  margin: 18px 0 8px;
  font-weight: 750;
}

textarea,
select,
input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 13px 14px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 104px;
}

textarea:focus,
select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(19, 121, 91, 0.14);
}

.hint {
  margin: 8px 0 4px;
  line-height: 1.45;
}

.hint.warning {
  color: var(--amber);
}

.notice,
.error {
  margin-top: 16px;
  border-radius: var(--radius);
  padding: 12px 14px;
  line-height: 1.45;
}

.notice {
  border: 1px solid #b8d8cc;
  background: #eef8f4;
  color: #164d3c;
}

.error {
  border: 1px solid #efb5b0;
  background: #fff0ef;
  color: var(--red);
}

.hidden {
  display: none;
}

.context-panel {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.context-row {
  display: grid;
  grid-template-columns: 96px repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.context-row span {
  color: var(--muted);
  font-weight: 800;
}

.segment {
  min-height: 40px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  text-align: center;
  white-space: normal;
}

.segment.selected {
  border-color: var(--accent);
  background: #eef8f4;
  color: var(--text);
}

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

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

.choice {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 14px;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}

.choice:hover,
.choice.selected {
  border-color: var(--accent);
  background: #eef8f4;
}

.diagnostic,
.result-list > div,
.sprint-summary {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 16px;
}

.safety-panel {
  margin-top: 16px;
  border: 1px solid #d2c29a;
  border-radius: var(--radius);
  background: #fff8e8;
  color: #4e3b12;
  padding: 14px;
  line-height: 1.45;
}

.safety-panel h3 {
  color: #6f5100;
}

.diagnostic dl {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
}

.diagnostic dt {
  color: var(--muted);
  font-weight: 800;
}

.diagnostic dd {
  margin: 3px 0 0;
}

.result-list {
  display: grid;
  gap: 12px;
}

.quick-adjust {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.result-list p,
.sprint-summary p {
  margin-bottom: 0;
  line-height: 1.5;
}

.timer-wrap {
  display: grid;
  place-items: center;
  gap: 8px;
  margin-bottom: 22px;
}

.timer {
  font-size: clamp(4rem, 11vw, 7rem);
  line-height: 1;
  font-weight: 850;
  color: var(--accent-dark);
  letter-spacing: 0;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.actions.split {
  justify-content: space-between;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-weight: 800;
  cursor: pointer;
}

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

.primary {
  background: var(--accent);
  color: #fff;
}

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

.secondary {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

.copy-status {
  min-height: 22px;
  margin-top: 8px;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: min(100% - 20px, 620px);
    margin: 10px auto;
  }

  .rail {
    position: static;
    padding: 14px;
  }

  .brand {
    grid-template-columns: 44px 1fr;
    gap: 10px;
    margin-bottom: 12px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
  }

  .quota-panel {
    margin-bottom: 12px;
    padding: 10px;
  }

  .steps {
    display: flex;
    gap: 6px;
  }

  .steps li {
    flex: 1;
    min-height: 22px;
    border-left: 0;
    border-top: 4px solid var(--border);
    padding: 5px 2px 0;
    overflow: hidden;
    font-size: 0.66rem;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .steps li.active {
    flex: 1.5;
  }

  .surface {
    padding: 22px;
  }

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

  .context-row span {
    grid-column: 1 / -1;
  }

  .choice-grid,
  .choice-grid.compact,
  .quick-adjust {
    grid-template-columns: 1fr;
  }
}
