/* Кухня — расписание блюд и дежурств. Мобильный-first. */

:root {
    --bg:        #f5f4ee;
    --surface:   #ffffff;
    --surface-2: #efeee7;
    --ink:       #22241f;
    --muted:     #6c7066;
    --line:      #e0dfd6;
    --accent:    #46765a;
    --accent-in: #ffffff;
    --cook-a:    #3d5a86;   /* первый дежурный */
    --cook-a-bg: #e4eaf4;
    --cook-b:    #9c6a2f;   /* второй дежурный */
    --cook-b-bg: #f5e9d8;
    --done:      #8b9187;
    --danger:    #a6423a;
    --radius:    12px;
    --shadow:    0 1px 2px rgba(34, 36, 31, .06);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:        #16181a;
        --surface:   #1e2124;
        --surface-2: #262a2e;
        --ink:       #e7e5df;
        --muted:     #979c93;
        --line:      #2f3438;
        --accent:    #7cae8c;
        --accent-in: #12211a;
        --cook-a:    #8fa9d8;
        --cook-a-bg: #232c3a;
        --cook-b:    #d2a267;
        --cook-b-bg: #322718;
        --done:      #6d736a;
        --danger:    #d98078;
        --shadow:    0 1px 2px rgba(0, 0, 0, .3);
    }
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-text-size-adjust: 100%;
}

a { color: inherit; }

h1, h2, h3 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 600;
    text-wrap: balance;
    margin: 0;
}

/* ---------------------------------------------------------- шапка и табы */

.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-family: Georgia, serif;
    font-size: 19px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: -.01em;
}

.brand-dot { color: var(--accent); }

.nav-desktop { display: none; }

.whoami {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.linkbtn {
    background: none;
    border: 0;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    padding: 4px;
}

.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 10;
}

.tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 9px 0 7px;
    font-size: 11px;
    text-decoration: none;
    color: var(--muted);
}

.tabbar a.on { color: var(--accent); }
.tab-ico { font-size: 19px; line-height: 1; }

.wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 16px 96px;
}

/* -------------------------------------------------------------- типовые */

.page-head { margin-bottom: 18px; }
.page-title { font-size: 25px; }
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

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

.alert {
    background: var(--surface);
    border-left: 3px solid var(--danger);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 0 var(--radius) var(--radius) 0;
}

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

.btn {
    display: inline-block;
    font: inherit;
    font-size: 14px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-in);
    font-weight: 600;
}

.btn-ghost { background: transparent; }
.btn-wide { width: 100%; padding: 12px; }

.btn:focus-visible,
a:focus-visible,
input:focus-visible,
.shop-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.inline { display: inline; }

.chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.chip-a { background: var(--cook-a-bg); color: var(--cook-a); }
.chip-b { background: var(--cook-b-bg); color: var(--cook-b); }
.chip-sm { font-size: 11px; padding: 2px 8px; }

.badge {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
}

.badge-cook   { background: var(--accent); color: var(--accent-in); }
.badge-reheat { background: var(--surface-2); color: var(--muted); }

/* ------------------------------------------------------------- «Сегодня» */

.day-block { margin-bottom: 28px; }

.day-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 12px;
}

.day-title { font-size: 27px; }
.day-title-sm { font-size: 19px; }
.day-date { margin: 0; color: var(--muted); font-size: 14px; }

