/* In-app dialog */
.dialog-backdrop {
  z-index: 700;
}

.dialog-box {
  max-width: 420px;
  padding: 22px;
}

.dialog-title {
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.dialog-message {
  font-size: 0.84rem;
  color: var(--text-muted);
  white-space: pre-line;
  margin-bottom: 14px;
}

.dialog-input {
  width: 100%;
  margin-bottom: 14px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Toast with Undo */
.toast-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
}

.toast-banner.has-undo.show {
  pointer-events: auto;
}

.toast-undo {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  padding: 3px 10px;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.toast-undo:hover {
  background: var(--accent-soft);
}

@media (max-width: 600px) {
  .toast-banner {
    left: 16px;
    right: 16px;
    bottom: 16px;
    justify-content: space-between;
  }
}

/* Meal note */
.meal-note {
  display: block;
  margin-top: 3px;
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.74rem;
  font-style: italic;
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.meal-note:hover {
  color: var(--text);
}

/* Counter anchors: the fill shows progress towards the daily target */
.anchor-chip.counter:not(.done) {
  background-image: linear-gradient(90deg, var(--accent-soft) var(--p), transparent var(--p));
}

.anchor-count {
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  margin-left: 2px;
}

.anchor-target-input {
  width: 64px;
  padding: 6px 8px;
  font-size: 0.8rem;
}

.anchor-edit-row .anchor-target-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

/* Weekly focus history */
.focus-history {
  margin-top: 10px;
  font-size: 0.78rem;
}

.focus-history summary {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
}

.focus-history-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.focus-history-item:last-child {
  border-bottom: none;
}

.focus-history-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-bottom: 2px;
}

.focus-history-score.score-high { color: var(--accent); }
.focus-history-score.score-mid { color: var(--amber); }
.focus-history-score.score-low { color: var(--orange); }

/* Long-press targets: stop iOS text selection / callout stealing the gesture */
.template-chip,
.anchor-chip,
.day-col,
.heatmap-cell,
.meal-row {
  -webkit-touch-callout: none;
}

.template-chip,
.anchor-chip,
.day-col,
.heatmap-cell {
  -webkit-user-select: none;
  user-select: none;
}
