/* התפריט של נעה - בהשראת ה-PDF: קרם חם, טרקוטה, כרטיסים לבנים, ירוק עדין לטיפים.
   ניגודיות (מחושב): טקסט 14:1, משני 5.5:1+, טרקוטה על קרם 5.3:1, לבן על טרקוטה 5.7:1, טיפ 8.5:1.
   בלי letter-spacing בכלל. */

:root {
    --bg: #FBF5EC;
    --card: #FFFFFF;
    --soft: #FAEDE3;
    --border: #EADCCB;
    --control: #9C8674;
    --text: #2A2420;
    --muted: #6B5D52;
    --accent: #A84A1C;
    --accent-press: #8E3D16;
    --track: #F1E6DA;
    --tip-bg: #EDF3EC;
    --tip-text: #2F4B35;
    --ok: #3B6E45;
    --radius: 16px;
    --radius-sm: 12px;
    --tap: 44px;
    --tabbar-h: 64px;
    --font: 'Heebo', 'Assistant', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

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

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

.muted { color: var(--muted); }

/* ---------- page ---------- */

.page {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom));
}

.top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 16px;
}

/* חצים ליד הכותרת: ב-RTL הקודם מימין והבא משמאל */
.day-nav {
    flex: 1 1 240px;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 2px;
}
.day-arrow { flex-shrink: 0; color: var(--accent); }
.day-arrow svg { width: 24px; height: 24px; }
.day-arrow.is-disabled { color: var(--border); }
a.day-arrow:active { background: var(--soft); }

.date {
    margin: 0;
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--accent);
}

.past-banner {
    margin: -4px 0 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--soft);
    color: var(--text);
    font-size: 15px;
}
.past-banner a {
    display: inline-block;
    padding: 6px 0;
    color: var(--accent);
    font-weight: 700;
}

.streak {
    margin: 0;
    flex-shrink: 0;
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
}
.streak-num { font-size: 20px; font-weight: 700; color: var(--accent); }
.streak.is-zero { font-size: 14px; }

.section-title {
    margin: 24px 0 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

/* ---------- card ---------- */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.card-title { margin: 0 0 8px; font-size: 18px; font-weight: 700; color: var(--accent); }

.tip {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--tip-bg);
    color: var(--tip-text);
    font-size: 15px;
}
.tip-small { margin: 10px 0 0; font-size: 14px; }

/* ---------- buttons & fields ---------- */

.btn {
    min-height: var(--tap);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 500;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-press); }
.btn-secondary { background: var(--card); border-color: var(--control); color: var(--text); }
.btn-secondary:active { background: var(--soft); }
.btn-block { width: 100%; margin-top: 16px; }
/* חיווי טעינה רק על הכפתור שנלחץ, ורק אם הבקשה לוקחת יותר מ-400ms. בלי עמעום של כל המסך */
.btn, .segment, .toggle, .option, .slot-btn { transition: opacity .15s; }
[aria-busy="true"] { opacity: .6; transition-delay: .4s; }
.btn[disabled] { opacity: .6; pointer-events: none; }

.field-label { display: block; margin: 12px 0 6px; font-size: 15px; font-weight: 500; }
.field-label:first-child { margin-top: 0; }

input[type="text"] {
    width: 100%;
    min-height: var(--tap);
    padding: 10px 12px;
    border: 1px solid var(--control);
    border-radius: var(--radius-sm);
    background: var(--card);
    font-size: 16px; /* מונע זום אוטומטי ב-iOS */
}

.field-row { display: flex; gap: 8px; }
.field-row input { flex: 1; min-width: 0; }

.icon-btn {
    width: var(--tap); height: var(--tap);
    display: inline-grid; place-items: center;
    border: 0; border-radius: 50%;
    background: transparent; color: var(--muted);
}
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- weigh prompt ---------- */

.weigh { border-color: var(--accent); }

/* ---------- summary ---------- */

