* {
  box-sizing: border-box;
}

:root {
  --bg: #f4efe6;
  --bg-accent: #efe4d2;
  --surface: #fffaf3;
  --surface-strong: #ffffff;
  --border: #d8c7ab;
  --text: #2a241d;
  --muted: #6d6253;
  --primary: #285943;
  --primary-strong: #183c2c;
  --secondary: #ca6b2c;
  --chat-user: #e4f4ea;
  --chat-agent: #f2eadf;
  --shadow: 0 18px 50px rgba(88, 61, 29, 0.08);
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(202, 107, 44, 0.16), transparent 32%),
    linear-gradient(180deg, var(--bg) 0%, #f8f4ee 100%);
  color: var(--text);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: grid;
  gap: 1.25rem;
}

.page-header h1 {
  margin-bottom: 0.35rem;
}

.page-header p {
  margin: 0;
  color: var(--muted);
}

.page-header-top {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
  justify-content: space-between;
}

.page-header-text {
  flex: 1 1 16rem;
  min-width: 0;
}

.user-bar-card {
  flex: 0 1 auto;
  min-width: 12rem;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
}

.user-bar-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.auth-user-email {
  font-size: 0.95rem;
  word-break: break-all;
}

.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem 3rem;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(40, 89, 67, 0.18), transparent),
    radial-gradient(circle at 100% 100%, rgba(202, 107, 44, 0.12), transparent 45%),
    linear-gradient(165deg, var(--bg) 0%, #faf6ef 55%, var(--bg-accent) 100%);
}

.auth-gate.hidden {
  display: none;
}

.auth-gate-inner {
  width: 100%;
  max-width: 28rem;
}

.auth-card {
  padding: 1.75rem 1.5rem 1.5rem;
}

.auth-brand {
  margin: 0 0 0.35rem;
  color: var(--primary);
  letter-spacing: 0.06em;
}

.auth-title {
  margin: 0 0 0.5rem;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.auth-lead {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.45;
}

.auth-form .field {
  margin-bottom: 0.9rem;
}

.auth-form label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.auth-actions {
  margin-top: 1rem;
  align-items: stretch;
}

.auth-actions .auth-primary {
  flex: 1 1 auto;
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-strong);
  font-weight: 600;
  padding: 0.65rem 1rem;
}

