/* ── MIGRAINE SEVERITY BUTTONS ──────────────── */
.migraine-row {
  display: flex;
  gap: 6px;
  width: 100%;
  margin-bottom: 12px;
}

.migraine-btn {
  flex: 1;
  min-height: var(--tap-min-wide);
  border: 3px solid transparent;
  border-radius: var(--radius);
  font-size: var(--font-xlarge);
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  color: #fff;
}

.migraine-btn[data-score="0"] { background: rgba(46,125,50,0.6); }
.migraine-btn[data-score="1"] { background: rgba(85,139,47,0.6); }
.migraine-btn[data-score="2"] { background: rgba(249,168,37,0.6); }
.migraine-btn[data-score="3"] { background: rgba(239,108,0,0.6); }
.migraine-btn[data-score="4"] { background: rgba(198,40,40,0.6); }
.migraine-btn[data-score="5"] { background: rgba(123,31,162,0.6); }

.migraine-btn.active[data-score="0"] { background: var(--migraine-0); border-color: var(--text-primary); }
.migraine-btn.active[data-score="1"] { background: var(--migraine-1); border-color: var(--text-primary); }
.migraine-btn.active[data-score="2"] { background: var(--migraine-2); border-color: var(--text-primary); }
.migraine-btn.active[data-score="3"] { background: var(--migraine-3); border-color: var(--text-primary); }
.migraine-btn.active[data-score="4"] { background: var(--migraine-4); border-color: var(--text-primary); }
.migraine-btn.active[data-score="5"] { background: var(--migraine-5); border-color: var(--text-primary); }

/* ── STRESS BUTTONS ─────────────────────────── */
.stress-btn[data-stress="1"] { background: rgba(46,125,50,0.6); }
.stress-btn[data-stress="2"] { background: rgba(124,179,66,0.6); }
.stress-btn[data-stress="3"] { background: rgba(249,168,37,0.6); }
.stress-btn[data-stress="4"] { background: rgba(239,108,0,0.6); }
.stress-btn[data-stress="5"] { background: rgba(198,40,40,0.6); }

.stress-btn.active[data-stress="1"] { background: var(--stress-1); border-color: var(--text-primary); }
.stress-btn.active[data-stress="2"] { background: var(--stress-2); border-color: var(--text-primary); }
.stress-btn.active[data-stress="3"] { background: var(--stress-3); border-color: var(--text-primary); }
.stress-btn.active[data-stress="4"] { background: var(--stress-4); border-color: var(--text-primary); }
.stress-btn.active[data-stress="5"] { background: var(--stress-5); border-color: var(--text-primary); }

/* ── PAIN GROUPS (hidden until migraine > 0) ── */
#pain-groups {
  display: none;
}

#pain-groups.visible {
  display: block;
}

/* ── SCHEDULE SECTION ───────────────────────── */
.sched-indicators {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Collapsible per-slot sub-sections, each with its own accent color */
.sched-sub {
  border-radius: var(--radius);
  margin-bottom: 10px;
  border-left: 5px solid var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}
.sched-sub:last-child { margin-bottom: 0; }
.sched-sub-morning { border-left-color: var(--migraine-3); }
.sched-sub-noon    { border-left-color: var(--migraine-2); }
.sched-sub-night   { border-left-color: var(--migraine-5); }

.sched-sub-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.sched-sub-header .section-arrow { font-size: 12px; width: 14px; }
.sched-sub-title {
  flex: 1;
  font-weight: 700;
  font-size: var(--font-base);
  letter-spacing: 0.04em;
}
.sched-sub-morning .sched-sub-title { color: var(--migraine-3); }
.sched-sub-noon    .sched-sub-title { color: var(--migraine-2); }
.sched-sub-night   .sched-sub-title { color: var(--migraine-5); }

.sched-sub-body { padding: 2px 12px 8px; }
.sched-sub-body.hidden { display: none; }

.sched-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--bg-input);
}
.sched-item:first-child { border-top: none; }
.sched-item-info { flex: 1; min-width: 0; }
.sched-item-name { font-weight: 700; font-size: var(--font-base); }
.sched-item-dose { color: var(--text-secondary); font-size: var(--font-base); margin-top: 2px; }
.sched-item .slot-btn { flex: 0 0 auto; width: 64px; }

