:root {
  /* Black / orange / white. The ground is a neutral haze, not cream — the
     brief says white, and warm cream + terracotta is the look every other
     app of this kind lands on. */
  --ink: #14110f;
  --ink-soft: #2e2926;
  --flame: #ff5a1f;
  --flame-deep: #c23d0f;
  --haze: #f5f3f1;

  --card: #ffffff;
  --accent: var(--flame);
  --accent-2: #ff8a4c;
  --accent-dark: var(--flame-deep);
  --bg: var(--haze);
  --text: var(--ink);
  --muted: #7b746e;
  --border: #e6e2de;
  /* Semantic pair: green means a good experience, red means a bad one.
     Never used as decoration — only where the rating actually says so. */
  --good: #1f8a4c;
  --good-soft: #e8f5ed;
  --bad: #d92d20;
  --bad-soft: #fdeceb;

  --radius: 16px;
  --shadow: 0 6px 20px rgba(20, 17, 15, 0.07);
  --font-display: "Secular One", "Rubik", "Segoe UI", sans-serif;
  --font-body: "Rubik", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

:focus-visible {
  outline: 3px solid var(--flame);
  outline-offset: 2px;
  border-radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; }

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 84px;
}

a { color: inherit; }

/* Orange leads — it is the brand's primary surface and the first thing seen.
   Black is the supporting colour: the rule below, the nav, the type. */
.header {
  position: relative;
  background: linear-gradient(150deg, var(--flame) 0%, #ff7a3d 55%, var(--flame-deep) 100%);
  color: #fff;
  padding: 24px 20px 26px;
  border-radius: 0 0 26px 26px;
  box-shadow: var(--shadow);
  text-align: center;
  overflow: hidden;
}
.header > * { position: relative; }
/* Black rule anchoring the header — the secondary colour doing structural work */
.header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: var(--ink);
}

.header .brand-logo {
  display: block;
  max-width: 320px;
  width: 70%;
  height: auto;
  margin: 0 auto;
  background: #fff;
  border-radius: 14px;
  padding: 14px 20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.header .brand-title {
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: 21px;
  letter-spacing: 0.2px;
  color: #fff;
}
.header .brand-title::after {
  content: "ארוחות צהריים במשרד";
  display: block;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 5px;
}

.container { padding: 16px; }

/* Signed-out screens are a single card — centre it instead of stranding it
   at the top of a tall empty page. */
.container-auth {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 260px);
  padding-bottom: 32px;
}
#app:has(.container-auth) { padding-bottom: 0; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid rgba(28, 25, 23, 0.05);
}

