/* Teletál heti választó — shared styles for picker + review pages */

:root {
  --bg: #f6f3ec;
  --card: #ffffff;
  --ink: #221f1a;
  --muted: #7a7466;
  --line: #e5e0d4;
  --paprika: #cf3f2e;
  --paprika-dark: #a92f21;
  --yes: #2e7d46;
  --no: #b33a2b;
  --color-h: #ff8fc7;
  --color-p: #6fb3ff;
  --color-j: #7bd88f;
  --radius: 10px;
}

* { box-sizing: border-box; }

/* Several containers set their own display (grid/flex), which would otherwise
   defeat the hidden attribute's UA display:none. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 12px 120px;
}

/* --- Header --- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 2px 14px;
}

.masthead h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.masthead h1 .spark { color: var(--paprika); }

.masthead .sub {
  font-size: 12px;
  color: var(--muted);
}

/* --- Week tabs + filter chips --- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(var(--bg) 85%, rgba(246, 243, 236, 0));
  padding: 6px 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.week-tabs { display: flex; gap: 6px; }

.week-tab {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.week-tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.chips { display: flex; gap: 6px; margin-left: auto; }

.chip {
  --c: var(--line);
  border: 2px solid var(--c);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  width: 36px;
  height: 32px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.45;
}

.chip.on { background: var(--c); opacity: 1; }
.chip-h { --c: var(--color-h); }
.chip-p { --c: var(--color-p); }
.chip-j { --c: var(--color-j); }

/* --- Day sections --- */

.day {
  margin: 18px 0 10px;
}

.day-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 2px;
  padding: 6px 0;
  cursor: pointer;
  user-select: none;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}

.day-head::-webkit-details-marker { display: none; }

.day-head::after {
  content: '▾';
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

details.day:not([open]) > .day-head::after { content: '▸'; }

details.day > .dish-list { margin-top: 2px; }

.day-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.day-head .count {
  font-size: 12px;
  color: var(--muted);
}

.dish-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* --- Dish rows: the family stripe on the left is the tag data --- */

.dish {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px 10px 18px;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dish::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  background: var(--stripe, var(--line));
}

.dish .thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  cursor: zoom-in;
  background: var(--bg);
}

.dish .main { flex: 1; min-width: 0; }

.dish .name { font-weight: 600; font-size: 15px; }

.dish .meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.dish .price {
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.dish .tick {
  width: 24px;
  height: 24px;
  border: 2px solid var(--line);
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 14px;
  font-weight: 800;
  transition: transform 0.1s ease;
}

.dish.selected { border-color: var(--paprika); }

.dish.selected .tick {
  background: var(--paprika);
  border-color: var(--paprika);
  color: #fff;
  transform: scale(1.08);
}

/* --- Quantity stepper (picker + order sheet) --- */

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.step-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--card);
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  line-height: 1;
}

.step-qty {
  min-width: 22px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
}

.dish.selected .step-btn { border-color: var(--paprika); color: var(--paprika-dark); }

/* --- Order sheet --- */

.order-hint { font-size: 13px; color: var(--muted); margin: 0 0 10px; }

.order-day {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 12px 0 4px;
}

.order-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.order-row .main { flex: 1; min-width: 0; }
.order-row .name { font-weight: 600; font-size: 14px; }
.order-row .meta { font-size: 12px; color: var(--muted); }

.order-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0;
  font-size: 14px;
}

.order-total strong { font-size: 18px; }

#order-list { max-height: 45vh; overflow-y: auto; }

details.rest { margin-top: 8px; }

details.rest summary {
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 2px;
  user-select: none;
}

details.rest .dish-list { margin-top: 6px; }

/* --- Sticky action bar --- */

.actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}

.actionbar .inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.actionbar .info { flex: 1; font-size: 13px; color: var(--muted); }

.btn {
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  background: var(--paprika);
  color: #fff;
}

.btn:active { background: var(--paprika-dark); }

.btn.secondary {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 600;
}

.btn:disabled { opacity: 0.4; cursor: default; }

