/* Daily Tracker — bright, high-contrast, large-text by design.
   Deliberately NOT wired to the site's dark theme system: this screen
   is for a low-vision daily user, so it always opens bright regardless
   of what theme anyone else on the site has picked. */

:root {
  --bg:        #ffffff;
  --bg-soft:   #f2f5f8;
  --panel:     #ffffff;
  --edge:      #c7d0da;
  --ink:       #10151c;
  --ink-dim:   #435063;
  --accent:    #0b5fb0;
  --safe:      #1a7f37;
  --safe-bg:   #e6f4ea;
  --caution:   #8a5a00;
  --caution-bg:#fff4d6;
  --over:      #b3261e;
  --over-bg:   #fdeceb;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg-soft);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  margin: 0;
  padding: 0;
  font-size: 19px;
  line-height: 1.5;
}

header {
  background: var(--bg);
  border-bottom: 2px solid var(--edge);
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 0.8rem;
}
.backLink {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  flex: none;
}
.backLink:hover { text-decoration: underline; }
header h1 { font-size: 1.2rem; margin: 0; color: var(--ink); flex: 1 1 auto; min-width: 140px; }
.variantBadge {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  white-space: nowrap;
  flex: none;
}
.helpFab {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  border: none;
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.helpFab:hover { filter: brightness(1.08); }

main { max-width: 640px; margin: 0 auto; padding: 1.4rem 1.1rem 4rem; }

/* Open, uncluttered feel: soft shadow instead of a hard border, more
   breathing room between blocks rather than dense stacked boxes. */
.card {
  background: var(--panel);
  border: none;
  box-shadow: 0 1px 3px rgba(16,21,28,0.08);
  border-radius: 18px;
  padding: 1.5rem 1.4rem;
  margin-bottom: 1.7rem;
}
.card h2 { font-size: 1.2rem; margin: 0 0 1rem; color: var(--ink); font-weight: 700; }
.cardHeaderRow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.cardHeaderRow h2 { margin: 0; }
.iconEditBtn {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--edge);
  font-size: 1.1rem;
  cursor: pointer;
}
.iconEditBtn:hover { border-color: var(--accent); }

/* Big total */
.totalCard {
  background: var(--panel);
  border: none;
  box-shadow: 0 2px 8px rgba(16,21,28,0.10);
  border-radius: 22px;
  padding: 1.7rem 1.4rem;
  margin-bottom: 1.7rem;
  text-align: center;
}
.statusPill {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 8px 22px;
  border-radius: 999px;
  margin-bottom: 0.8rem;
}
.statusPill.safe { background: var(--safe-bg); color: var(--safe); }
.statusPill.caution { background: var(--caution-bg); color: var(--caution); }
.statusPill.over { background: var(--over-bg); color: var(--over); }

.bigTotal { font-size: 4.2rem; font-weight: 800; line-height: 1; color: var(--ink); }
.bigTotal.safe { color: var(--safe); }
.bigTotal.caution { color: var(--caution); }
.bigTotal.over { color: var(--over); }
.bigTotalUnit { font-size: 1.8rem; font-weight: 700; color: var(--ink-dim); }

.bigBar { height: 26px; border-radius: 13px; background: var(--bg-soft); overflow: hidden; margin: 1.1rem 0 0.7rem; }
.bigBarFill { height: 100%; background: var(--safe); transition: width 0.25s ease, background-color 0.25s ease; }
.bigBarFill.caution { background: var(--caution); }
.bigBarFill.over { background: var(--over); }

.bigSubline { font-size: 1.05rem; color: var(--ink-dim); margin-bottom: 1rem; }
.editCapLink { font-size: 0.95rem; color: var(--accent); background: none; border: none; text-decoration: underline; cursor: pointer; padding: 4px; font-family: inherit; }
.capLockedNote { font-size: 0.95rem; color: var(--ink-dim); font-weight: 700; }
.capEditForm { display: flex; gap: 0.6rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.capEditForm input {
  width: 110px;
  font-size: 1.1rem;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--edge);
  font-family: inherit;
  text-align: center;
}

