/* Food tracker: Custom Foods, Custom Recipes and Custom Meals (FoodLibrary, CustomFoodEditor, CompositeFoodEditor).
   One sheet for the three pages instead of a scoped copy each; everything sits under .ff. The cream page, white
   cards and teal/orange accents match the Diary and Targets pages. */
.ff { --ff-teal: #1F5C5C; --ff-orange: #F26B3A; --ff-line: #E4E7EF; padding: 1rem; background: #FDF9F3; min-height: 100%; }
.ff-loading { text-align: center; padding: 2rem; color: #8a8f99; }
.ff-top { display: flex; align-items: center; gap: .7rem; margin-bottom: 1rem; flex-wrap: wrap; }
.ff-titles { flex: 1; min-width: 12rem; }
.ff-h1 { font-size: 1.3rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; margin: 0; flex: 1; }
.ff-sub { font-size: .82rem; color: #6b7079; margin-top: .15rem; }
.ff-btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid #cfd4dc; background: #fff; color: #333; border-radius: 8px;
    padding: .4rem .9rem; font-weight: 700; font-size: .85rem; text-decoration: none; white-space: nowrap; }
.ff-btn:hover { border-color: var(--ff-teal); color: var(--ff-teal); }
.ff-btn.primary { background: var(--ff-teal); border-color: var(--ff-teal); color: #fff; }
.ff-btn.primary:hover { background: #174848; color: #fff; }
.ff-btn.accent { background: var(--ff-orange); border-color: var(--ff-orange); color: #fff; text-transform: uppercase; letter-spacing: .04em; font-size: .78rem; }
.ff-btn:disabled { opacity: .55; }
.ff-star { border: 0; background: none; font-size: 1.4rem; color: #b5b9c2; }
.ff-star.on { color: #F2B705; }

.ff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ff-wide { grid-column: 1 / -1; }
@media (max-width: 860px) { .ff-grid { grid-template-columns: 1fr; } }
.ff-card { background: #fff; border-radius: 12px; padding: 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.05); min-width: 0; }
.ff-card h2 { font-size: .95rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; margin: 0 0 .8rem; display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.ff-h3 { font-size: .8rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #555; margin: 1rem 0 .4rem; display: flex; align-items: center; gap: .4rem; }
.ff-hint { font-size: .8rem; color: #6b7079; font-weight: 400; text-transform: none; letter-spacing: 0; margin-top: .3rem; }
.ff-empty { text-align: center; color: #8a8f99; padding: 1.4rem .5rem; }

.ff-row { display: grid; grid-template-columns: 9.5rem 1fr; align-items: center; gap: .6rem; margin-bottom: .55rem; }
.ff-row > label { font-weight: 600; color: #555; font-size: .9rem; }
.ff-input { width: 100%; padding: .35rem .5rem; border: 1px solid #cfd4dc; border-radius: 8px; font-size: .9rem; background: #fff; }
.ff-input:focus { outline: 2px solid rgba(31,92,92,.25); border-color: var(--ff-teal); }
.ff-input.num { text-align: right; }
.ff-short { max-width: 7rem; }
.ff-inline { display: inline-flex; align-items: center; gap: .45rem; }
.ff-notes { resize: vertical; min-height: 4rem; }
.ff-check { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: #555; }
.ff-check input { accent-color: var(--ff-orange); }
.ff-retired-toggle { margin-top: .8rem; }

.ff-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.ff-table th { background: var(--ff-line); text-align: left; padding: .45rem .6rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #444; }
.ff-table td { padding: .45rem .6rem; border-top: 1px solid #f1f2f5; vertical-align: middle; }
.ff-table tbody tr { cursor: pointer; }
.ff-table tbody tr:hover { background: #F4FAFA; }
.ff-table.ff-items tbody tr { cursor: default; }
.ff-table .num { text-align: right; white-space: nowrap; }
.ff-table tr.retired td { color: #9aa0aa; }
.ff-tag { display: inline-block; margin-left: .5rem; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
    color: #8a8f99; border: 1px solid #cfd4dc; border-radius: 999px; padding: .05rem .45rem; }
.ff-amt { width: 5rem; display: inline-block; }
.ff-items select.ff-input { max-width: 14rem; }
.ff-items-head { display: flex; align-items: center; gap: .8rem; margin: 1rem 0 .5rem; }
.ff-items-head h2 { flex: 1; margin: 0; }

.ff-mini { width: 100%; border-collapse: collapse; font-size: .88rem; }
.ff-mini th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #6b7079; padding: .25rem .35rem; }
.ff-mini td { padding: .2rem .35rem; }
.ff-mini td:first-child { width: 1.6rem; color: #8a8f99; }
.ff-mini td:nth-child(3) { width: 6.5rem; }
.ff-plus { border: 0; background: none; color: #3BB273; font-size: 1.05rem; padding: 0; }
.ff-x { border: 0; background: none; color: #8a8f99; font-size: 1rem; padding: .1rem .3rem; }
.ff-x:hover { color: #C62828; }

.ff-menu-wrap { position: relative; }
.ff-menu-btn { border: 0; background: none; font-size: 1.2rem; letter-spacing: .1em; color: #555; padding: .2rem .5rem; }
.ff-menu { position: absolute; right: 0; top: 100%; z-index: 20; background: #fff; border: 1px solid var(--ff-line); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: .3rem; min-width: 12rem; display: flex; flex-direction: column; }
.ff-menu button { border: 0; background: none; text-align: left; padding: .45rem .7rem; border-radius: 6px; font-size: .88rem; }
.ff-menu button:hover { background: #F4FAFA; }
.ff-menu button.danger { color: #C62828; }

.ff-error { background: #FDECEA; color: #8E1F1F; border-radius: 8px; padding: .55rem .8rem; margin-bottom: .8rem; font-weight: 600; }
.ff-notice { background: #E8F5EE; color: #1E6B43; border-radius: 8px; padding: .55rem .8rem; margin-bottom: .8rem; font-weight: 600; }
.ff-confirm { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; background: #FFF4E5; border-radius: 8px; padding: .55rem .8rem; margin-bottom: .8rem; }
.ff-confirm span { flex: 1; }
.ff-confirm button { border: 1px solid #cfd4dc; background: #fff; border-radius: 8px; padding: .3rem .8rem; font-weight: 700; }
.ff-confirm button.danger { background: #C62828; border-color: #C62828; color: #fff; }

.ff-tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 2px solid var(--ff-line); margin-bottom: .6rem; }
.ff-tabs button { border: 0; background: none; padding: .4rem .8rem; font-weight: 600; color: #555; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.ff-tabs button.on { color: var(--ff-orange); border-bottom-color: var(--ff-orange); }
.ff-ntable { width: 100%; max-width: 34rem; border-collapse: collapse; font-size: .9rem; }
.ff-ntable td { padding: .2rem .5rem; border-top: 1px solid #f1f2f5; }
.ff-ntable td.num { width: 7rem; }
.ff-ntable td.unit { width: 3rem; color: #6b7079; }
.ff-ntable .nf-input { width: 6.5rem; }
.ff-computed { display: inline-block; width: 6.5rem; text-align: right; color: #6b7079; padding-right: .45rem; }

.ff-seg { justify-self: start; display: inline-flex; border: 1px solid #cfd4dc; border-radius: 999px; overflow: hidden; text-transform: none; letter-spacing: 0; }
.ff-seg button { border: 0; background: #fff; padding: .25rem .8rem; font-weight: 600; font-size: .8rem; color: #555; }
.ff-seg button.on { background: var(--ff-teal); color: #fff; }
.ff-summary { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.ff-legend { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.ff-legend li { padding: .15rem 0 .15rem 1.1rem; position: relative; }
.ff-legend li::before { content: ""; position: absolute; left: 0; top: .5rem; width: .65rem; height: .65rem; border-radius: 50%; background: #cfd4dc; }
.ff-legend li.p::before { background: #3BB273; }
.ff-legend li.c::before { background: #1FB5D6; }
.ff-legend li.f::before { background: #8E5BD8; }

/* The Nutrition Facts label (US 2016 style), with the numbers editable in place. */
.ff-basis { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.ff-basis label { font-weight: 600; color: #555; font-size: .9rem; white-space: nowrap; }
.ff-basis select { max-width: 16rem; }
.nf { border: 2px solid #111; padding: .35rem .55rem .5rem; max-width: 22rem; font-family: Helvetica, Arial, sans-serif; color: #111; }
.nf-title { font-size: 2rem; font-weight: 900; line-height: 1; letter-spacing: -.02em; }
.nf-serving { display: flex; justify-content: space-between; font-weight: 800; font-size: .95rem; margin-top: .3rem; }
.nf-rule { background: #111; margin: .25rem 0; }
.nf-rule.thick { height: 10px; }
.nf-rule.mid { height: 5px; }
.nf-amount { font-size: .78rem; font-weight: 800; }
.nf-cal { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.6rem; font-weight: 900; }
.nf-line { display: grid; grid-template-columns: 1fr 5.2rem 2.2rem; align-items: center; gap: .3rem; border-top: 1px solid #111; padding: .12rem 0; font-size: .9rem; }
.nf-line.b span:first-child { font-weight: 800; }
.nf-line.i1 span:first-child { padding-left: 1rem; }
.nf-line.i2 span:first-child { padding-left: 2rem; }
.nf-unit { font-size: .8rem; color: #444; }
.nf-input { width: 100%; padding: .1rem .35rem; border: 1px solid #cfd4dc; border-radius: 5px; text-align: right; font-size: .88rem; background: #fff; }
.nf-input.nf-big { width: 6rem; font-size: 1.3rem; font-weight: 800; }

/* Fasting, Repeat Items and Macro Scheduler (FoodFasting, FoodRepeatItems, FoodScheduler). */
.ff-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.ff-btn.danger { color: #C62828; border-color: #f0c4c4; }
.ff-btn.danger:hover { background: #C62828; color: #fff; }
.fst-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.fst-stats div { display: flex; flex-direction: column; }
.fst-stats b { font-size: 1.5rem; font-weight: 800; color: var(--ff-teal); }
.fst-stats span { font-size: .8rem; color: #6b7079; }
.ri-time { width: 7.5rem; }
.ri-days { display: inline-flex; gap: .15rem; }
.ri-days button { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 1px solid #cfd4dc; background: #fff; font-size: .72rem; font-weight: 700; color: #6b7079; padding: 0; }
.ri-days button.on { background: var(--ff-teal); border-color: var(--ff-teal); color: #fff; }
.ri-on { accent-color: var(--ff-orange); }
.ms-editing td { background: #F4FAFA; }
.ms-bad { color: #C62828; font-weight: 700; }

/* Trends (FoodTrends). */
.tr-controls { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: flex-end; margin-bottom: 1rem; }
.tr-controls > label { display: flex; flex-direction: column; gap: .2rem; font-size: .75rem; font-weight: 700; color: #555; text-transform: uppercase; letter-spacing: .04em; }
.tr-controls > label.ff-check { flex-direction: row; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: .85rem; padding-bottom: .4rem; }
.tr-controls select, .tr-controls input[type=date] { min-width: 10rem; }
.tr-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-top: .8rem; }
.tr-stats div { display: flex; flex-direction: column; }
.tr-stats b { font-size: 1.3rem; font-weight: 800; color: var(--ff-teal); }
.tr-stats span { font-size: .78rem; color: #6b7079; }
.tr-report { margin-top: 1rem; }
.tr-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .tr-tables { grid-template-columns: 1fr; } }
.tr-table { max-width: none; }
.tr-table th { background: var(--ff-line); text-align: left; padding: .35rem .5rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.tr-table td.num { width: 7.5rem; text-align: right; white-space: nowrap; }
.tr-table td.bar { width: 40%; }