.metric + .metric { margin-top: 16px; }
.metric-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.metric-label { font-weight: 500; }
.metric-value { color: var(--muted); font-size: 15px; }
.metric-value strong { color: var(--text); font-size: 20px; font-weight: 700; }
.metric-note { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.metric-note.is-ok { color: var(--ok); font-weight: 500; }

.bar {
    position: relative;
    height: 10px;
    border-radius: 999px;
    background: var(--track);
    overflow: visible;
}
.bar > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
    transition: width .3s ease;
}
.bar-protein.is-in-range > span { background: var(--ok); }
.bar-mark {
    position: absolute;
    top: -3px; bottom: -3px;
    width: 2px;
    background: var(--text);
    border-radius: 1px;
}

.summary-foot { margin: 14px 0 0; padding-top: 10px; border-top: 1px dashed var(--border); color: var(--muted); font-size: 14px; }

/* ---------- slots ---------- */

.slots { display: grid; gap: 10px; }

.slot-btn {
    position: relative;
    width: 100%;
    min-height: 76px;
    display: grid;
    gap: 2px;
    padding: 14px 16px;
    padding-inline-end: 48px;
    text-align: start;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.slot-btn:active { background: var(--soft); }

.slot-label { font-size: 14px; font-weight: 700; color: var(--accent); }
.slot-name { font-size: 17px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
/* "אחר" עם טקסט ארוך: שתי שורות ושלוש נקודות. הטקסט המלא בחלון ובתווית הנגישות */
.kind-other .slot-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}
.slot-meta { font-size: 14px; color: var(--muted); }

.is-empty .slot-btn { border-style: dashed; border-color: var(--control); background: transparent; }
.is-empty .slot-name { color: var(--muted); }

.slot-plus {
    position: absolute;
    inset-inline-end: 14px; top: 50%;
    transform: translateY(-50%);
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--accent); color: #fff;
    font-size: 22px; line-height: 1;
}

.slot-chevron {
    position: absolute;
    inset-inline-end: 18px; top: 50%;
    width: 10px; height: 10px;
    border-left: 2px solid var(--muted);   /* פיזי במכוון: החץ מצביע שמאלה, "קדימה" ב-RTL */
    border-bottom: 2px solid var(--muted);
    transform: translateY(-50%) rotate(45deg);
}

.kind-cheat .slot-btn { background: var(--soft); }

.tag {
    display: inline-block;
    margin-inline-start: 6px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 500;
}
.kind-cheat .tag { background: var(--card); }

/* ---------- toggles ---------- */

.toggle-card { padding: 4px 16px; margin-top: 12px; }
.toggle-card + .toggle-card, .toggle-card + .coffee-card, .coffee-card + .toggle-card { margin-top: 0; }

.toggle {
    width: 100%;
    min-height: 60px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 0;
    border: 0; background: transparent;
    text-align: start;
}
.toggle-text { display: grid; }
.toggle-title { font-size: 17px; font-weight: 500; }
.toggle-sub { font-size: 14px; color: var(--muted); }

.checkbox {
    transition: background-color .2s, border-color .2s;
    flex-shrink: 0;
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border: 2px solid var(--control);
    border-radius: 8px;
    color: transparent;
}
.checkbox svg { width: 20px; height: 20px; }
[aria-checked="true"] .checkbox {
    transition: background-color .2s, border-color .2s; background: var(--accent); border-color: var(--accent); color: #fff; }

.switch {
    flex-shrink: 0;
    position: relative;
    width: 52px; height: 30px;
    border-radius: 999px;
    background: var(--track);
    border: 2px solid var(--control);
    transition: background .2s;
}
.switch-knob {
    position: absolute;
    top: 2px; inset-inline-start: 2px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--card);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    transition: transform .2s; /* transform ולא inset - אחרת כל החלקה נספרת כ-layout shift */
}
[aria-checked="true"] .switch { background: var(--accent); border-color: var(--accent); }
[aria-checked="true"] .switch-knob { transform: translateX(-22px); } /* RTL: מימין לשמאל */

.toggle-card .tip-small { margin-bottom: 12px; }

/* ---------- coffee ---------- */