.sched-empty {
  color: var(--text-secondary);
}

/* ── AGENDA SECTION ──────────────────────────── */
.agenda-ind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  color: var(--text-primary);
}
.agenda-ind .icon { width: 18px; height: 18px; }
.agenda-ind.state-up   { background: rgba(92,107,192,0.18); border-color: #5c6bc0; }
.agenda-ind.state-late { background: var(--migraine-4); border-color: var(--migraine-4); }

.agenda-item {
  display: grid;
  grid-template-columns: 1fr 64px;
  grid-template-rows: auto auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  border-left: 5px solid var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.agenda-item:last-child { margin-bottom: 0; }
.agenda-item.state-upcoming { border-left-color: #5c6bc0; }
.agenda-item.state-late     { border-left-color: var(--migraine-4); }
.agenda-item.state-done     { border-left-color: var(--bg-frank-active); opacity: 0.85; }

.agenda-when {
  grid-column: 1; grid-row: 1;
  font-weight: 700;
  font-size: var(--font-base);
}
.agenda-item.state-late .agenda-when { color: var(--migraine-4); }
.agenda-desc {
  grid-column: 1; grid-row: 2;
  font-size: var(--font-base);
  margin-top: 2px;
}
.agenda-loc {
  grid-column: 1; grid-row: 3;
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 1px;
}
.agenda-loc:empty { display: none; }
.agenda-check {
  grid-column: 2;
  grid-row: 2 / 4;
  align-self: center;
}

.agenda-empty {
  color: var(--text-secondary);
}

/* ── MILESTONES SECTION ──────────────────────── */
.ms-count {
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 14px;
  background: rgba(79,195,247,0.18);
  border: 2px solid var(--milestone);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}
.ms-count:empty { display: none; }

.ms-item {
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  border-left: 5px solid var(--milestone);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ms-when  { font-weight: 700; font-size: var(--font-base); }
.ms-label { font-size: var(--font-base); margin-top: 2px; overflow-wrap: anywhere; }
.ms-note  { font-size: 14px; color: var(--text-secondary); margin-top: 1px; overflow-wrap: anywhere; }
.ms-empty { color: var(--text-secondary); margin-bottom: 12px; }
.ms-more {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-bottom: 12px;
  background: none;
  border: none;
  color: var(--milestone);
  font-size: var(--font-base);
  font-weight: 700;
  cursor: pointer;
}
#section-milestones .add-item-btn { margin-top: 4px; }

/* ── MOON SECTION ────────────────────────────── */
.moon-ind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  color: var(--text-primary);
}
.moon-ind .icon { width: 18px; height: 18px; }
.moon-ind.state-none    { color: var(--text-secondary); }
.moon-ind.state-new     { background: rgba(255,255,255,0.06); border-color: var(--text-secondary); }
.moon-ind.state-super   { background: rgba(255,213,79,0.18);  border-color: #ffd54f; color: #ffd54f; }
.moon-ind.state-harvest { background: rgba(255,167,38,0.18);  border-color: #ffa726; color: #ffa726; }
.moon-ind.state-red     { background: rgba(198,40,40,0.20);   border-color: var(--migraine-4); }
.moon-ind.state-peak    { background: var(--migraine-4);      border-color: var(--migraine-4); }

.moon-now {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  border-left: 5px solid var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  font-weight: 700;
  font-size: var(--font-base);
}
.moon-now.state-peak    { border-left-color: var(--migraine-4); }
.moon-now.state-red     { border-left-color: var(--migraine-4); }
.moon-now.state-super   { border-left-color: #ffd54f; }
.moon-now.state-harvest { border-left-color: #ffa726; }
.moon-now-icon { display: inline-flex; }
.moon-now-icon .icon { width: 22px; height: 22px; }

.moon-rows { display: flex; flex-direction: column; gap: 6px; }
.moon-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 4px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.moon-row:last-child { border-bottom: none; }
.moon-label { color: var(--text-secondary); font-size: 14px; }
.moon-value { font-weight: 600; text-align: right; }

.moon-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  vertical-align: 1px;
}
.moon-tag.tag-red     { background: var(--migraine-4); color: #fff; }
.moon-tag.tag-super   { background: #ffd54f; color: #222; }
.moon-tag.tag-harvest { background: #ffa726; color: #222; }
.moon-empty { color: var(--text-secondary); }

/* ── MEDICINE SECTION ───────────────────────── */
.medicine-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  row-gap: 4px;
  padding: 8px 0;
  border-bottom: 1px solid var(--bg-input);
}

.medicine-row:last-child {
  border-bottom: none;
}

.med-icon {
  grid-column: 1;
  grid-row: 1;
  text-align: center;
  align-self: center;
  font-size: 1.1em;
  line-height: 1;
}

.medicine-name {
  grid-column: 2;
  grid-row: 1;
  font-weight: 700;
  font-size: var(--font-base);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  align-self: center;
}

.med-controls {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 6px;
}

.show-more-meds-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: var(--bg-input);
  border: none;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: var(--font-base);
  cursor: pointer;
  text-align: center;
}
.show-more-meds-btn:active { opacity: 0.7; }

.dose-select {
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: var(--font-base);
  height: var(--tap-min);
  padding: 0 4px;
  cursor: pointer;
  width: 82px;
  flex-shrink: 0;
}

.dose-select:focus {
  outline: none;
  border-color: var(--bg-active);
}

.fraction-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.fraction-btn {
  width: 44px;
  min-height: var(--tap-min);
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: var(--font-base);
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.fraction-btn:active,
.fraction-btn.active {
  background: var(--bg-active);
  color: var(--text-on-active);
}

.applied-btn {
  min-width: 100px;
  min-height: var(--tap-min);
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: var(--font-base);
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.applied-btn:active,
.applied-btn.active {
  background: var(--bg-active);
  color: var(--text-on-active);
}

.med-log-feedback {
  font-size: 14px;
  color: #2e7d32;
  white-space: nowrap;
}


/* ── LIQUIDS SECTION ────────────────────────── */
.liquid-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.liquid-label {
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text-primary);
  min-width: 110px;
  flex-shrink: 0;
}

.liquid-row .btn-group-row {
  flex: 1;
}

/* ── MEAL SLOT BUTTONS ──────────────────────── */
.meal-slot-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

/* ── RECENT ITEMS GRID ──────────────────────── */
.recent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.recent-item-btn {
  min-height: 56px;
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  padding: 6px;
  text-align: center;
  word-break: break-word;
}

.recent-item-btn.active {
  border-color: var(--bg-active);
  background: rgba(233, 69, 96, 0.2);
}

/* ── RISK TAGS ──────────────────────────────── */
.risk-tags-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.risk-tag-btn {
  min-height: var(--tap-min);
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.risk-tag-btn.active {
  border-color: var(--bg-active);
  background: rgba(233, 69, 96, 0.2);
}

/* ── ADD ITEM BUTTON ────────────────────────── */
.add-item-btn {
  width: 100%;
  min-height: var(--tap-min);
  background: var(--bg-input);
  border: 2px dashed var(--text-secondary);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: var(--font-base);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  margin-bottom: 12px;
}

/* ── SAME AS USUAL ──────────────────────────── */
.same-as-usual {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-input);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.same-as-usual-name {
  flex: 1;
  font-size: var(--font-base);
}

.use-template-btn {
  min-height: 44px;
  min-width: 60px;
  background: var(--bg-frank-active);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: var(--font-base);
  font-weight: 700;
  cursor: pointer;
  padding: 0 12px;
}

/* ── SELECTED ITEMS LIST ────────────────────── */
.selected-items {
  margin-top: 12px;
}

.selected-items-title {
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* ── FOOD SEARCH RESULTS ────────────────────── */
.food-search-results {
  max-height: 300px;
  overflow-y: auto;
}

.food-search-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--bg-input);
  cursor: pointer;
  min-height: var(--tap-min);
  -webkit-tap-highlight-color: transparent;
}

.food-search-item:hover {
  background: var(--bg-input);
}

.food-search-name {
  flex: 1;
  font-size: var(--font-base);
}

.food-search-meta {
  font-size: 14px;
  color: var(--text-secondary);
}
