/* What is specific to מחשבון אוכל (the shared look is in styles.css). */

.head-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.head-row h1 { margin: 0; }
.head-row .spacer { flex: 1; }
.sub { color: var(--muted); font-size: 0.9rem; }

/* tabs (as in budget-app) */
.tabs { display: flex; gap: 6px; margin: 4px 0 16px; overflow-x: auto; scrollbar-width: none; border-bottom: 2px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; display: flex; align-items: center; gap: 6px; padding: 10px 14px; min-height: 44px;
  text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -2px;
  border-radius: 10px 10px 0 0;
}
.tabs a:hover { background: var(--brown-soft); color: var(--brown); }
.tabs a.on { color: var(--brown); border-bottom-color: var(--orange); font-weight: 700; }

/* drag handle (as in budget-app) */
.drag {
  cursor: grab; touch-action: none; user-select: none; color: var(--muted); font-weight: 800; letter-spacing: -2px;
  padding: 4px 6px; border-radius: 6px; line-height: 1; display: inline-block;
}
.drag:hover { background: var(--brown-soft); color: var(--brown); }
.dragging, tr.dragging td { background: var(--orange-soft) !important; }
.dragging .drag { cursor: grabbing; }

/* key screens: a quiet "how it works" fold, tab counters, the "⋯ עוד" menu, narrow cards */
details.howto { margin: -4px 0 10px; color: var(--muted); font-size: 0.9rem; }
details.howto summary { cursor: pointer; width: fit-content; font-weight: 500; }
details.howto summary:hover { color: var(--brown); }
details.howto > div { margin-top: 6px; padding: 10px 14px; background: var(--tint); border-radius: 10px; line-height: 1.6; max-width: 80ch; }
.tab-n { font-size: 0.75rem; font-weight: 600; background: var(--brown-soft); color: var(--brown); border-radius: 999px; padding: 0 7px; }
#ktab .card.narrow { max-width: 640px; margin-inline-start: 0; }
.more-menu { position: relative; }
.more-list { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 60; min-width: 220px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; }
.more-list button { display: block; width: 100%; text-align: start; background: none; border: 0; border-radius: 8px; padding: 9px 10px;
  font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.more-list button:hover:not(:disabled), .more-list button:focus-visible { background: var(--brown-soft); outline: none; }
.more-list button.danger { color: var(--bad, #b3261e); }
.more-list button:disabled { opacity: 0.4; cursor: default; }
.more-list hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.card > .filters { margin-bottom: 12px; }

/* key tables: the fields look like text until hovered or focused */
.key-table td input:not([type=checkbox]), .key-table td select {
  border-color: transparent; background: transparent; box-shadow: none;
}
.key-table td input:not([type=checkbox]) { border-bottom: 1px dashed var(--line); border-radius: 6px 6px 0 0; }
.key-table tr:hover td input:not([type=checkbox]), .key-table tr:hover td select,
.key-table td input:focus, .key-table td select:focus { border-color: var(--line); background: #fff; border-radius: 6px; }
.key-table td input:focus { border-color: var(--orange); }
.key-table td select { -webkit-appearance: none; appearance: none; padding-inline-end: 7px; }
.key-table tr:hover td select { -webkit-appearance: auto; appearance: auto; }
.key-table td input::placeholder { color: var(--ink); opacity: 0.45; }
.key-table td input.changed { border: 1px solid var(--orange); background: var(--orange-soft); border-radius: 6px; }
.key-table td { padding-top: 6px; padding-bottom: 6px; }

/* filters bar above a table */
.filters input[type=search] { min-width: 0; }
.filters .count { color: var(--muted); font-size: 0.85rem; margin-inline-start: auto; align-self: center; }
label.check { display: flex; align-items: center; gap: 6px; font-weight: 500; margin: 0; cursor: pointer; }
label.check input { width: auto; margin: 0; }

/* inputs inside tables */
td input, td select { padding: 5px 7px; margin: 0; font-size: 0.9rem; }
td input.n { width: 84px; direction: ltr; text-align: right; }
td input.n.wide { width: 100px; }
td input.name { min-width: 200px; }
td input.unit { width: 70px; }
td select[data-f=department_id] { min-width: 135px; }
td.c { text-align: center; }
td .ref { display: block; color: var(--muted); font-size: 0.75rem; }
input.changed, td input.changed { border-color: var(--orange); background: var(--orange-soft); font-weight: 700; }
tr.off td { opacity: 0.5; }
tr.review td { background: var(--warn-soft); }
.iconbtn { background: none; border: 0; cursor: pointer; padding: 4px 6px; border-radius: 8px; font-size: 1rem; line-height: 1; }
.iconbtn:hover { background: var(--brown-soft); }
.iconbtn:disabled { opacity: 0.3; cursor: default; background: none; }

/* password with a show/hide eye (as in home-expenses) */
.pw { position: relative; display: block; margin-top: 4px; }
.pw input { padding-left: 42px; margin: 0; }
.pw .pw-eye { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); display: flex; padding: 6px; background: none; border: 0; cursor: pointer; color: var(--muted); }
.pw .pw-eye[aria-pressed="true"] { color: var(--brown); }

/* age-group counts */
.counts { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.counts label { margin: 0; flex: 0 1 130px; }
.counts input { text-align: center; }
.counts .portions { color: var(--muted); font-size: 0.85rem; padding-bottom: 10px; }
.pct-tag { color: var(--muted); font-weight: 400; font-size: 0.8rem; white-space: nowrap; }

/* the menu: days and meals */
.day { padding: 0; overflow: hidden; }
.day-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: var(--tint); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.day-head h2 { margin: 0; }
.day-body { padding: 10px 14px; }
.day-empty { color: var(--muted); padding: 8px 4px; }
details.meal { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: #fff; }
details.meal > summary {
  list-style: none; display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; flex-wrap: wrap;
}
details.meal > summary::-webkit-details-marker { display: none; }
details.meal > summary .chev { transition: transform .15s; display: inline-block; color: var(--muted); }
details.meal[open] > summary .chev { transform: rotate(90deg); }
html[dir=rtl] details.meal[open] > summary .chev { transform: rotate(-90deg); }
details.meal > summary .meal-name { font-weight: 700; font-size: 1.05rem; }
details.meal > summary .meal-meta { color: var(--muted); font-size: 0.85rem; }
details.meal > summary .spacer { flex: 1; }
details.meal[open] > summary { border-bottom: 1px solid var(--line); }
.meal-body { padding: 12px; }
.meal-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.meal-body .table-wrap { margin: 0; padding: 0; }
td.qty { white-space: nowrap; }
td .calc { color: var(--muted); font-size: 0.75rem; display: block; }
.badge.manual { background: #ffe2c4; color: #8a3d00; }
.badge.key { background: var(--brown-soft); color: var(--brown); }
.badge.tribe { background: var(--orange-soft); color: var(--orange-dark); }
.badge.done { background: #efe7dc; color: var(--muted); }
.badge.active { background: var(--ok-soft); color: var(--ok); }

/* allergies */
.allergy-counts { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: flex-end; margin: 4px 0 10px; padding: 8px 10px; background: var(--tint); border-radius: 10px; }
.allergy-counts .lbl { flex-basis: 100%; font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.allergy-counts label { margin: 0; font-size: 0.8rem; flex: 0 1 110px; }
.allergy-counts input { text-align: center; padding: 5px 7px; }
.badge.allergy { background: #e3eefa; color: #2a5a8c; }
select.for-sel { min-width: 105px; }
.chip { display: inline-block; background: var(--brown-soft); color: var(--brown); border-radius: 999px; padding: 1px 9px; font-size: 0.8rem; font-weight: 500; }
.linkbtn.small { font-size: 0.75rem; display: block; margin-top: 2px; }

/* key import review */
.imp-similar { display: grid; gap: 8px; max-height: 40vh; overflow-y: auto; margin-bottom: 10px; }
.imp-similar label { margin: 0; font-weight: 400; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.imp-fold { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
.imp-fold summary { cursor: pointer; font-weight: 700; }
.imp-list { margin: 6px 0 0; padding-inline-start: 18px; max-height: 30vh; overflow-y: auto; font-size: 0.9rem; }

/* item picker */
.dialog.wide { max-width: min(720px, calc(100vw - 24px)); width: 720px; }
.pick-list { max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; }
.pick-list h3 { position: sticky; top: 0; margin: 0; padding: 6px 10px; background: var(--tint); font-size: 0.85rem; color: var(--muted); }
.pick-list label { display: flex; gap: 8px; align-items: center; padding: 6px 10px; margin: 0; font-weight: 400; border-top: 1px solid var(--line); cursor: pointer; }
.pick-list label:hover { background: var(--tint); }
.pick-list label input { width: auto; margin: 0; }
.pick-list label .in-meal { color: var(--muted); font-size: 0.8rem; margin-inline-start: auto; }

/* shopping list */
.dept { padding: 0; overflow: hidden; }
.dept-head { display: flex; align-items: baseline; gap: 10px; padding: 12px 18px; background: var(--tint); border-bottom: 1px solid var(--line); }
.dept-head h2 { margin: 0; }
.dept-head .spacer { flex: 1; }
.dept .table-wrap { margin: 0; padding: 0; }
.meals-cell { font-size: 0.8rem; color: var(--muted); }
.stats .stat b .money, .money { unicode-bidi: isolate; direction: ltr; display: inline-block; white-space: nowrap; }

.links { margin-top: 14px; text-align: center; }
.radio-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 0 12px; }
.radio-row label { display: flex; gap: 6px; align-items: center; margin: 0; font-weight: 500; }
.radio-row input { width: auto; margin: 0; }

@media (max-width: 640px) {
  .day-head, .dept-head { padding: 10px 12px; }
  .day-body { padding: 8px; }
  .meal-body { padding: 8px; }
  td input.name { min-width: 150px; }
  .stats { gap: 8px; }
  .stats .stat { flex: 1 1 100px; padding: 8px 10px; }
  .stats .stat b { font-size: 1.1rem; }
}

@media print {
  .top, .tabs, .filters, .no-print, .toast { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
  .main { padding: 0; max-width: none; }
  th { position: static; }
}
