:root {
  --color-bg: #FAF7F2;
  --color-card: #FFFFFF;
  --color-placeholder: #F1EBE2;
  --color-accent: #C2703D;
  --color-text: #24211d;
  --color-error: #B3261E;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  /* Make the HTML `hidden` attribute win over author rules such as
     `.suggest-success`/`.selected-recipe` that set their own display value —
     without this reset, #suggest-success rendered the instant the dialog
     opened. Guarded by internal/web/style_hidden_test.go. */
  display: none !important;
}

body {
  margin: 0;
  background-color: var(--color-bg);
  font-family: var(--font-family);
  color: var(--color-text);
}

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-md);
}

.card {
  width: 100%;
  max-width: 640px;
  background-color: var(--color-card);
  border-top: 2px solid var(--color-accent);
  border-radius: 12px;
  padding: var(--space-lg);
}

@media (min-width: 480px) {
  .page {
    gap: var(--space-xl);
    padding: var(--space-2xl) var(--space-xl);
  }

  .card {
    padding: var(--space-xl);
  }
}

.eyebrow {
  color: var(--color-accent);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 var(--space-sm) 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.image-box {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: var(--space-md);
  background-color: var(--color-placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-box.placeholder .state-icon {
  width: 25%;
  height: 25%;
  color: var(--color-accent);
}

.title {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 var(--space-md) 0;
}

.description {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  margin: 0;
}

.state-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
}

.state-message .state-icon {
  width: 48px;
  height: 48px;
  color: var(--color-accent);
  margin-bottom: var(--space-md);
}

.heading {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 var(--space-sm) 0;
}

.body {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  margin: 0;
  max-width: 40ch;
}

.card.week-list {
  border-top: none;
}

.day-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-placeholder);
}

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

.day-row.today {
  border-left: 4px solid var(--color-accent);
  background-color: rgba(194, 112, 61, 0.08);
}

.day-row.past {
  opacity: 0.55;
}

.day-row .body.muted {
  color: rgba(36, 33, 29, 0.55);
}

.image-box.thumb {
  width: 64px;
  height: 64px;
  aspect-ratio: unset;
  margin-bottom: 0;
}

/* --- Phase 3: suggestion dialog + per-day trigger (BOARD-01/02, SUGG-*) --- */

.suggest-trigger {
  color: var(--color-accent);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  background: none;
  border: none;
  padding: 12px 4px;
  margin: -12px -4px;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
dialog:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.form-error {
  border-left: 3px solid var(--color-error);
  background-color: rgba(179, 38, 30, 0.08);
  color: var(--color-error);
  padding: var(--space-sm) var(--space-md);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  margin-bottom: var(--space-md);
}

.suggest-dialog {
  background-color: var(--color-card);
  border: none;
  border-radius: 12px;
  max-width: 480px;
  width: calc(100% - 32px);
  padding: var(--space-md);
  color: var(--color-text);
}

.suggest-dialog::backdrop {
  background-color: rgba(36, 33, 29, 0.5);
}

@media (min-width: 480px) {
  .suggest-dialog {
    padding: var(--space-lg) var(--space-xl);
  }
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.dialog-header .heading {
  margin: 0;
}

.dialog-close {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  background: none;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.mode-toggle {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.mode-toggle-btn {
  flex: 1;
  min-height: 44px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--color-placeholder);
  background: transparent;
  color: var(--color-text);
}

.mode-toggle-btn[aria-pressed="true"] {
  background-color: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.mode-panel {
  margin-bottom: var(--space-md);
}

.field-group {
  margin-bottom: var(--space-md);
}

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: var(--space-sm);
}

.field-help {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: rgba(36, 33, 29, 0.55);
  margin: var(--space-xs) 0 0 0;
}

.mode-panel input[type="text"],
.mode-panel input[type="url"],
.field-group input,
.field-group textarea {
  width: 100%;
  min-height: 44px;
  padding: var(--space-sm) var(--space-md);
  border-radius: 8px;
  border: 1px solid var(--color-placeholder);
  font: inherit;
  color: var(--color-text);
  background-color: var(--color-card);
}

.field-group textarea {
  min-height: 88px;
  resize: vertical;
}

.picker-results {
  margin-top: var(--space-sm);
  max-height: 240px;
  overflow-y: auto;
}

.picker-result {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: 8px;
  cursor: pointer;
}

.picker-result:hover {
  background-color: var(--color-placeholder);
}

/* Selected state MUST stay visible independent of :hover — placed after the
   :hover rule so a row that is both selected and hovered still reads as
   selected (SUGG-02 gap part 1). Accent tint + left bar + check glyph give
   three redundant, hover-independent cues distinct from the plain hover
   background above. */
.picker-result.selected {
  background-color: rgba(194, 112, 61, 0.10);
  box-shadow: inset 3px 0 0 var(--color-accent);
}

.picker-result.selected::after {
  content: "\2713";
  margin-left: auto;
  color: var(--color-accent);
  font-weight: 600;
}

.picker-result .image-box.thumb {
  border-radius: 8px;
  flex-shrink: 0;
}

/* Persistent "Selected: <name>" chip (SUGG-02 gap part 2) — lives outside
   #picker-results so it survives both pointer-leave and a results re-render
   (typing to re-filter empties and rebuilds #picker-results, not this
   element). */
.selected-recipe {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: 8px;
  background-color: rgba(194, 112, 61, 0.10);
  border: 1px solid var(--color-accent);
  font-size: 14px;
  color: var(--color-text);
}

.selected-recipe .selected-recipe-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: -14px -10px;
  background: none;
  border: none;
  /* Use the high-contrast text token (matches .dialog-close and the chip's
     own label) — the accent orange was only ~3.3:1 against the chip's
     pale-orange tint, below the 4.5:1 WCAG text bar, so the × rendered but
     was imperceptible to a real user (03-08 UAT regression). */
  color: var(--color-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.suggest-submit {
  width: 100%;
  min-height: 44px;
  background-color: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-top: var(--space-sm);
}

.suggest-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.suggest-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-lg) 0;
}

.suggest-done {
  min-height: 44px;
  min-width: 96px;
  margin-top: var(--space-md);
  background-color: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

/* --- Phase 5: non-Mealie approved-link card (BOARD-04) --- */

/* .day-text currently has no rule at all -- without min-width: 0 the flex
   child cannot shrink below its content width, and .link-title's
   text-overflow: ellipsis silently does nothing. Required for the
   overflow/long-text UI Considerations rows to actually hold. */
.day-text {
  flex: 1;
  min-width: 0;
}

.link-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  width: fit-content;
  padding: var(--space-xs) var(--space-sm);
  margin: 0 0 var(--space-xs) 0;
  border-radius: 999px;
  background-color: rgba(194, 112, 61, 0.10);
  border: 1px solid var(--color-accent);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.link-title {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-accent);
  text-decoration: underline;
  font-weight: 400;
}

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