/* --- Panels (login gate, dialogs) --- */

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
}

.panel h2 { margin: 0 0 6px; font-size: 16px; }

.panel p { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }

.field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
  font-size: 14px;
  margin-bottom: 10px;
  background: #fff;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(34, 31, 26, 0.5);
  display: grid;
  place-items: end center;
  padding: 12px;
}

.overlay .sheet {
  width: 100%;
  max-width: 640px;
  background: var(--card);
  border-radius: 14px;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}

.overlay .sheet h2 { margin: 0 0 10px; font-size: 17px; }

.pick-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 30px 10px;
}

/* --- Image lightbox --- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(20, 18, 15, 0.88);
  display: grid;
  place-items: center;
  cursor: zoom-out;
  padding: 16px;
}

.lightbox figure {
  margin: 0;
  text-align: center;
}

.lightbox img {
  max-width: min(92vw, 960px);
  max-height: 78vh;
  border-radius: 12px;
  display: block;
  margin: 0 auto;
}

.lightbox figcaption {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  margin-top: 10px;
  max-width: 92vw;
}

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 60;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.toast.show { opacity: 1; }

/* Toast with a tappable action (e.g. tag-change undo). */
.toast.has-action {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.toast-act {
  border: none;
  background: none;
  color: #ffb3a0;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}

/* --- Login gate + session badge --- */

.masthead .sub {
  display: flex;
  align-items: center;
  gap: 8px;
}

#me-badge { font-weight: 700; color: var(--ink); }

.logout-btn {
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  text-decoration: underline;
}

.login-error { color: var(--no); font-weight: 600; }

#gsi-button { min-height: 44px; }

/* --- Inline macros on dish rows --- */

.macros {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* --- In-place H/P/J tag chips on dish rows --- */

.tag-edit {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.chip-mini {
  --c: var(--line);
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 2px solid var(--c);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  opacity: 0.45;
  flex-shrink: 0;
}

.chip-mini.on { background: var(--c); opacity: 1; }

/* The logged-in user's own chip: first, bigger, 1-tap. */
.chip-mini.mine {
  width: 34px;
  height: 34px;
  font-size: 13px;
  border-width: 2.5px;
  opacity: 0.6;
}

.chip-mini.mine.on { opacity: 1; }

.info-btn {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
}

/* --- Who put a dish in the shared cart --- */

.added-by {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink);
  flex-shrink: 0;
}

.added-by.by-p { background: var(--color-p); }
.added-by.by-j { background: var(--color-j); }

/* --- Nutrition detail sheet --- */

#detail-overlay .sheet {
  max-height: 80vh;
  overflow-y: auto;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.detail-head h2 { margin: 0; }

.detail-close {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
  padding: 4px 8px;
  flex-shrink: 0;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 10px 0;
}

.detail-table th {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: right;
  padding: 4px 6px;
}

.detail-table th:first-child { text-align: left; }

.detail-table td {
  padding: 4px 6px;
  border-top: 1px solid var(--line);
}

.detail-table td.sub { color: var(--muted); padding-left: 16px; }

.detail-table td + td {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.detail-net { font-size: 13px; margin: 6px 0; }

.detail-allergens { font-size: 13px; margin: 6px 0; }

.detail-ingredients {
  font-size: 13px;
  color: var(--muted);
  white-space: pre-line;
  margin: 6px 0 2px;
}

.detail-component {
  border-top: 2px solid var(--line);
  margin-top: 16px;
  padding-top: 10px;
}

.detail-component h3 { margin: 0 0 4px; font-size: 14px; }

/* --- Own-tag prominence on the labeller --- */

.tag-btn.mine { border-width: 4px; opacity: 0.75; }
.tag-btn.mine.on { opacity: 1; }

.chip.mine { width: 44px; height: 38px; font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media (min-width: 900px) {
  .wrap { max-width: 1100px; }
  .days-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 0 20px;
    align-items: start;
  }
  .actionbar .inner { max-width: 1100px; }
}

:focus-visible { outline: 2px solid var(--paprika); outline-offset: 2px; }