.totalActions { display: flex; flex-wrap: wrap; gap: 0.7rem; justify-content: center; }

/* Buttons — big touch targets throughout */
.bigBtn {
  min-height: 56px;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 12px;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-family: inherit;
}
.bigBtn:hover { filter: brightness(1.08); }
.bigBtn:active { filter: brightness(0.95); }
.bigBtn:disabled { opacity: 0.4; cursor: default; }
.bigBtn.secondary { background: var(--bg); color: var(--accent); }
.bigBtn.fullWidth { width: 100%; margin-bottom: 0.6rem; }
.bigBtn.yes { background: var(--safe); border-color: var(--safe); }
.bigBtn.no { background: var(--bg); color: var(--over); border-color: var(--over); }
.bigBtn.compact { min-height: 46px; font-size: 0.92rem; padding: 9px 14px; }

.shareHint { font-size: 0.85rem; color: var(--ink-dim); margin: -0.3rem 0 0.9rem; }
.actionRow { display: flex; gap: 0.6rem; margin-bottom: 0.6rem; }
.actionRow .bigBtn { flex: 1; }

.linkBtn {
  display: block;
  width: 100%;
  text-align: center;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
  padding: 8px;
  margin-top: 0.2rem;
}
.linkBtn[hidden] { display: none; }
.moreOptions { margin-top: 0.8rem; }
.moreOptions[hidden] { display: none; }

/* Toast confirmation */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  max-width: 92vw;
  background: var(--ink);
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 14px 22px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  z-index: 80;
  text-align: center;
}
.toast[hidden] { display: none; }
.toast.safe { background: var(--safe); }
.toast.caution { background: var(--caution); }
.toast.over { background: var(--over); }

/* Quick add grid */
.quickGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-bottom: 1rem; }
@media (max-width: 420px) { .quickGrid { grid-template-columns: 1fr; } }
.quickBtn {
  min-height: 64px;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--edge);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.quickBtn:hover { border-color: var(--accent); }
.quickBtn:disabled { opacity: 0.5; }
.quickBtn .qLoading { font-size: 0.85rem; color: var(--ink-dim); font-weight: 500; display: block; }

/* Search */
.searchRow { display: flex; gap: 0.5rem; margin-top: 0.8rem; align-items: center; flex-wrap: wrap; }
.searchIcon { font-size: 1.1rem; flex: none; }
.searchRow input {
  flex: 1 1 140px;
  font-size: 1.05rem;
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid var(--accent);
  font-family: inherit;
}
.searchRow .iconBtn {
  flex: none;
  min-height: 46px;
  width: 46px;
  padding: 0;
  font-size: 1.15rem;
  border-radius: 10px;
  border: 1px solid var(--edge);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}
.searchRow .iconBtn:hover { border-color: var(--accent); }
.searchRow .iconBtn.listening { animation: pulse 1.3s infinite; border-color: var(--over); color: var(--over); }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
.scanReader { width: 100%; max-width: 360px; margin: 0.8rem 0; border-radius: 10px; overflow: hidden; }
.searchStatus { font-size: 0.95rem; color: var(--ink-dim); margin-top: 0.5rem; min-height: 1.3em; }
.resultsList { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.7rem; }
.resultItem {
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
}
.resultItem .rName { font-size: 1.05rem; font-weight: 700; display: block; margin-bottom: 0.3rem; }
.resultItem .rMeta { font-size: 0.9rem; color: var(--ink-dim); display: block; margin-bottom: 0.6rem; }
.resultItem .bigBtn { width: 100%; }