.coffee-card { margin-top: 0; padding: 14px 16px 12px; }
.coffee-card .toggle-title { display: block; margin: 0 0 10px; }
.coffee-card .toggle-sub { display: block; margin: 8px 0 0; }

.segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 4px;
    border-radius: var(--radius-sm);
    background: var(--track);
}
.segment {
    min-height: var(--tap);
    padding: 6px 4px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    font-size: 15px;
}
.segment[aria-checked="true"] {
    background: var(--accent);
    color: #fff;
    font-weight: 500;
}

/* ---------- notices & toast ---------- */

.notices:empty { display: none; }
.notice {
    display: flex; align-items: flex-start; gap: 8px;
    margin-bottom: 12px;
    padding: 10px 6px 10px 12px;
    padding-inline-start: 14px;
    border-radius: var(--radius-sm);
    background: var(--tip-bg);
    color: var(--tip-text);
}
.notice p { margin: 0; flex: 1; padding-top: 10px; }
.notice .icon-btn { color: var(--tip-text); flex-shrink: 0; }
.notice a { color: var(--tip-text); font-weight: 700; }

.toast {
    position: fixed;
    inset-inline: 16px;
    bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
    max-width: 448px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 48px;
    padding: 4px 16px;
    border-radius: var(--radius-sm);
    background: var(--text);
    color: #fff;
    text-align: center;
    z-index: 30;
    transition: opacity .2s;
}
/* האלמנט נשאר ב-DOM (אזור live) - מוסתר רק ויזואלית */
.toast.is-hidden { opacity: 0; pointer-events: none; }
.toast-action {
    min-height: var(--tap);
    padding: 0 8px;
    border: 0;
    background: transparent;
    color: #fff;
    font-weight: 700;
    text-decoration: underline;
}

/* ---------- bottom sheet ---------- */

.sheet {
    width: 100%;
    max-width: 480px;
    max-height: 88vh;
    max-height: 88dvh; /* iOS: גובה שמתחשב בסרגל ובמקלדת */
    margin: auto auto var(--kb, 0px);
    padding: 0;
    border: 0;
    border-radius: 20px 20px 0 0;
    background: var(--card);
    color: var(--text);
}
.sheet::backdrop { background: rgba(42, 36, 32, .45); }
.sheet[open] { animation: sheet-up .2s ease-out; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .sheet[open] { animation: none; }
    .bar > span, .switch, .switch-knob { transition: none; }
}

.sheet-panel { display: flex; flex-direction: column; max-height: 88vh; max-height: 88dvh; }
/* מקלדת פתוחה (iOS): app.js מודד את השטח הגלוי (visualViewport). החלון יושב מעל המקלדת ולא גבוה ממה שרואים */
.sheet.has-kb, .sheet.has-kb .sheet-panel { max-height: calc(var(--vvh) - 8px); }
.sheet.has-kb .sheet-body { padding-bottom: 16px; }
.sheet.has-kb .options + .sheet-actions { bottom: -16px; padding-bottom: 16px; }
.sheet-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 12px 8px 4px 16px;
    padding-inline-start: 20px;
}
.sheet-title { margin: 0; font-size: 19px; font-weight: 700; color: var(--accent); }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px calc(24px + env(safe-area-inset-bottom)); }