.auth-actions .auth-primary:hover {
  background: var(--primary-strong);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-google {
  display: block;
  text-align: center;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.auth-google:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(40, 89, 67, 0.12);
}

.auth-hint {
  margin: 1.35rem 0 0;
  padding: 0.85rem 0.9rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
  background: var(--bg-accent);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.auth-hint code {
  font-size: 0.78em;
  word-break: break-all;
}

.auth-oauth-notice {
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.9rem;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text);
  background: #fff4e8;
  border: 1px solid var(--secondary);
  border-radius: 12px;
}

.auth-hint a {
  color: var(--primary);
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.explore-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

.row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.align-center {
  align-items: center;
}

.tabs {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tab-button,
input,
select,
button {
  font-size: 0.95rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.tab-button {
  background: rgba(255, 250, 243, 0.72);
  color: var(--muted);
  cursor: pointer;
}

.tab-button.active {
  background: var(--primary);
  color: #fffaf3;
  border-color: var(--primary);
}

input[type="text"] {
  flex: 1;
}

input,
select {
  background: var(--surface-strong);
  color: var(--text);
}

button {
  cursor: pointer;
  background: var(--primary);
  color: #fffaf3;
  border: none;
}

button.secondary {
  background: var(--secondary);
}

.tab-panel {
  display: none;
  gap: 1rem;
}

.tab-panel.active {
  display: grid;
}

.chat-log {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.5rem;
  max-height: 34rem;
  overflow-y: auto;
}

.chat-msg {
  padding: 0.6rem;
  border-radius: 12px;
  background: var(--chat-agent);
  border: 1px solid rgba(109, 98, 83, 0.12);
}

.chat-msg .chat-msg-bubble {
  display: block;
}

.chat-response-meta {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.chat-msg.user {
  background: var(--chat-user);
}

.suggestion-group {
  display: grid;
  gap: 0.75rem;
}

.quick-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.quick-action {
  background: rgba(255, 250, 243, 0.9);
  color: var(--primary-strong);
  border: 1px solid var(--border);
}

.suggestions,
#plan-entries,
#recipe-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem;
  background: var(--surface-strong);
}

.tags {
  color: var(--primary);
  font-size: 0.88rem;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  font-weight: 700;
  color: inherit;
  opacity: 0.82;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.section-head h2 {
  margin: 0.1rem 0 0;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field-inline {
  min-width: 12rem;
}

.field-submit {
  align-self: end;
}

.selected-recipe-context {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 250, 243, 0.92);
}

.selected-recipe-context.hidden {
  display: none;
}

.context-label,
.context-source {
  color: var(--muted);
  font-size: 0.9rem;
}

.results-meta {
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.item-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.item-head h3 {
  margin: 0;
}

.pill-row {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: end;
}

.card-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}

.recipe-link {
  background: transparent;
  color: var(--primary-strong);
  border: 1px dashed var(--border);
  padding: 0.35rem 0.65rem;
}

.message-recipe-ref {
  margin-top: 0.55rem;
}

.nutrient-reflection {
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--border);
  font-size: 0.85rem;
  font-style: italic;
  opacity: 0.78;
}

.plan-date-hint {
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: var(--primary-strong);
  background: var(--bg-accent);
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  display: inline-block;
}

.plan-date-hint.plan-auto-saved {
  background: #e3f0e1;
  color: #1b4d1e;
  border: 1px solid rgba(27, 77, 30, 0.18);
}

.plan-auto-saved-prominent {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  max-width: 100%;
  font-size: 0.9rem;
  line-height: 1.4;
  padding: 0.5rem 0.65rem;
  border-left: 4px solid #1b4d1e;
}

.plan-saved-ico {
  font-weight: 800;
  flex-shrink: 0;
  line-height: 1.2;
}

.app-toast-host {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  margin-bottom: 0.5rem;
  pointer-events: none;
}

.app-toast-host .app-toast {
  pointer-events: auto;
}

.app-toast {
  width: min(100%, 34rem);
  background: #f0f7ef;
  border: 1px solid rgba(27, 77, 30, 0.35);
  box-shadow: 0 8px 28px rgba(40, 80, 50, 0.18);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  animation: toast-in 0.35s ease-out;
}

.app-toast-fade {
  animation: toast-out 0.4s ease-in forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.app-toast-inner {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.app-toast-text p {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text);
}

.app-toast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.app-toast .toast-goto-plan {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
}

.app-toast .toast-goto-plan:hover {
  filter: brightness(1.05);
}

.item.item-plan-done {
  background: rgba(255, 250, 243, 0.96);
}

.plan-saved-inline {
  font-size: 0.9rem;
  color: var(--primary-strong);
  margin: 0.4rem 0 0.2rem;
}

.item.locked {
  opacity: 0.85;
  border-style: dashed;
}

.item.locked .item-head strong {
  text-decoration: line-through dotted;
  text-decoration-thickness: 1px;
}

.pill.lock-pill {
  background: var(--primary-strong);
  color: #fff;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-accent);
  color: var(--primary-strong);
  font-size: 0.8rem;
  font-weight: 700;
}

.pill-negative {
  background: #f1d8cf;
  color: #7b2e18;
}

.pill-positive {
  background: #dfeedd;
  color: #1f533a;
}

.preference-list {
  display: grid;
  gap: 0.75rem;
}

.preference-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem;
  background: var(--surface-strong);
}

.ghost-button {
  background: transparent;
  color: var(--primary-strong);
  border: 1px solid var(--border);
}

.zubereitung-block {
  margin: 0.25rem 0 0.5rem;
}

.instruction-lines {
  display: block;
  margin-top: 0.2rem;
  white-space: pre-line;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .container {
    padding: 1rem 0.9rem 2rem;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: start;
  }
}
