:root {
    /* Tündérország bölcsőde színpaletta */
    --primary: #03a9f4;
    --primary-dark: #026e9f;
    --primary-soft: #a6dcf4;
    --accent: #f79007;
    --accent-soft: #f7d7ac;
    --green: #00bf87;
    --green-dark: #009e70;
    --purple: #6632ff;
    --dark: #17252a;
    --bg: #f2f9fd;
    --card: #ffffff;
    --text: #17252a;
    --muted: #5f757e;
    --border: #d9ecf7;
    --head: #e7f6fe;
    --today: #fff3e0;
    --holiday: #fde3e3;
    --holiday-head: #f9cccc;
    --holiday-text: #8a2a2a;
    --workday: #e3f2fd;
    --workday-head: #cfe8fb;
    --workday-text: #1d5f8a;
    --danger: #e5484d;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { color: var(--primary-dark); }

main { flex: 1; padding: 24px 0 32px; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

h1 { margin: 0 0 4px; font-size: 1.7rem; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Fejléc */
.site-header { background: linear-gradient(90deg, #03a9f4, #026e9f); color: #fff; }
.header-inner { display: flex; align-items: center; gap: 20px; padding-top: 10px; padding-bottom: 10px; }
.header-top { display: flex; align-items: center; min-width: 0; }
.brand { display: block; line-height: 0; }
.brand-logo { display: block; height: 44px; width: auto; }
.nav-bar { margin-left: auto; display: flex; align-items: center; min-width: 0; }
.main-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.main-nav a { color: #fff; text-decoration: none; opacity: .92; padding: 4px 2px; border-bottom: 2px solid transparent; }
.main-nav a:hover { opacity: 1; border-bottom-color: #fff; }

/* Láblec */
.site-footer { background: var(--dark); color: #b6c7cd; font-size: .9rem; padding: 14px 0; }
.site-footer a { color: #54c2f4; }
.footer-inner { display: flex; align-items: center; justify-content: flex-end; gap: 16px; flex-wrap: wrap; }
.footer-logo { height: 18px; width: auto; opacity: .75; }
.footer-note {
    flex-basis: 100%;
    margin: 6px 0 0;
    font-size: .8rem;
    color: #8fa6ae;
    text-align: right;
}

/* Heti nézet */
.page-head { margin-bottom: 16px; }
.period { font-size: 1.1rem; margin: 0 0 4px; font-weight: 600; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }

table.menu { border-collapse: collapse; width: 100%; min-width: 900px; }
table.menu th, table.menu td {
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 10px;
    vertical-align: top;
    text-align: left;
}
table.menu thead th { background: var(--head); text-align: center; font-weight: 600; }
table.menu thead th small { display: block; font-weight: 400; color: var(--muted); }
table.menu .meal-col { width: 110px; background: var(--head); font-weight: 600; }
table.menu .today { background: var(--today); }
table.menu thead th.today { background: #ffe0b8; color: #9a5b00; }

/* Naptári típusok: ünnep/szünet (pasztel piros), ledolgozós szombat (halványkék) */
table.menu .cal-holiday { background: var(--holiday); }
table.menu thead th.cal-holiday { background: var(--holiday-head); color: var(--holiday-text); }
table.menu .cal-workday { background: var(--workday); }
table.menu thead th.cal-workday { background: var(--workday-head); color: var(--workday-text); }
.cal-name { display: block; font-size: .75rem; font-weight: 600; }
.cal-note { margin: 2px 0 0; font-weight: 600; }
.day-view.cal-holiday, .day-view.cal-workday { padding: 12px 16px; border-radius: 14px; }
.day-view.cal-holiday { background: var(--holiday); }
.day-view.cal-workday { background: var(--workday); }
.day-view.cal-holiday .cal-note { color: var(--holiday-text); }
.day-view.cal-workday .cal-note { color: var(--workday-text); }

.dishes { list-style: none; margin: 0; padding: 0; }
.dishes li { margin-bottom: 4px; }
.dishes a { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--muted); }
.dishes a:hover { color: var(--primary-dark); }
.allergen { color: var(--muted); font-size: .7em; margin-left: 2px; cursor: help; }

.nutrition { margin-top: 8px; font-size: .8rem; color: var(--muted); }
.nutrition summary { cursor: pointer; }
.nutrition dl { display: grid; grid-template-columns: auto auto; gap: 2px 10px; margin: 6px 0 0; }
.nutrition dt { color: var(--muted); }
.nutrition dd { margin: 0; }
.nutrition-inline { display: block; font-size: .8rem; margin-top: 2px; }

/* Heti lapozás */
.week-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.week-nav-top { display: none; }
.week-label { font-weight: 600; color: var(--primary-dark); font-size: .95rem; }
.today-tag {
    display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
    background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; vertical-align: middle;
}

/* Napi nézet: egy nap étkezései kártyánként */
.day-detail { display: grid; gap: 12px; }
.meal-detail { margin: 0; }
.meal-detail h2 { margin: 0 0 8px; color: var(--primary-dark); }
.meal-detail .dishes li { margin-bottom: 6px; }

.btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, #03a9f4, #026e9f);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: .95rem;
}
.btn:hover { filter: brightness(1.08); }
.btn-outline { background: transparent; color: var(--primary-dark); border: 2px solid var(--primary); }
.btn-green { background: linear-gradient(135deg, #00bf87, #009e70); }
.btn-red { color: var(--danger); border-color: var(--danger); }
.btn-small { padding: 6px 12px; font-size: .85rem; }

.empty {
    background: var(--card);
    border: 1px dashed var(--primary-soft);
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    color: var(--muted);
}

.source { color: var(--muted); font-size: .8rem; margin-top: 8px; }
.legend { margin-top: 24px; color: var(--muted); }
.legend ul { columns: 2; list-style: none; padding-left: 0; }

/* Statisztika / listák */
table.list { background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
table.list th { background: var(--head); }
table.list .num { text-align: right; font-variant-numeric: tabular-nums; }
tr.planned td { color: var(--muted); }

.search { display: flex; gap: 8px; margin: 12px 0 16px; }
.search input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; }
.search button { padding: 10px 16px; border: 0; border-radius: 8px; background: linear-gradient(135deg, #03a9f4, #026e9f); color: #fff; font-weight: 600; cursor: pointer; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 16px 0 24px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.card .label { display: block; color: var(--muted); font-size: .85rem; }
.card strong { font-size: 1.1rem; }

/* Üzenetek */
.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: .95rem; }
.alert-error { background: #fdecec; color: #a02a2e; border: 1px solid #f5c2c4; }
.alert-info { background: var(--head); color: var(--primary-dark); border: 1px solid var(--primary-soft); }

/* Admin */
section.card { margin-bottom: 16px; }

.login-wrap { max-width: 420px; margin: 32px auto; padding: 24px; }

.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row label { font-weight: 600; font-size: .9rem; }
.form-row input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background: #fff;
}
.form-row input:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }

.upload-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.upload-form input[type="file"] { font-size: .95rem; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge-pending { background: var(--accent-soft); color: #8a5200; }
.badge-ok { background: #d2f5e9; color: var(--green-dark); }

.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.preview-day { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.preview-day h3 {
    margin: 0; padding: 8px 12px; background: var(--head);
    font-size: .95rem; display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
}
.preview-day h3 small { color: var(--muted); font-weight: 400; }
.preview-day .meal-block { padding: 8px 12px; border-top: 1px dashed var(--border); }

.meal-block h4 {
    margin: 0 0 4px; font-size: .78rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--primary-dark);
}

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.actions form { margin: 0; }

.row-actions form { display: inline-block; margin: 0 6px 4px 0; }

.admin-bottom { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
.admin-bottom .card { margin-bottom: 0; }

/* Mobil napkártyák (a táblázatot a media query rejti el) */
.day-cards { display: none; }

@media (max-width: 860px) {
    main { padding-top: 12px; }
    h1 { font-size: 1.4rem; }

    /* Fejléc: a logó és a menüsor külön sorban, a fejléc mindig a képernyő tetején marad */
    .site-header { position: sticky; top: 0; z-index: 50; }
    .header-inner {
        height: 82px;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding-top: 4px;
        padding-bottom: 4px;
        overflow: hidden;
    }
    .header-top { height: 36px; }
    .brand-logo { height: 34px; }
    .nav-bar {
        margin-left: 0;
        height: 36px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .nav-bar::-webkit-scrollbar { display: none; }
    .main-nav { gap: 14px; flex-wrap: nowrap; white-space: nowrap; }

    /* Lapozó gombok mobilon csak nyilak, szöveg nélkül – kisebbek, könnyebben eltalálhatók */
    .btn-nav { padding: 8px 14px; font-size: 1.1rem; }
    .btn-nav .btn-label { display: none; }

    /* Napi/heti navigáció a fejléc alatt, ragadós (sticky) */
    .week-nav-top {
        display: flex;
        position: sticky;
        top: 82px;
        z-index: 30;
        background: var(--bg);
        padding: 10px 0 8px;
        margin: 0 0 4px;
        box-shadow: 0 8px 14px -12px rgba(23, 37, 42, .5);
    }
    .week-nav-bottom { display: none; }

    /* Asztali táblázat helyett napkártyák */
    .table-wrap { display: none; }
    .day-cards { display: grid; gap: 12px; }

    .day-card {
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: 14px;
        overflow: hidden;
    }
    .day-card h3 {
        margin: 0;
        padding: 10px 14px;
        background: var(--head);
        font-size: 1rem;
        display: flex;
        align-items: baseline;
        gap: 8px;
    }
    .day-card h3 small { color: var(--muted); font-weight: 400; }
    .day-card.today h3 { background: #ffe0b8; color: #9a5b00; }
    .day-card.cal-holiday { background: var(--holiday); }
    .day-card.cal-holiday h3 { background: var(--holiday-head); color: var(--holiday-text); }
    .day-card.cal-workday { background: var(--workday); }
    .day-card.cal-workday h3 { background: var(--workday-head); color: var(--workday-text); }

    /* A nap tartalma nem külön görgethető: az egész oldal görgetése viszi (könnyebben eltalálható) */
    .day-body { padding: 4px 14px 10px; }
    .day-body .meal-block { padding: 10px 0; border-top: 1px dashed var(--border); }
    .day-body .meal-block:first-child { border-top: none; }

    .legend ul { columns: 1; }

    /* A listák vízszintesen görgethetők a lapon belül */
    table.list { display: block; overflow-x: auto; }

    .admin-bottom { grid-template-columns: 1fr; }
    .preview-grid { grid-template-columns: 1fr; }
    .upload-form { flex-direction: column; align-items: stretch; }
}
