/* ==========================================================================
   School meals portal + cafe summary.
   Calmer variant of the street style (see skill §9): straight cards, no
   decorative motion, big tap targets, clear states, clean print view.
   Loaded after css/street.css.
   ========================================================================== */

/* ---------- Layout ---------- */
.portal { padding-top: 1.5rem; padding-bottom: 2rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
#view-app { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
#view-app[hidden] { display: none; }
.portal-card {
  background: var(--paper);
  border: var(--outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  padding: 1.5rem;
}
.portal-card.narrow { max-width: 560px; width: 100%; justify-self: center; }
.portal-card h1, .portal-card h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.portal-card h3 { font-size: 1.4rem; }
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; font-weight: 700; }
.toolbar-actions { display: flex; gap: .75rem; align-items: center; }
.muted { color: var(--crust-soft); }
.small { font-size: .9rem; }
.empty { color: var(--crust-soft); font-weight: 700; }
.banner {
  background: #e2f3d6; border: var(--outline); border-radius: var(--radius); padding: 1rem 1.25rem;
  font-weight: 800; margin: 0;
}

/* ---------- Week banner ---------- */
.week-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  background: var(--mustard); border: var(--outline); border-radius: var(--radius); box-shadow: var(--shadow-hard);
  padding: 1rem 1.25rem;
}
.week-banner p { margin: 0; }
.week-title { font-size: 1.15rem; }
.cutoff-pill { background: var(--paper); border: var(--outline); border-radius: 999px; padding: .3rem .9rem; font-weight: 800; }
.cutoff-pill span { color: var(--ketchup-dark); }

/* ---------- Small buttons ---------- */
.btn-small {
  font: inherit; font-weight: 800; cursor: pointer;
  min-height: 44px; padding: .45rem 1rem;
  background: var(--paper); color: var(--crust);
  border: var(--outline); border-radius: 999px; box-shadow: 3px 3px 0 var(--crust);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn-small:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--crust); }