/* Card section headings get an orange tick so the eye finds them fast */
.card > h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.card > h3::after {
  content: "";
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

h1, h2, h3 { margin: 0 0 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
  width: 100%;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: scale(0.98); }
.btn.secondary { background: var(--border); color: var(--text); }
.btn.danger { background: var(--bad); }
.btn.small { width: auto; padding: 8px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="file"], textarea, select {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}
textarea { resize: vertical; min-height: 80px; }
label { display: block; font-weight: 700; margin: 12px 0 6px; font-size: 14px; }
label:first-child { margin-top: 0; }

.stars { display: flex; gap: 4px; flex-direction: row-reverse; justify-content: flex-end; }
.stars .star {
  font-size: 28px;
  cursor: pointer;
  color: var(--border);
  user-select: none;
}
.stars .star.active { color: var(--accent); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.switch { position: relative; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: var(--border); border-radius: 999px; cursor: pointer; transition: background 0.15s;
}
.switch .track::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff; top: 3px; right: 3px; transition: transform 0.15s;
}
.switch input:checked + .track { background: var(--good); }
.switch input:checked + .track::after { transform: translateX(-20px); }

.dish-card { display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.dish-card .name { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.dish-card .meta { font-size: 12px; color: var(--muted); }
.score-badge {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  border-radius: 10px;
  padding: 6px 10px;
  min-width: 42px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.score-badge.empty { background: var(--border); color: var(--muted); }
/* Score drives colour: green is a good meal, red is a bad one, orange is in between */
.score-badge.high { background: var(--good); }
.score-badge.mid { background: var(--accent); }
.score-badge.low { background: var(--bad); }

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.toolbar select, .toolbar input { flex: 1; }

.rating-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.rating-item:last-child { border-bottom: none; }
.rating-item .author { font-weight: 700; font-size: 14px; }
.rating-item .ordered-item { font-size: 14px; margin-top: 2px; color: var(--accent-dark); font-weight: 600; }
.rating-item .stars-row { display: flex; gap: 10px; margin: 6px 0; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.rating-item .free-text { margin: 6px 0; font-size: 14px; }
.rating-item img.photo { max-width: 100%; border-radius: 12px; margin: 6px 0; display: block; }
.badges { display: flex; gap: 6px; margin: 6px 0; flex-wrap: wrap; }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; font-weight: 700; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

.reactions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.reaction-btn {
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
}
.reaction-btn.active { border-color: var(--accent); background: #fff1e8; }

/* Nav picks up the header's black so the app is bookended in ink,
   with orange reserved for the one tab you're actually on. */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 560px;
  margin: 0 auto;
  background: var(--ink);
  display: flex;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(20, 17, 15, 0.25);
}
.bottom-nav button {
  flex: 1;
  background: none;
  border: none;
  padding: 8px 2px;
  /* 44px minimum touch target */
  min-height: 44px;
  font-size: 11px;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border-radius: 10px;
  transition: color 0.15s ease;
}
.bottom-nav button .icon { display: flex; }
.bottom-nav button.active { color: #fff; font-weight: 600; }
.bottom-nav button.active .icon { color: var(--flame); }

.icon { flex-shrink: 0; }
h3 .icon { color: var(--flame); }

.error-msg { color: var(--bad); font-size: 13px; margin-top: 6px; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }

.avatar {
  width: 64px; height: 64px; border-radius: 50%;
  object-fit: cover; background: var(--border);
  display: block;
}
.avatar.small { width: 36px; height: 36px; }

/* Small avatars used inline next to names in feeds and threads */
.avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.avatar-sm.tiny { width: 22px; height: 22px; font-size: 11px; }
.avatar-fallback {
  background: var(--ink); color: #fff;
  font-weight: 700; font-size: 13px;
}
.author-row { display: flex; align-items: center; gap: 8px; }

/* Comment thread under a rating — the discussion space */
.comments {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.comment { padding: 6px 0; }
.comment-author { font-weight: 600; font-size: 13px; }
.comment-time { font-size: 11px; }
.comment-body { font-size: 13px; margin-top: 2px; padding-right: 30px; }
.comment-delete {
  margin-right: auto; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 18px; line-height: 1; padding: 0 4px;
}
.comment-delete:hover { color: var(--bad); }
.comment-form { display: flex; gap: 8px; margin-top: 8px; }
.comment-form input { flex: 1; padding: 8px 10px; font-size: 13px; }

.admin-actions { display: flex; flex-wrap: wrap; gap: 4px; }

table.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.admin-table th, table.admin-table td { text-align: right; padding: 8px 4px; border-bottom: 1px solid var(--border); }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button {
  flex: 1; padding: 10px; border-radius: 10px; border: 1.5px solid var(--border);
  background: #fff; cursor: pointer; font-weight: 700; font-size: 13px;
}
.tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.quote-banner {
  background: var(--ink);
  color: #fff;
  border-right: 5px solid var(--accent);
  position: relative;
}
.quote-banner div { font-size: 14px; line-height: 1.5; }
.quote-banner div:last-child { color: var(--accent-2); }

.stat-grid { display: flex; gap: 10px; margin-bottom: 14px; }
.stat-tile {
  flex: 1;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(20, 17, 15, 0.05);
  padding: 16px 6px 14px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
/* Orange keyline ties the tiles to the accent without three orange numbers */
.stat-tile::before {
  content: "";
  position: absolute; top: 0; left: 20%; right: 20%;
  height: 3px;
  background: var(--flame);
  border-radius: 0 0 3px 3px;
}
.stat-num {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 11px; color: var(--muted); margin-top: 6px; }

.rank-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.rank-item:last-child { border-bottom: none; }
.rank-num {
  width: 22px; height: 22px; border-radius: 50%; background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.rank-name { flex: 1; font-weight: 600; font-size: 14px; }

/* Week strip — the signature element. Encodes the real rule of the product:
   one rating per day, Sunday to Thursday. */
.week-card { display: flex; flex-direction: column; gap: 14px; }
.week-strip {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.week-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.week-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.week-dot {
  width: 100%;
  height: 34px;
  border-radius: 10px;
  background: var(--haze);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: transparent;
}
.week-day.rated .week-dot {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.week-day.today .week-label { color: var(--flame); }
.week-day.today .week-dot { border-color: var(--flame); border-width: 2px; }
.week-day.today.rated .week-dot { background: var(--flame); border-color: var(--flame); }
.week-day.future .week-dot { opacity: 0.45; }

.activity-item { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.activity-item:last-child { border-bottom: none; }

/* Dislikes are the one place the interface should feel like a warning */
.dislike-group {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--bad-soft);
  border-right: 4px solid var(--bad);
}
.dislike-group .rank-name { color: var(--bad); }
/* Admin inbox entries are neutral by default; maintenance is flagged orange
   because it leaves the building as an email. */
.issue-group {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--haze);
  border-right: 4px solid var(--border);
}
.issue-group.maintenance { border-right-color: var(--flame); }
.dislike-group:last-child { border-bottom: none; }
.dislike-group-header {
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; margin-bottom: 6px;
}
.dislike-item { font-size: 13px; padding: 4px 0; }

/* Reminder + nudge controls */
.reminder-row { display: flex; align-items: center; gap: 12px; }
.reminder-row input[type="time"] {
  flex: 1; padding: 12px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 15px; font-family: inherit; background: #fff;
}
.nudge-emojis { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.emoji-pick {
  border: 1.5px solid var(--border); background: #fff; border-radius: 10px;
  padding: 6px 9px; font-size: 17px; cursor: pointer; line-height: 1;
}
.emoji-pick.active { border-color: var(--flame); background: #fff1e8; }
.nudge-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.nudge-row:last-child { border-bottom: none; }