.options { list-style: none; margin: 0; padding: 0; }
.option-row { display: flex; align-items: stretch; border-bottom: 1px dashed var(--border); }
.option {
    flex: 1;
    min-height: 60px;
    display: grid; align-content: center; gap: 2px;
    padding: 10px 0;
    border: 0; background: transparent;
    text-align: start;
}
.option-name { font-size: 16px; font-weight: 500; }
.option-meta { font-size: 14px; color: var(--muted); }
.option-current { display: none; font-size: 13px; font-weight: 700; color: var(--ok); }
.option[aria-current="true"] .option-current { display: block; }
.option-info { width: var(--tap); border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.option-info svg { width: 22px; height: 22px; }

.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
/* ברשימת האופציות "אחר" ו"צ'יט" נשארים גלויים גם כשהרשימה ארוכה */
.options + .sheet-actions {
    position: sticky;
    bottom: calc(-24px - env(safe-area-inset-bottom));
    margin: 0 -20px;
    padding: 12px 20px calc(24px + env(safe-area-inset-bottom));
    background: var(--card);
    border-top: 1px solid var(--border);
}
.sheet-actions .btn-primary { grid-column: 1 / -1; }

.meal-meta { margin: 0 0 12px; color: var(--accent); font-weight: 500; }
.meal-note { margin: 0 0 12px; font-size: 17px; }

.ingredients { list-style: none; margin: 0; padding: 0; }
.ingredients li {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
}
.ing-amount { flex-shrink: 0; color: var(--muted); }

.sub-title { margin: 16px 0 6px; font-size: 15px; font-weight: 700; }
.prep { margin: 0; color: var(--muted); font-size: 15px; }

/* ---------- placeholder ---------- */

.soon { text-align: center; padding: 32px 16px; }
.soon-title { margin: 0 0 4px; font-size: 20px; font-weight: 700; color: var(--accent); }
.soon .muted { margin: 0; }

/* ---------- tab bar ---------- */

.tabbar {
    position: fixed;
    inset-inline: 0; bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--card);
    border-top: 1px solid var(--border);
}
.tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: var(--tap);
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
}
.tab-icon { width: 24px; height: 24px; }
.tab.is-active { color: var(--accent); font-weight: 700; }

.sheet-error { background: var(--soft); color: var(--text); }

/* ---------- שלב 7: כותרות עמוד ---------- */

.page-title { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.3; color: var(--accent); }
.page-intro { margin: -6px 0 14px; font-size: 15px; }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
.btn-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

/* ---------- תזכורת שקילה והודעת התראה במסך היום ---------- */

.weigh-reminder p { margin: 0 0 10px; }
.weigh-reminder .sheet-actions { margin-top: 4px; }
.alert-banner { background: var(--tip-bg); color: var(--tip-text); }
.alert-banner a { color: var(--tip-text); }

/* ---------- מסך המשקל ---------- */

.alerts { display: grid; gap: 10px; margin-bottom: 12px; }
.alert-card {
    padding: 16px;
    border-radius: var(--radius);
    background: var(--tip-bg);
    color: var(--tip-text);
    border: 1px solid #CFE0CC;
}
.alert-title { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.alert-sub { margin: 0 0 12px; font-size: 15px; }

.weigh-current { margin: 0 0 4px; min-height: 3em; } /* שתי שורות שמורות: הטקסט מתחלף אחרי שמירה - בלי קפיצה */
.weigh-form .field-row .btn { min-width: 88px; } /* "שמירה" / "עדכון" - אותו רוחב */
.weigh-confirm { margin-top: 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--soft); }
.weigh-confirm-text { margin: 0 0 4px; }
.weigh-confirm .sheet-actions { margin-top: 8px; }

.chart-box { width: 100%; aspect-ratio: 360 / 220; } /* שומר את המקום לפני שהגרף מצויר - בלי קפיצה */
.chart-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--card); stroke: var(--accent); stroke-width: 2; }
.chart-dot.is-last { fill: var(--accent); }
.chart-goal { stroke: var(--ok); stroke-width: 1.5; stroke-dasharray: 6 5; }
.chart-ref { stroke: var(--border); stroke-width: 1; }
.chart-label { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.chart-label.is-goal { fill: var(--ok); font-weight: 700; }
.chart-value { font-size: 13px; font-weight: 700; fill: var(--text); font-family: var(--font); }
.chart-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.legend-goal, .legend-ref { display: inline-block; width: 22px; height: 0; border-top: 2px dashed var(--ok); }
.legend-ref { border-top: 1px solid var(--control); }
.chart .muted.small { margin: 6px 0 0; }

.data-table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 10px 6px; text-align: start; border-bottom: 1px dashed var(--border); vertical-align: top; }
.data-table thead th { font-size: 13px; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--border); }
.data-table tbody th { font-weight: 700; }
.data-table tr.is-current th, .data-table tr.is-current td { background: var(--soft); }

