:root {
  --navy: #0b3d5c;
  --navy-dark: #082a40;
  --gold: #f4b942;
  --green: #2e8b57;
  --red: #c0392b;
  --red-bg: #fdecea;
  --grey-bg: #f4f6f8;
  --border: #d8dee3;
  --text: #1c2733;
  --muted: #6b7a88;
  font-size: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--grey-bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.app-header {
  background: var(--navy);
  color: #fff;
  padding: 1.4rem 1.2rem 1.1rem;
  text-align: center;
}
.app-header h1 { margin: 0; font-size: 1.4rem; }
.app-header .subtitle { margin: 0.3rem 0 0; color: #cfe0ec; font-size: 0.9rem; }

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 1rem 6rem;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}
.card h2 { margin: 0 0 0.7rem; font-size: 1.05rem; color: var(--navy); }
.card.hidden, .hidden { display: none !important; }

.big-select {
  width: 100%;
  font-size: 1.1rem;
  padding: 0.8rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}

.commence-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 0.6rem 0;
  cursor: pointer;
}
.commence-row input[type="checkbox"] {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.commence-row.disabled { opacity: 0.5; cursor: not-allowed; }

.timestamp {
  margin: 0.3rem 0 0;
  color: var(--green);
  font-weight: 600;
  min-height: 1.2em;
}
.hint { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.9rem; }

.checklist {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}
.checklist li {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 0.2rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.02rem;
}
.checklist li:last-child { border-bottom: none; }
.checklist input[type="checkbox"] {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}
.checklist li.checked span.item-label { color: var(--green); }

.item-row-label {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  cursor: pointer;
}

/* Hard-stop items are highlighted in red wherever they appear, in any
   category, until ticked (or marked N/A). */
.checklist li.hardstop {
  background: var(--red-bg);
  border-radius: 8px;
  margin-bottom: 0.4rem;
  border-bottom: none;
  padding: 0.75rem 0.6rem;
}
.checklist li.hardstop.checked { background: #eaf6ee; }
.checklist li.hardstop .item-label { font-weight: 600; }

.required-badge {
  display: inline-block;
  color: var(--red);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.checklist li.hardstop.checked .required-badge { color: var(--green); }

.na-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}
.na-row input { width: 20px; height: 20px; }

.category { margin-bottom: 0.4rem; }
.category-heading {
  color: var(--navy);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 1.1rem 0 0.5rem;
}
.category:first-child .category-heading { margin-top: 0.2rem; }

.hardstop-note {
  color: var(--muted);
  font-size: 0.9rem;
  margin: -0.3rem 0 0.4rem;
}

.added-by-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: 0.15rem;
}

.delete-item-btn {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 1.15rem;
  line-height: 1;
  padding: 0.3rem 0.4rem;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
}
.delete-item-btn:hover, .delete-item-btn:active { color: var(--red); }

.add-item-box {
  margin-top: 1.1rem;
  padding: 0.9rem 1rem 1rem;
  background: var(--grey-bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
}
.add-item-box .category-heading { margin: 0 0 0.35rem; }
.add-item-box .hint { margin: 0 0 0.7rem; }

.add-item-input {
  display: block;
  width: 100%;
  font-size: 1rem;
  padding: 0.65rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
  background: #fff;
}

.add-item-btn {
  width: 100%;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.7rem;
  border-radius: 8px;
  border: none;
  background: var(--navy);
  color: #fff;
}

.add-item-feedback {
  color: var(--red);
  font-size: 0.85rem;
  margin: 0.6rem 0 0;
}

textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  resize: vertical;
}

.notes-box {
  min-height: 9rem;
  font-size: 1.05rem;
  line-height: 1.4;
}

/* On iPad / wider screens, let the whole app (and so the notes box) use
   more of the available width instead of staying phone-width. */
@media (min-width: 700px) {
  #app { max-width: 860px; }
  .notes-box { min-height: 10rem; }
}

.warning-banner {
  position: sticky;
  bottom: 4.6rem;
  max-width: 640px;
  margin: 0 auto 0.6rem;
  background: var(--red);
  color: #fff;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.error-banner {
  max-width: 640px;
  margin: 0 auto 1rem;
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red);
  padding: 0.8rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

.submit-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom));
}
.submit-bar button {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.9rem;
  border-radius: 10px;
  border: none;
  background: var(--green);
  color: #fff;
}
.submit-bar button:disabled {
  background: #a9b4bd;
}

#step-done {
  text-align: center;
}
#step-done button, .error-banner + button {
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.8rem 1.4rem;
  border-radius: 10px;
  border: none;
  background: var(--navy);
  color: #fff;
  margin-top: 0.8rem;
}

.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 1rem;
}