.meals {
    display: grid;
    gap: 12px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

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

.meal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.meal-label {
    margin: 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    font-weight: 600;
}

.meal-dish { font-size: 21px; line-height: 1.25; }
.meal-dish a { text-decoration: none; }
.meal-dish a:hover { text-decoration: underline; }

.meal-sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.meal.is-done .meal-dish { color: var(--done); text-decoration: line-through; }

.facts {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin: 14px 0 0;
}

.facts div { display: flex; flex-direction: column; }

.facts dt {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
}

.facts dd {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.meal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.next-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.next-row {
    display: grid;
    grid-template-columns: 52px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
}

/* Плашка «чей сегодня день» — главное, что читается на первом экране. */
.duty {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.duty-what { font-size: 13px; color: var(--muted); }

.day-head .chip { margin-left: auto; }

.next-row + .next-row { border-top: 1px solid var(--line); }

.next-meal {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    font-weight: 600;
}

.next-dish { text-decoration: none; font-weight: 500; }
.next-dish:hover { text-decoration: underline; }
.next-cook { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------------ план */

.tally {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.tally-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.tally-num {
    font-size: 26px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.tally-cap { font-size: 11px; color: var(--muted); }

.plan {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.plan-day {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
}

.plan-day.is-today {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.plan-day.is-past { opacity: .5; }

.plan-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    border-right: 1px solid var(--line);
    padding-right: 8px;
}

.plan-dow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
}

.plan-num {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.plan-now {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--accent);
    font-weight: 700;
}

.plan-meals { display: grid; gap: 6px; min-width: 0; }

.plan-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.plan-meal {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    width: 38px;
    flex: none;
}

.plan-dish {
    text-decoration: none;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-dish:hover { text-decoration: underline; }
.plan-slot.is-done .plan-dish { color: var(--done); text-decoration: line-through; }

.tagline {
    font-size: 11px;
    color: var(--muted);
    flex: none;
}

/* Дежурный стоит один раз на весь день, а не в каждой строке. */
.plan-owner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 6px;
    margin-bottom: 2px;
    border-bottom: 1px dashed var(--line);
}

.plan-slot .peek { margin-left: auto; }

/* ---------------------------------------------------------------- рецепт */

.back {
    display: inline-block;
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
    margin-bottom: 12px;
}

.dish-title { font-size: 27px; }
.dish-sub { margin: 6px 0 0; color: var(--muted); }

.facts-wide {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: 16px 0;
    gap: 22px;
}

.dish-note {
    border-left: 3px solid var(--accent);
    padding: 2px 0 2px 14px;
    color: var(--muted);
    font-size: 15px;
}

.dish-when { font-size: 13px; color: var(--muted); }

.block { margin-top: 26px; }

.block-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    font-family: system-ui, sans-serif;
    font-weight: 700;
    margin-bottom: 10px;
}

.ings {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.ings li { padding: 10px 14px; }
.ings li + li { border-top: 1px solid var(--line); }

.steps {
    margin: 0;
    padding-left: 22px;
    display: grid;
    gap: 12px;
}

.steps li { padding-left: 4px; }

.dish-link { margin-top: 26px; }

/* -------------------------------------------------------------- покупки */

/* Переключатель походов в магазин. На узком экране прокручивается вбок,
   поэтому длинный список закупок не ломает страницу. */
.trips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 14px;
    -webkit-overflow-scrolling: touch;
}

.trip {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    text-decoration: none;
    min-width: 92px;
}

.trip-date { font-size: 13px; font-weight: 600; white-space: nowrap; }

.trip-count {
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.trip.on {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.trip.is-done .trip-date { color: var(--done); text-decoration: line-through; }

.shop-left {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--muted);
}

.shop-add {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.shop-add input[type="text"] {
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: 15px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
}

.aisle { margin-bottom: 20px; }

.aisle-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    font-family: system-ui, sans-serif;
    font-weight: 700;
    margin-bottom: 8px;
}

.shop-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.shop-item + .shop-item { border-top: 1px solid var(--line); }

.shop-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: none;
    border: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.tick {
    flex: none;
    width: 22px;
    height: 22px;
    border: 1.5px solid var(--line);
    border-radius: 6px;
    display: grid;
    place-items: center;
    font-size: 14px;
    color: var(--accent-in);
}

.shop-item.is-checked .tick {
    background: var(--accent);
    border-color: var(--accent);
}

.shop-item.is-checked .shop-title {
    color: var(--done);
    text-decoration: line-through;
}

.shop-clear { margin-top: 12px; }

/* ------------------------------------------------------------------ вход */

.is-guest { display: grid; place-items: center; min-height: 100dvh; }

.login {
    width: min(360px, calc(100vw - 32px));
    text-align: center;
    padding: 24px 0;
}

.login-title { font-size: 32px; }
.login-sub { color: var(--muted); font-size: 14px; margin: 6px 0 24px; }

.login-form { display: grid; gap: 16px; text-align: left; }

.whopick {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 14px 14px;
    margin: 0;
    background: var(--surface);
}

.whopick legend {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    padding: 0 6px;
}

.whopick-opt {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 16px;
    cursor: pointer;
}

.field { display: grid; gap: 6px; }

.field-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
}

.field input {
    font: inherit;
    font-size: 16px;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
}

/* --------------------------------------------- кнопка «глянуть фото» */

/* Название блюда и кнопка рецепта стоят в одной строке: название тянется,
   кнопка прижата вправо и не сжимается. */
.dish-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.peek {
    flex: none;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 999px;
    padding: 3px 10px;
    white-space: nowrap;
    line-height: 1.4;
}

.peek:hover { background: var(--accent); color: var(--accent-in); }

.plan-slot .peek {
    font-size: 11px;
    padding: 1px 7px;
    border-color: var(--line);
    color: var(--muted);
}

.plan-slot .peek:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-in); }

.badge-salad { background: var(--cook-b-bg); color: var(--cook-b); }

.salad-slot { margin-top: 12px; }

.tally-extra { font-size: 11px; color: var(--muted); }

/* ------------------------------------------------------------- оценки */

.stars {
    color: var(--accent);
    letter-spacing: .08em;
    font-size: 14px;
}

.rate-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 0;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.reviews {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    display: grid;
    gap: 10px;
}

.review {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
}

.review-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.review-text {
    margin: 8px 0 0;
    font-size: 14px;
    color: var(--muted);
}

.rate-form {
    display: grid;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
}

.starpick {
    border: 0;
    padding: 0;
    margin: 0;
}

.starpick legend {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    padding: 0;
    margin-bottom: 8px;
}

.starpick-row {
    display: flex;
    gap: 8px;
}

/* Цифра-кнопка: сам радио скрыт, кликается вся плашка. */
.starpick-opt {
    flex: 1;
    cursor: pointer;
}

.starpick-opt input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.starpick-opt span {
    display: block;
    text-align: center;
    padding: 10px 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.starpick-opt input:checked + span {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-in);
}

.starpick-opt input:focus-visible + span {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.rate-form textarea {
    font: inherit;
    font-size: 15px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--ink);
    resize: vertical;
    width: 100%;
}

.rate-form .btn { justify-self: start; }

/* ------------------------------------------------------------- десктоп */

@media (min-width: 700px) {
    .nav-desktop {
        display: flex;
        gap: 20px;
        margin-left: 20px;
        font-size: 14px;
    }

    .nav-desktop a {
        text-decoration: none;
        color: var(--muted);
        padding: 4px 0;
        border-bottom: 2px solid transparent;
    }

    .nav-desktop a.on {
        color: var(--ink);
        border-bottom-color: var(--accent);
    }

    .tabbar { display: none; }
    .wrap { padding-bottom: 48px; }
    .meals { grid-template-columns: 1fr 1fr; }
}

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