:root {
  --bg: #f4f6f2;
  --surface: #ffffff;
  --ink: #17201c;
  --muted: #5d6a62;
  --line: #d7ded6;
  --green: #147a64;
  --green-soft: #e2f2ec;
  --amber: #b66a00;
  --amber-soft: #fff0cc;
  --red: #c2412d;
  --red-soft: #ffe0d8;
  --shadow: 0 16px 36px rgba(31, 40, 34, 0.12);
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
  text-decoration: none;
}

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

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.screen {
  min-height: 100vh;
  padding: 24px 18px 96px;
}

.hero,
.page-header {
  padding: 18px 0 22px;
}

.hero h1,
.page-header h1 {
  margin: 6px 0 8px;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: 0;
}

.hero.compact h1 {
  font-size: 38px;
}

.hero p,
.page-header p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  color: var(--green) !important;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
}

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

.panel {
  padding: 18px;
  margin-bottom: 14px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 21px;
  line-height: 1.2;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

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

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

.primary-action,
.status-button,
.quick-questions button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.primary-action {
  width: 100%;
  background: var(--green);
  color: #ffffff;
}

.notice,
.form-message,
.confidence {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.action-grid,
.list-stack {
  display: grid;
  gap: 14px;
}

.entry-card {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 18px;
  align-content: center;
}

.entry-card span {
  font-size: 24px;
  font-weight: 850;
}

.entry-card small {
  color: var(--muted);
}

.accent-green {
  background: var(--green-soft);
  border-color: #a5d7ca;
}

.accent-amber {
  background: var(--amber-soft);
  border-color: #e7c978;
}

.accent-red {
  background: var(--red-soft);
  border-color: #efb2a7;
}

.upload-box {
  min-height: 162px;
  place-items: center;
  border: 2px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  text-align: center;
}

.upload-box input {
  max-width: 280px;
}

.image-preview,
.medicine-photo {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

.image-preview {
  max-height: 260px;
}

.medicine-photo {
  max-height: 220px;
}

.source-list {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding-left: 22px;
}

.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
  font-size: 16px;
}

.check-line input {
  width: 24px;
  min-height: 24px;
  margin-top: 2px;
}

.medicine-card {
  display: grid;
  gap: 12px;
}

.medicine-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.medicine-card h2 {
  margin: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
}

.tag.green {
  background: var(--green-soft);
  color: var(--green);
}

.tag.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.tag.red {
  background: var(--red-soft);
  color: var(--red);
}

.pill-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.status-button.taken {
  background: var(--green-soft);
  color: var(--green);
}

.status-button.later {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-button.missed,
.status-button.unwell {
  background: var(--red-soft);
  color: var(--red);
}

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

.summary-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.quick-questions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quick-questions button {
  background: #eef1ed;
  color: var(--ink);
  font-size: 16px;
}

.answer-panel h2 {
  margin-top: 0;
}

.answer-text {
  margin: 10px 0;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 520px);
  margin: 0 auto;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.bottom-nav a {
  min-height: 64px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.bottom-nav a.active {
  color: var(--green);
}

@media (max-width: 390px) {
  .screen {
    padding-right: 14px;
    padding-left: 14px;
  }

  .hero h1,
  .page-header h1 {
    font-size: 30px;
  }

  .quick-questions {
    grid-template-columns: 1fr;
  }
}