.plain-list { margin: 0; padding: 0; list-style: none; }
.plain-list li { padding: 6px 0; }

/* ---------- היסטוריה ---------- */

.history-week { margin-bottom: 20px; }
.week-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 6px; font-size: 18px; font-weight: 700; color: var(--accent); }
.week-range { font-size: 15px; font-weight: 500; color: var(--muted); }
.week-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 10px; padding: 0; list-style: none; font-size: 14px; color: var(--muted); }
.week-stats strong { color: var(--text); }

.history-day { padding: 14px 16px; margin-bottom: 8px; }
.history-day.is-empty-day {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px;
    min-height: var(--tap);
    padding: 0 16px; margin-bottom: 6px;
    border: 1px dashed var(--control); border-radius: var(--radius-sm);
}
.history-day.is-empty-day .history-day-title { font-weight: 500; }
.history-day.is-empty-day .history-edit { margin: 0 auto 0 0; } /* RTL: לקצה השמאלי */
.history-day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.history-day-title { margin: 0; font-size: 16px; font-weight: 700; }
.history-day p { margin: 6px 0 0; font-size: 15px; }
.history-meals { margin: 0; padding: 0; list-style: none; }
.history-meals li { display: flex; gap: 10px; padding: 3px 0; }
.history-slot { flex-shrink: 0; width: 52px; font-size: 14px; font-weight: 700; color: var(--accent); }
.history-meal { min-width: 0; overflow-wrap: anywhere; }
.history-extras, .history-totals { color: var(--muted); }
.history-totals strong { color: var(--text); }
.history-edit {
    display: inline-flex; align-items: center;
    min-height: var(--tap);
    margin-top: 4px;
    color: var(--accent); font-weight: 700;
}
.badge { flex-shrink: 0; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; }
.badge.is-plus { background: var(--tip-bg); color: var(--tip-text); }
.badge.is-neutral { background: var(--track); color: var(--text); }
.badge.is-reset { background: var(--soft); color: var(--accent); }
.empty-state { text-align: center; padding: 28px 16px; }
.empty-title { margin: 0 0 4px; font-size: 18px; font-weight: 700; color: var(--accent); }
.empty-state .muted { margin: 0; }
.more-link { margin: 4px 0 0; }

/* ---------- כללים ---------- */