/* Methioninase */
.methioStatus { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.9rem; padding: 10px 14px; border-radius: 10px; background: var(--bg-soft); }
.methioStatus.logged-yes { background: var(--safe-bg); color: var(--safe); }
.methioStatus.logged-no { background: var(--bg-soft); color: var(--ink-dim); }
.methioButtons { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.methioButtons[hidden] { display: none; }
.methioButtons .bigBtn { flex: 1; min-width: 160px; }
.methioDetails { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.7rem; }
.methioDetails[hidden] { display: none; }
.methioDetails label { font-size: 0.95rem; font-weight: 700; display: flex; flex-direction: column; gap: 0.3rem; }
.methioDetails input, .methioDetails textarea {
  font-size: 1rem;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--edge);
  font-family: inherit;
  font-weight: 400;
}

/* Today's item list */
.itemList { display: flex; flex-direction: column; gap: 0.6rem; }
.itemRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
}
.itemRow .iName { font-size: 1.02rem; font-weight: 700; }
.itemRow .iMeta { font-size: 0.9rem; color: var(--ink-dim); }
.itemRow .rmBtn {
  background: none;
  border: 2px solid var(--over);
  color: var(--over);
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 800;
  width: 40px;
  height: 40px;
  cursor: pointer;
}
.emptyNote { color: var(--ink-dim); font-size: 1rem; }

.metEstimated {
  color: var(--caution);
  background: var(--caution-bg);
  font-weight: 800;
  border-radius: 6px;
  padding: 2px 8px;
  display: inline-block;
}

.estimateWarning {
  margin-top: 0.8rem;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--caution-bg);
  color: var(--caution);
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
}
.estimateWarning[hidden] { display: none; }

.disclaimer {
  margin-top: 1.5rem;
  padding: 1.1rem 1.2rem;
  border: 3px solid var(--over);
  background: var(--over-bg);
  color: var(--ink);
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.55;
}

/* Edit quick-add modal */
.modalOverlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 1.2rem;
}
.modalOverlay[hidden] { display: none; }
.modal {
  background: var(--bg);
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.3rem 1.4rem;
}
.modal h2 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.modal p { font-size: 0.95rem; color: var(--ink-dim); margin: 0 0 0.8rem; }
.modal textarea {
  width: 100%;
  font-size: 1rem;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--edge);
  font-family: inherit;
}
.modalActions { display: flex; gap: 0.7rem; margin-top: 1rem; justify-content: flex-end; }

/* Quick-add food editor: one row per button, edit or remove in place */
.editFoodList { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 0.6rem; }
.editFoodRow { display: flex; gap: 0.5rem; align-items: center; }
.editFoodInput {
  flex: 1;
  font-size: 1rem;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--edge);
  font-family: inherit;
}
.editFoodRow .rmBtn {
  flex: none;
  background: none;
  border: 2px solid var(--over);
  color: var(--over);
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 800;
  width: 40px;
  height: 40px;
  cursor: pointer;
}

/* Tutorial walkthrough */
.tutorialModal { text-align: center; }
.tutorialProgress { font-size: 0.85rem; color: var(--ink-dim); font-weight: 700; margin-bottom: 0.5rem; }
.tutorialIcon { font-size: 3rem; margin-bottom: 0.4rem; }
.tutorialModal h2 { font-size: 1.3rem; margin: 0 0 0.7rem; }
.tutorialModal p { font-size: 1.08rem; color: var(--ink); line-height: 1.6; margin: 0 0 1.2rem; }
.tutorialDots { display: flex; justify-content: center; gap: 7px; margin-bottom: 1.2rem; }
.tutorialDot { width: 9px; height: 9px; border-radius: 50%; background: var(--edge); }
.tutorialDot.active { background: var(--accent); }
.tutorialNav { display: flex; align-items: center; gap: 0.6rem; }
.tutorialNav .bigBtn { flex: 1; }
.tutorialNav .linkBtn { flex: none; margin-top: 0; width: auto; padding: 8px 6px; }

@media print {
  header, .totalActions, .card:has(#btnToggleSearch), .card:has(#btnMethioYes), .card:has(#btnPrint), .disclaimer { display: none !important; }
  body { background: white; }
  .card, .totalCard { border: 1px solid #999; }
}