.btn-small:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--crust); }
.btn[disabled], .btn-small[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: 2px 2px 0 var(--crust); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 1rem; }
.form-row { display: grid; gap: 1rem; }
@media (min-width: 640px) { .form-row { grid-template-columns: repeat(3, 1fr); } }
.field { display: grid; gap: .35rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.field label, .field legend { font-weight: 800; }
.field input, .field textarea, .inline-form input {
  font: inherit; font-weight: 600; color: var(--crust);
  min-height: 48px; padding: .6rem .8rem;
  border: var(--outline); border-radius: 12px; background: #fff; width: 100%;
}
.field input:focus, .field textarea:focus, .inline-form input:focus { outline: 3px solid var(--mustard); outline-offset: 0; }
.hint { font-size: .9rem; font-weight: 600; color: var(--crust-soft); margin: 0; }
.form-msg { font-weight: 800; color: var(--ketchup-dark); margin: 0; min-height: 1.4em; }
.form-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.check {
  display: flex; align-items: center; gap: .55rem; min-height: 44px;
  padding: .4rem .7rem; border: 2px solid var(--crust); border-radius: 12px; background: #fff; font-weight: 700; cursor: pointer;
}
.check input { width: 20px; height: 20px; accent-color: var(--ketchup); }
.check:has(input:checked) { background: #fde0d8; }
.consent-check { align-items: flex-start; background: #fff8dc; }
.consent-check input { margin-top: .2rem; flex: none; }
.consent-needed { margin: .5rem 0 0; font-weight: 800; color: var(--ketchup-dark); }
.child-form { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 3px dashed var(--crust); }
.inline-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.inline-form input { width: auto; flex: 1 1 200px; }

/* ---------- Children ---------- */
.children-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .75rem; }
.child-card {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .9rem 1rem; border: 2px solid var(--crust); border-radius: 14px; background: var(--cream);
}
.child-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
.btn-small--danger { color: var(--ketchup-dark); }
.btn-small--danger:hover { background: #fde0d8; }
.day-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.chip { font-size: .8rem; font-weight: 800; padding: .15rem .6rem; border-radius: 999px; background: #e2f3d6; border: 2px solid var(--crust); }
.chip--allergy { background: #fde0d8; }

/* ---------- Tabs (children / days) ---------- */
.child-tabs, .day-tabs { display: flex; gap: .5rem; overflow-x: auto; padding: 4px 4px 8px; margin: 0 -4px 1rem; }
.tab {
  flex: 1 0 auto; display: grid; justify-items: center; gap: .05rem;
  min-height: 48px; min-width: 64px; padding: .4rem .8rem;
  font: inherit; font-weight: 800; cursor: pointer;
  background: var(--paper); color: var(--crust); border: var(--outline); border-radius: 14px;
  position: relative;
}
.tab[aria-selected="true"] { background: var(--ketchup); color: #fff; box-shadow: 3px 3px 0 var(--crust); }
.tab-day { font-family: var(--font-display); text-transform: uppercase; font-size: 1.1rem; font-weight: 400; }
.tab-date { font-size: .8rem; }
.tab-count {
  display: inline-grid; place-items: center; min-width: 1.5rem; height: 1.5rem; padding: 0 .3rem; margin-left: .4rem;
  background: var(--mustard); color: var(--crust); border: 2px solid var(--crust); border-radius: 999px; font-size: .8rem; font-weight: 800;
}
.tab .tab-count { position: absolute; top: -10px; right: -8px; margin: 0; }

.day-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.day-head h3 { margin: 0; }
.notice-allergy { background: #fde0d8; border: 2px solid var(--crust); border-radius: 12px; padding: .75rem 1rem; font-weight: 700; }

/* ---------- Menu items ---------- */
.cats { display: grid; gap: .6rem; margin-bottom: 1.25rem; }
.cat { border: 2px solid var(--crust); border-radius: 14px; background: #fff; }
.cat > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between;
  min-height: 52px; padding: .5rem 1rem; font-family: var(--font-display); text-transform: uppercase; font-size: 1.2rem;
}
.cat > summary::-webkit-details-marker { display: none; }
.cat > summary::after { content: "+"; font-size: 1.5rem; margin-left: auto; padding-left: .75rem; }
.cat[open] > summary::after { content: "−"; }
.cat[open] > summary { border-bottom: 2px dashed var(--crust); }
.item-list { list-style: none; margin: 0; padding: .25rem 0; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 1rem; }
.item:nth-child(even) { background: var(--cream); }
.item.is-chosen { background: #fff2c2; }
.item-text { display: grid; gap: .05rem; }
.item-name { font-weight: 800; }
.item-price { font-weight: 700; color: var(--ketchup-dark); }
.item.is-blocked .item-name, .item.is-blocked .item-price { color: var(--crust-soft); text-decoration: line-through; }
.item-reason { font-size: .85rem; font-weight: 800; color: var(--ketchup-dark); }
.item-reason::before { content: "⚠ "; }

.stepper { display: flex; align-items: center; gap: .35rem; flex: none; }
.stepper button {
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  font: inherit; font-size: 1.4rem; font-weight: 800; line-height: 1;
  background: var(--mustard); color: var(--crust); border: var(--outline); box-shadow: 2px 2px 0 var(--crust);
}
.stepper button:active { transform: translate(2px, 2px); box-shadow: none; }
.stepper button[disabled] { background: var(--paper); opacity: .45; cursor: not-allowed; }
.stepper output { min-width: 1.6rem; text-align: center; font-weight: 800; font-size: 1.15rem; }

/* ---------- Basket bar ---------- */
.basket-bar {
  position: sticky; bottom: 12px; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  margin-top: 1rem; padding: .8rem 1rem;
  background: var(--paper); border: var(--outline); border-radius: 18px; box-shadow: var(--shadow-hard);
}
.basket-bar p { margin: 0; }

/* ---------- Badges, summaries, history ---------- */
.badge { display: inline-block; padding: .2rem .7rem; border: 2px solid var(--crust); border-radius: 999px; font-weight: 800; font-size: .9rem; }
.badge--paid { background: #e2f3d6; }
.badge--cancelled { background: var(--cream); }
.badge--locked { background: var(--crust); color: #fff; }
.badge--open { background: var(--mustard); }
.panel-box { display: grid; gap: .5rem; }
.panel-box p { margin: 0; }
.summary-list { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .35rem; }
.total-line { font-size: 1.15rem; }
.history-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.history-list li { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; padding: .6rem .9rem; border: 2px solid var(--crust); border-radius: 12px; }

/* ---------- Cafe summary ---------- */
.week-nav { display: flex; align-items: center; gap: .75rem; }
.week-label { font-size: clamp(1.4rem, 4vw, 2.2rem); margin: 0; }
.week-stats { display: flex; flex-wrap: wrap; gap: 1.25rem; font-weight: 700; }
.table-wrap { overflow-x: auto; border: var(--outline); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-hard); margin-bottom: 2rem; }
.data-table { width: 100%; border-collapse: collapse; font-weight: 600; }
.data-table th, .data-table td { padding: .55rem .8rem; text-align: left; border-bottom: 2px solid #f0e2c4; vertical-align: top; }
.data-table thead th { background: var(--mustard); font-weight: 800; border-bottom: var(--outline); white-space: nowrap; }
.data-table tbody tr:nth-child(even) { background: var(--cream); }
.data-table tfoot td, .data-table tfoot th { font-weight: 800; border-top: var(--outline); }
.data-table td:not(:first-child) { white-space: normal; }
.data-table tr.has-allergy { background: #fde0d8 !important; }
.allergy-text { color: var(--ketchup-dark); }
.day-section h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
.day-section h2 .muted { font-family: var(--font-body); text-transform: none; font-size: 1rem; }

/* ---------- Cafe: refunds + orders & parents ---------- */
.data-table tr.is-refunded td { color: var(--crust-soft); text-decoration: line-through; }
.data-table tr.is-refunded td:last-child, .data-table tr.is-refunded .refund-note { text-decoration: none; }
.refund-note { color: var(--ketchup-dark); font-weight: 800; }
.orders-section { margin-top: 1rem; }
.orders-section h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
.toolbar-actions a.btn-small { display: inline-flex; align-items: center; text-decoration: none; }

/* ---------- Cafe: menu & allergens ---------- */
.progress-text { margin: 0 0 .5rem; font-size: 1.1rem; }
.progress-bar { height: 16px; border: var(--outline); border-radius: 999px; background: #fff; overflow: hidden; margin-bottom: 1rem; }
.progress-bar span { display: block; height: 100%; width: var(--pct, 0%); background: var(--lettuce); transition: width .3s ease; }
.menu-admin { display: grid; gap: 1.5rem; }
.menu-admin-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.menu-admin-item { border: 2px solid var(--crust); border-radius: 14px; padding: .9rem 1rem; background: #fff; display: grid; gap: .5rem; }
.menu-admin-item.is-missing { border-left: 8px solid var(--mustard); }
.menu-admin-item.is-none, .menu-admin-item.is-contains { border-left: 8px solid var(--lettuce); }
.menu-admin-item.is-inactive { opacity: .6; }
.mai-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }
.mai-status { margin: 0; font-weight: 800; }
.mai-status.is-missing { color: #8a5a00; }
.mai-status.is-contains { color: var(--ketchup-dark); }
.mai-status.is-none { color: var(--lettuce-dark); }
.saved { font-weight: 700; color: var(--lettuce-dark); margin-left: .5rem; }
.allergen-toggles { display: flex; flex-wrap: wrap; gap: .4rem; }
.a-toggle {
  font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; min-height: 40px; padding: .3rem .75rem;
  border: 2px solid var(--crust); border-radius: 999px; background: var(--paper); color: var(--crust);
}
.a-toggle[aria-pressed="true"] { background: var(--ketchup); color: #fff; }
.a-toggle[aria-pressed="true"]::before { content: "✓ "; }
.mai-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.mai-actions .btn-small[aria-pressed="true"] { background: #e2f3d6; }
.switch { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; cursor: pointer; min-height: 44px; }
.switch input { width: 22px; height: 22px; accent-color: var(--lettuce); }

/* ---------- Cafe dashboard: tabs ---------- */
.cafe-tabs {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  padding: .5rem; background: var(--paper); border: var(--outline); border-radius: 18px; box-shadow: var(--shadow-hard);
}
.cafe-tabs a {
  display: inline-flex; align-items: center; min-height: 44px; padding: .4rem 1rem; border-radius: 12px;
  font-family: var(--font-display); text-transform: uppercase; font-size: 1.05rem; color: var(--crust); text-decoration: none;
}
.cafe-tabs a:hover { background: var(--cream); }
.cafe-tabs a[aria-current="page"] { background: var(--ketchup); color: #fff; box-shadow: 2px 2px 0 var(--crust); }
.cafe-tabs #sign-out { margin-left: auto; }

/* ---------- Cafe dashboard: menu editor ---------- */
.cat-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .75rem; margin-bottom: .75rem; }
.cat-head h2 { margin: 0 0 .2rem; }
.cat-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.cat-editor, .item-editor { border-top: 2px dashed var(--crust); padding-top: 1rem; margin: .5rem 0 1rem; }
.menu-admin-cat.is-inactive { opacity: .7; }
.add-item { margin-top: .75rem; }
.add-item-form { margin-top: .75rem; }
.saved.is-error, .form-msg.is-error { color: var(--ketchup-dark); }
.mai-status { font-size: .9rem; }
.field select { font: inherit; font-weight: 600; min-height: 48px; padding: .5rem .7rem; border: var(--outline); border-radius: 12px; background: #fff; color: var(--crust); width: 100%; }
.inline-form select { font: inherit; font-weight: 600; min-height: 44px; padding: .4rem .6rem; border: var(--outline); border-radius: 12px; background: #fff; }

/* ---------- Cafe dashboard: opening hours ---------- */
.hours-edit input[type="time"] { font: inherit; font-weight: 700; min-height: 44px; padding: .3rem .5rem; border: var(--outline); border-radius: 10px; }
.hours-edit input[disabled] { opacity: .35; }
.exception-list { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: .5rem; }
.exception { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem .9rem; border: 2px solid var(--crust); border-radius: 12px; background: #fff2c2; }

/* ---------- Cafe dashboard: parents & children ---------- */
.parents-list { display: grid; gap: 1rem; }
.parent-card { display: grid; gap: .6rem; }
.parent-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; align-items: flex-start; }
.parent-head h2 { font-size: 1.4rem; margin: 0 0 .2rem; }
.parent-contact { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-weight: 700; }
.kid-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.kid { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem .9rem; border: 2px solid var(--crust); border-radius: 12px; background: var(--cream); }
.kid.is-archived { opacity: .6; }
.kid-edit { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.kid-edit input { font: inherit; font-weight: 600; min-height: 44px; padding: .3rem .6rem; border: var(--outline); border-radius: 10px; width: 9rem; }

/* Portal pages: no scroll reveals or decorative motion beyond the public intro */
.portal [data-reveal] { opacity: 1 !important; transform: none !important; }

/* ---------- Print (cafe prep sheet) ---------- */
@media print {
  .site-header, .site-footer, .footer-edge, .marquee, .no-print, .skip-link, .float-doodle { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .portal { padding: 0; }
  .table-wrap, .portal-card { box-shadow: none; border: 1px solid #000; border-radius: 0; }
  .data-table thead th, .data-table tbody tr:nth-child(even), .data-table tr.has-allergy { background: none !important; }
  .data-table th, .data-table td { border-bottom: 1px solid #999; }
  .data-table tr.has-allergy td { font-weight: 800; }
  .badge { border: 1px solid #000; background: none !important; color: #000 !important; }
  .print-page { break-before: page; }
  .print-page:first-child { break-before: auto; }
}