.rules-card { padding: 0; }
.rules-card summary {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 56px;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
}
.rules-card summary::-webkit-details-marker { display: none; } /* iOS: המשולש המובנה פונה לצד הלא נכון ב-RTL */
.rules-title { font-size: 17px; font-weight: 700; color: var(--accent); }
.rules-chevron {
    flex-shrink: 0;
    width: 10px; height: 10px;
    border-left: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(-45deg);
    transition: transform .2s;
}
.rules-card[open] .rules-chevron { transform: rotate(135deg); }
.rules-body { padding: 0 16px 16px; }
.rules-body p { margin: 0 0 10px; }
.rules-list { margin: 0; padding: 0; list-style: none; }
.rules-list li { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.rules-list li:last-child { border-bottom: 0; }
.disclaimer { margin: 16px 4px 0; font-size: 14px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .rules-chevron { transition: none; } }

/* ---------- שלב 7.1: תיקון שקילה ---------- */

.weigh-done { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.weigh-done .weigh-current { margin: 0; min-height: 0; }
.weigh-done .btn { min-width: 88px; }

/* טבלת המשקל: 5 עמודות ברוחב קבוע (colgroup). כל התאים ממורכזים לגובה, כל ערך ממורכז מתחת לכותרת שלו,
   ומספר השבוע והתאריך שלו בלוק אחד. השורה המודגשת עם ריווח שווה משני הצדדים */
.weight-table { table-layout: fixed; border-collapse: separate; border-spacing: 0; } /* separate - כדי שהפינות המעוגלות של השורה המודגשת יוצגו בכל דפדפן */
.weight-table th, .weight-table td { padding: 8px 2px; text-align: center; vertical-align: middle; }
.weight-table tr > :first-child { padding-inline-start: 8px; }
.weight-table tr > :last-child { padding-inline-end: 8px; }
.weight-table .col-week { width: 19%; }
.weight-table .col-act { width: 92px; }
.weight-table .week-cell { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.25; }
.weight-table .row-date { font-size: 12px; font-weight: 400; color: var(--muted); }
.weight-table tr.is-current > :first-child { border-start-start-radius: 10px; border-end-start-radius: 10px; }
.weight-table tr.is-current > :last-child { border-start-end-radius: 10px; border-end-end-radius: 10px; }
.weight-table .no-change { color: var(--muted); }
.row-btn {
    width: 76px;
    min-height: var(--tap);
    padding: 4px 0;
    border: 1px solid var(--control);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    font-size: 14px;
}
.row-btn:active { background: var(--soft); }
.week-form .field-label { margin-top: 4px; }
.week-actions { margin-top: 16px; }
.week-start-note { margin-bottom: 12px; }
/* בזמן שאלת האישור - "שמירה" הרגיל מוסתר, כדי שיהיה ברור מה לוחצים */
.weigh-confirm:not([hidden]) ~ .week-actions { display: none; }

/* ---------- היסטוריה: הנתונים שלך ---------- */

.data-card { margin-top: 20px; }
.data-card p { margin: 0 0 12px; }
.data-card .backup-line { margin: 12px 0 0; }

/* ---------- שלב 8: קיצורי דרך במסך היום ---------- */

/* הרצף ומצב הצ'יט בשורה אחת. בלי גלישה - שינוי טקסט לא משנה את גובה הכותרת */
.top-tags { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.cheat-week { min-width: 0; flex-shrink: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 30px; padding-block: 0; }
.cheat-week.is-free { background: var(--tip-bg); color: var(--tip-text); }
.top-tags .streak { min-height: 30px; align-items: center; padding-block: 0; }

/* כותרת הארוחות + "כמו אתמול": גובה קבוע, כך שהכפתור מופיע ונעלם בלי להזיז את המשבצות */
.slots-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); margin: 24px 0 10px; }
.slots-head .section-title { margin: 0; }
.copy-prev { flex-shrink: 0; }
.chip-btn {
    min-height: var(--tap);
    padding: 0 14px;
    border: 1px solid var(--control);
    border-radius: 999px;
    background: var(--card);
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
}
.chip-btn:active { background: var(--soft); }

/* "אחר": הזנות אחרונות - לחיצה ממלאת את הטופס, בלי לשמור */
.recent-others { display: grid; gap: 8px; margin-bottom: 4px; }
.recent-others .field-label { margin: 0; }
.recent-other {
    display: flex; align-items: center; min-height: var(--tap); min-width: 0;
    padding: 8px 12px;
    border: 1px dashed var(--control);
    border-radius: var(--radius-sm);
    background: var(--card);
    text-align: start;
    font-size: 15px;
}
.recent-other:active { background: var(--soft); }
.recent-other-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-other-meta { flex-shrink: 0; white-space: pre; color: var(--muted); }

/* מסכים צרים (iPhone SE עם Display Zoom, 320) */
.slots-head .section-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 359px) {
    /* התגיות בשתי שורות, עם גובה שמור לשתיהן - שינוי טקסט לא מזיז את המסך */
    .top-tags { flex-wrap: wrap; min-height: 68px; align-content: flex-start; }
    .cheat-week { overflow: visible; }
    .slots-head .section-title { font-size: 16px; }
    .chip-btn { padding: 0 10px; font-size: 14px; }
    .weight-table { font-size: 14px; }
    .weight-table thead th { font-size: 12px; }
    .weight-table .col-week { width: 14%; }
    .weight-table .col-act { width: 64px; }
    .weight-table tr > :first-child { padding-inline-start: 4px; }
    .weight-table tr > :last-child { padding-inline-end: 4px; }
    .row-btn { width: 58px; font-size: 13px; }
}
