:root {
  color-scheme: light;
  --background: #f4f7f6;
  --surface: #ffffff;
  --surface-soft: #eef5f1;
  --text: #152238;
  --muted: #65758b;
  --line: #dbe4e0;
  --navy: #17233f;
  --green: #2f7d68;
  --green-dark: #246553;
  --green-soft: #dceee7;
  --danger: #9f3a38;
  --danger-soft: #f7e4e2;
  --shadow: 0 18px 50px rgba(23, 35, 63, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

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

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

button {
  touch-action: manipulation;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.app-header {
  padding: 8px 2px 18px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 1.1;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.75rem;
  line-height: 1.2;
}

p {
  line-height: 1.7;
}

.hidden {
  display: none !important;
}

.view {
  animation: appear 180ms ease;
}

.panel {
  padding: 24px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.lead {
  margin-bottom: 24px;
  color: var(--muted);
}

.onboarding-panel {
  display: grid;
  min-height: 560px;
  align-content: start;
}

.onboarding-progress {
  justify-self: start;
  margin-bottom: 18px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.onboarding-body {
  display: grid;
  gap: 12px;
  margin: 12px 0 28px;
}

.onboarding-body p {
  margin: 0;
  color: var(--muted);
}

.onboarding-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: auto;
}

.onboarding-controls .button.primary {
  grid-column: span 1;
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.form-stack {
  display: grid;
  gap: 18px;
}

label,
fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--text);
  font-weight: 700;
}

legend {
  padding: 0 0 10px;
  color: var(--text);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-weight: 400;
}

input,
select {
  min-height: 48px;
  padding: 0 13px;
}

textarea {
  resize: vertical;
  min-height: 96px;
  padding: 12px 13px;
  line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(47, 125, 104, 0.18);
  border-color: var(--green);
}

.button {
  min-height: 52px;
  padding: 13px 16px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.button.full {
  width: 100%;
}

.button.primary {
  background: var(--green);
  color: #ffffff;
}

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

.button.primary-soft {
  border: 1px solid rgba(47, 125, 104, 0.22);
  background: var(--green-soft);
  color: var(--green-dark);
}

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

.button.urgent {
  min-height: 82px;
  background: var(--navy);
  color: #ffffff;
  font-size: 1.08rem;
  box-shadow: 0 14px 28px rgba(23, 35, 63, 0.14);
}

.button.compact {
  min-height: 46px;
  padding: 10px 12px;
  font-size: 0.92rem;
}

.button.ghost {
  background: var(--surface-soft);
  color: var(--navy);
}

.button.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.text-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 800;
  cursor: pointer;
}

.action-stack {
  display: grid;
  gap: 12px;
}

.sub-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

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

.stats-grid > div,
.summary-grid > div {
  min-height: 100px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.stats-grid span,
.summary-grid strong {
  display: block;
  color: var(--navy);
  font-size: 2rem;
  line-height: 1;
}

.stats-grid small,
.summary-grid span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.4;
}

.quiet-box {
  margin: 20px 0;
  padding: 16px;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: var(--surface-soft);
}

.home-message {
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid rgba(47, 125, 104, 0.2);
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 800;
}

.box-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.timer-card {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  min-height: 132px;
  margin: 24px 0;
  border-radius: 8px;
  background: var(--navy);
  color: #ffffff;
}

.timer-card span {
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
}

.timer-card small {
  color: rgba(255, 255, 255, 0.78);
}

.encouragement {
  padding: 16px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 800;
}

.future-prompt {
  margin-bottom: 12px;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--navy);
  font-weight: 700;
}

.future-prompt p {
  margin-bottom: 10px;
}

.future-prompt p:last-child {
  margin-bottom: 0;
}

.choice-row,
.choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choice {
  position: relative;
  display: inline-flex;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice span {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-weight: 700;
}

.choice input:checked + span {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.two-actions {
  display: grid;
  gap: 12px;
}

.two-actions .button {
  line-height: 1.35;
}

.save-message {
  min-height: 28px;
  margin: 0;
  color: var(--green-dark);
  font-weight: 800;
}

.history-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.history-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.history-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.history-card p {
  margin-bottom: 8px;
  color: var(--muted);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.certificate-wrap {
  background: #f8faf9;
}

.certificate {
  padding: 30px 20px;
  border: 1px solid #cfded8;
  border-radius: 8px;
  background: #ffffff;
  color: var(--navy);
  box-shadow: 0 10px 30px rgba(23, 35, 63, 0.06);
}

.certificate-label {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.certificate-message {
  color: var(--muted);
  line-height: 1.9;
}

.certificate-list {
  display: grid;
  gap: 12px;
  margin: 24px 0 0;
}

.certificate-list div {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.certificate-list dt {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.certificate-list dd {
  margin: 4px 0 0;
  line-height: 1.6;
}

.settings-details {
  display: grid;
  gap: 12px;
  margin: 18px 0 28px;
}

.settings-details div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.settings-details dt {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.settings-details dd {
  margin: 4px 0 0;
}

.danger-zone {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.danger-zone .button.danger {
  min-height: 46px;
  border: 1px solid rgba(159, 58, 56, 0.22);
  background: #fff7f6;
  font-size: 0.94rem;
}

.small-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 680px) {
  .app-shell {
    padding: 40px 24px 56px;
  }

  .panel {
    padding: 32px;
  }

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

  .two-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .sub-actions {
    grid-template-columns: 1fr;
  }

  .onboarding-controls {
    grid-template-columns: 1fr;
  }

  .onboarding-controls .button.primary {
    grid-column: auto;
    order: -1;
  }
}
