:root {
  --bg: #ECECEC;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #a1a1a6;
  --line: #e5e5ea;
  --soft: #f5f5f7;
  --blue: #0071E3;
  --blue-h: #0062c4;
  --blue-soft: #e8f1fd;
  --red: #FF3B30;
  --green: #34C759;
  --orange: #FF9500;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.06);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.18);
  --font: "Prompt", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.svg-ic { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ---------- Layout ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(236,236,236,.78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.topbar .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; background: var(--card); object-fit: cover; box-shadow: var(--shadow); display: grid; place-items: center; color: var(--blue); overflow: hidden; }
.brand-name { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 999px; border: 0;
  background: var(--card); color: var(--text); font-weight: 500; cursor: pointer;
  box-shadow: 0 0 0 1px var(--line) inset;
  transition: background .15s, transform .1s, opacity .15s, box-shadow .15s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--soft); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: none; }
.btn-primary:hover { background: var(--blue-h); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: #fff0ef; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover { background: rgba(0,0,0,.05); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 16px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 999px; border: 0; background: transparent;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--muted);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: rgba(0,0,0,.06); color: var(--text); }
.icon-btn.danger:hover { background: #fff0ef; color: var(--red); }
.icon-btn[disabled] { opacity: .3; pointer-events: none; }
.btn .spin, .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Pill nav ---------- */
.pills { display: inline-flex; gap: 4px; padding: 4px; background: rgba(0,0,0,.06); border-radius: 999px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { height: 34px; padding: 0 16px; border-radius: 999px; border: 0; background: transparent; cursor: pointer; font-weight: 500; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: background .2s, color .2s, box-shadow .2s; }
.pill.active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; margin: 28px 4px 12px; display: flex; align-items: center; gap: 8px; }
.page-head { padding: 34px 0 10px; }
.page-head h1 { margin: 0; font-size: 32px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 18px 0; }
.toolbar .grow { flex: 1; }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge.green { background: #e7f8ec; color: #1f8a3c; }
.badge.orange { background: #fff3e0; color: #b86e00; }
.badge.red { background: #ffeceb; color: #c4271d; }
.badge.blue { background: var(--blue-soft); color: var(--blue); }

/* ---------- Search ---------- */
.search { position: relative; flex: 1; min-width: 200px; max-width: 420px; }
.search input { width: 100%; height: 40px; border-radius: 999px; border: 0; background: var(--card); padding: 0 16px 0 40px; box-shadow: 0 0 0 1px var(--line) inset; outline: none; transition: box-shadow .15s; }
.search input:focus { box-shadow: 0 0 0 2px var(--blue) inset; }
.search .svg-ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.input, .field input[type=text], .field input[type=url], .field input[type=password], .field input[type=date], .field select, .field textarea {
  width: 100%; height: 42px; border-radius: var(--radius-sm); border: 0; padding: 0 14px;
  background: var(--soft); outline: none; box-shadow: 0 0 0 1px transparent inset; transition: box-shadow .15s, background .15s;
}
.field textarea { height: auto; min-height: 80px; padding: 10px 14px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { background: #fff; box-shadow: 0 0 0 2px var(--blue) inset; }
.field small { display: block; color: var(--faint); font-size: 12px; margin-top: 5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.switch-row > div { min-width: 0; }
.switch-row b { font-weight: 500; display: block; }
.switch-row small { color: var(--muted); font-size: 12px; }
.switch { position: relative; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: #e2e2e7; border-radius: 999px; transition: background .2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(20px); }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: 0 0 0 2px #fff inset; transition: transform .12s, box-shadow .12s; }
.swatch.sel { box-shadow: 0 0 0 2px #fff inset, 0 0 0 2px var(--text); transform: scale(1.08); }

.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.icon-opt { height: 44px; border-radius: 12px; border: 0; background: var(--soft); display: grid; place-items: center; cursor: pointer; color: var(--muted); transition: background .12s, color .12s; }
.icon-opt:hover { background: #ebebf0; }
.icon-opt.sel { background: var(--blue); color: #fff; }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; transition: opacity .2s;
}
.modal-back.show { opacity: 1; }
.modal {
  background: var(--card); border-radius: 22px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  transform: translateY(16px) scale(.98); transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.modal-back.show .modal { transform: none; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 10px; }
.modal-head h3 { margin: 0; font-size: 19px; font-weight: 600; flex: 1; }
.modal-body { padding: 6px 20px 16px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
@media (max-width: 560px) {
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { border-radius: 22px 22px 0 0; max-height: 92vh; }
}

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: rgba(29,29,31,.92); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow-lg); display: flex; gap: 8px; align-items: center; opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; max-width: 90vw; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: #d7261e; }

/* ---------- States ---------- */
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .svg-ic { color: var(--faint); margin-bottom: 10px; }
.empty h4 { margin: 0 0 4px; color: var(--text); font-weight: 600; font-size: 17px; }
.loader { display: flex; justify-content: center; padding: 60px; color: var(--muted); }
.loader .spin { width: 28px; height: 28px; border-width: 3px; }
.notice { padding: 14px 16px; border-radius: 14px; background: #fff7e6; color: #8a5a00; font-size: 14px; margin: 16px 0; display: flex; gap: 10px; align-items: flex-start; }
.admin-bar { background: var(--text); color: #fff; font-size: 13px; }
.admin-bar .wrap { display: flex; align-items: center; gap: 10px; height: 40px; }
.admin-bar .grow { flex: 1; }
.admin-bar button { background: rgba(255,255,255,.14); color: #fff; border: 0; height: 28px; padding: 0 12px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.admin-bar button:hover { background: rgba(255,255,255,.24); }

/* ---------- HUB ---------- */
.hub-hero { text-align: center; padding: 48px 0 18px; }
.hub-hero .logo { width: 84px; height: 84px; border-radius: 24px; margin: 0 auto 16px; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; overflow: hidden; color: var(--blue); }
.hub-hero .logo img { width: 100%; height: 100%; object-fit: cover; }
.hub-hero .school { color: var(--muted); font-size: 15px; font-weight: 500; }
.hub-hero h1 { margin: 2px 0 6px; font-size: 38px; font-weight: 700; letter-spacing: -.015em; }
.hub-hero p { margin: 0; color: var(--muted); font-size: 17px; }
.hub-search { display: flex; justify-content: center; margin: 22px 0 6px; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.hub-card {
  position: relative; display: flex; gap: 14px; align-items: center; padding: 18px; color: var(--text);
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s; min-height: 92px;
}
a.hub-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 14px 34px rgba(0,0,0,.1); }
.hub-card .tile { width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.hub-card .txt { flex: 1; min-width: 0; }
.hub-card .t { font-weight: 600; font-size: 16px; line-height: 1.3; }
.hub-card .d { color: var(--muted); font-size: 13px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hub-card .go { color: var(--faint); }
.hub-card.off { opacity: .5; }
.hub-card .admin-tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 0; background: rgba(255,255,255,.92); border-radius: 999px; padding: 2px; box-shadow: 0 1px 6px rgba(0,0,0,.1); }
.hub-card .admin-tools .icon-btn { width: 30px; height: 30px; }
.hub-card.admin { padding-top: 40px; }
.hub-add { border: 2px dashed #cfcfd4; background: transparent; box-shadow: none; color: var(--muted); justify-content: center; cursor: pointer; font-weight: 500; }
.hub-add:hover { border-color: var(--blue); color: var(--blue); }
.footer { text-align: center; color: var(--faint); font-size: 12px; padding: 40px 0 30px; }

/* ---------- FOOD ---------- */
.food-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.food-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; transition: transform .18s, box-shadow .18s; position: relative; }
.food-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 14px 34px rgba(0,0,0,.1); }
.food-card .ph { aspect-ratio: 1/1; background: var(--soft); display: grid; place-items: center; color: var(--faint); overflow: hidden; }
.food-card .ph img { width: 100%; height: 100%; object-fit: cover; }
.food-card .info { padding: 10px 12px 12px; }
.food-card .n { font-weight: 600; font-size: 14.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.food-card .c { font-size: 12px; margin-top: 4px; display: flex; align-items: center; gap: 5px; color: var(--muted); }
.food-card.off { opacity: .55; }
.food-card .sel-mark { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 1px 4px rgba(0,0,0,.2); display: grid; place-items: center; color: transparent; transition: background .15s, color .15s; }
.food-card.picked { box-shadow: 0 0 0 3px var(--blue); }
.food-card.picked .sel-mark { background: var(--blue); color: #fff; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 13px; border-radius: 999px; border: 0; background: var(--card); box-shadow: 0 0 0 1px var(--line) inset; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s; }
.chip.active { background: var(--text); color: #fff; box-shadow: none; }

.img-drop { position: relative; aspect-ratio: 4/3; border-radius: 16px; background: var(--soft); display: grid; place-items: center; overflow: hidden; cursor: pointer; color: var(--muted); border: 2px dashed #d6d6db; transition: border-color .15s; margin-bottom: 14px; }
.img-drop:hover { border-color: var(--blue); }
.img-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.img-drop .ph-txt { text-align: center; font-size: 14px; }
.img-drop.has { border-style: solid; border-color: transparent; }
.img-drop .chg { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 5px 12px; border-radius: 999px; }

/* Week view (public) */
.week-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 24px 0 16px; }
.week-head .grow { flex: 1; min-width: 200px; }
.week-head h2 { margin: 0; font-size: 26px; font-weight: 700; }
.week-head .sub { color: var(--muted); }
.days { display: grid; gap: 14px; }
.day { display: grid; grid-template-columns: 140px 1fr; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.day .lab { padding: 18px 14px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.day .lab b { font-size: 20px; font-weight: 700; line-height: 1.2; }
.day .lab span { font-size: 13px; opacity: .85; }
.day .lab .today { margin-top: 6px; font-size: 11px; background: rgba(255,255,255,.35); padding: 1px 8px; border-radius: 999px; }
.day .body { padding: 14px; display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; min-height: 120px; }
.day .body .dish { width: 130px; }
.day .body .dish .ph { width: 130px; height: 130px; border-radius: 14px; background: var(--soft); overflow: hidden; display: grid; place-items: center; color: var(--faint); }
.day .body .dish .ph img { width: 100%; height: 100%; object-fit: cover; }
.day .body .dish .n { font-size: 14px; font-weight: 500; margin-top: 6px; line-height: 1.35; }
.day .body .dish .c { font-size: 12px; color: var(--muted); display: flex; gap: 5px; align-items: center; }
.day .holiday { color: var(--muted); align-self: center; width: 100%; text-align: center; font-size: 16px; }
.day .dnote { width: 100%; font-size: 13px; color: var(--muted); }
.day.is-today { box-shadow: 0 0 0 3px var(--blue), var(--shadow); }
@media (max-width: 620px) {
  .day { grid-template-columns: 1fr; }
  .day .lab { flex-direction: row; gap: 10px; justify-content: flex-start; padding: 10px 14px; }
  .day .lab .today { margin: 0; }
  .day .body .dish { width: calc(50% - 6px); }
  .day .body .dish .ph { width: 100%; height: auto; aspect-ratio: 1/1; }
}

/* Week builder */
.week-list { display: grid; gap: 10px; }
.week-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); flex-wrap: wrap; }
.week-row .cal { width: 52px; height: 52px; border-radius: 14px; background: var(--blue-soft); color: var(--blue); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; flex-shrink: 0; }
.week-row .cal b { font-size: 20px; }
.week-row .cal span { font-size: 11px; }
.week-row .meta { flex: 1; min-width: 180px; }
.week-row .meta .t { font-weight: 600; }
.week-row .meta .s { color: var(--muted); font-size: 13px; }
.week-row .acts { display: flex; gap: 2px; }

.ed-day { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.ed-day-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.ed-day-head .dname { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 10px; flex: 1; min-width: 160px; }
.ed-day-head .dname .bar { width: 6px; height: 28px; border-radius: 3px; }
.ed-day-head .dname small { font-weight: 400; color: var(--muted); font-size: 14px; }
.ed-items { padding: 0 16px 14px; display: flex; flex-wrap: wrap; gap: 10px; }
.ed-item { display: flex; align-items: center; gap: 8px; background: var(--soft); border-radius: 14px; padding: 6px 4px 6px 6px; max-width: 100%; }
.ed-item .th { width: 44px; height: 44px; border-radius: 10px; background: #e5e5ea; overflow: hidden; flex-shrink: 0; display: grid; place-items: center; color: var(--faint); }
.ed-item .th img { width: 100%; height: 100%; object-fit: cover; }
.ed-item .nm { font-size: 14px; font-weight: 500; line-height: 1.25; min-width: 0; max-width: 170px; }
.ed-item .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.ed-item .icon-btn { width: 28px; height: 28px; }
.ed-add { height: 56px; border-radius: 14px; border: 2px dashed #d0d0d5; background: transparent; padding: 0 16px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.ed-add:hover { border-color: var(--blue); color: var(--blue); }
.ed-extra { padding: 0 16px 14px; display: grid; gap: 8px; }
.ed-extra input { height: 38px; }
.ed-day.holiday .ed-items { display: none; }
.sticky-foot { position: sticky; bottom: 0; z-index: 30; background: rgba(236,236,236,.85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); padding: 12px 0; margin-top: 10px; }
.sticky-foot .wrap { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.cat-list { display: grid; gap: 8px; }
.cat-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); }
.cat-row .nm { flex: 1; font-weight: 500; }
.cat-row .cnt { color: var(--muted); font-size: 13px; }

.preview-box { background: var(--soft); border-radius: 16px; padding: 12px; display: grid; place-items: center; min-height: 260px; }
.preview-box img { max-height: 62vh; width: auto; border-radius: 8px; box-shadow: var(--shadow); }

.bulk-row { display: grid; grid-template-columns: 64px 1fr 34px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bulk-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; }
.bulk-row .st { font-size: 12px; color: var(--muted); }

/* ---------- Departments ---------- */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.dept-card { position: relative; background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 26px 20px 20px; text-align: center; cursor: pointer; transition: transform .18s, box-shadow .18s; border: 0; font: inherit; color: var(--text); display: flex; flex-direction: column; align-items: center; }
.dept-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 16px 38px rgba(0,0,0,.11); }
.dept-card .tile { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; color: #fff; margin-bottom: 14px; }
.dept-card .t { font-weight: 700; font-size: 18px; line-height: 1.3; }
.dept-card .d { color: var(--muted); font-size: 13px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dept-card .n { margin-top: 12px; font-size: 12px; font-weight: 500; color: var(--blue); background: var(--blue-soft); padding: 3px 12px; border-radius: 999px; }
.dept-card.off { opacity: .5; }
.dept-card .admin-tools { position: absolute; top: 8px; right: 8px; display: flex; background: rgba(255,255,255,.92); border-radius: 999px; padding: 2px; box-shadow: 0 1px 6px rgba(0,0,0,.1); }
.dept-card .admin-tools .icon-btn { width: 30px; height: 30px; }
.dept-add { background: transparent; box-shadow: none; border: 2px dashed #cfcfd4; color: var(--muted); justify-content: center; gap: 8px; font-weight: 500; min-height: 200px; }
.dept-add:hover { border-color: var(--blue); color: var(--blue); }
.dept-head { display: flex; align-items: center; gap: 18px; margin: 8px 0 22px; flex-wrap: wrap; }
.dept-head .tile { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.dept-head .grow { flex: 1; min-width: 200px; }
.dept-head h1 { margin: 0; font-size: 30px; font-weight: 700; line-height: 1.25; }
.dept-head p { margin: 4px 0 0; color: var(--muted); }
.hub-card .u { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--faint); margin-top: 4px; }

/* ---------- Logo & language ---------- */
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-logo:has(> img[src$="logo.webp"]), .hub-hero .logo:has(> img[src$="logo.webp"]) { background: transparent; box-shadow: none; border-radius: 50%; }
.hub-hero .logo:has(> img[src$="logo.webp"]) { width: 104px; height: 104px; filter: drop-shadow(0 6px 16px rgba(0,0,0,.15)); }
.topline { display: flex; justify-content: flex-end; padding-top: 16px; }
.lang-switch { display: inline-flex; padding: 3px; background: var(--card); border-radius: 999px; box-shadow: var(--shadow); }
.lang-switch button { border: 0; background: transparent; height: 30px; min-width: 44px; padding: 0 12px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.lang-switch button.on { background: var(--text); color: #fff; }
.hub-hero { padding-top: 12px; }
.topline.between { justify-content: space-between; align-items: center; }
.dept-search { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; flex-wrap: wrap; }
.dept-search .search { max-width: 460px; }
.dept-search .cnt { color: var(--muted); font-size: 13px; }
.dept-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 260px)); justify-content: center; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  body { font-size: 14px; }
  .wrap { padding: 0 14px; }
  .topline { padding-top: 10px; }
  .lang-switch button { height: 26px; min-width: 38px; padding: 0 10px; font-size: 12px; }
  .hub-hero { padding: 4px 0 6px; }
  .hub-hero .logo, .hub-hero .logo:has(> img[src$="logo.webp"]) { width: 68px; height: 68px; margin-bottom: 10px; border-radius: 50%; }
  .hub-hero .school { font-size: 13px; }
  .hub-hero h1 { font-size: 24px; margin: 0 0 2px; }
  .hub-hero p { font-size: 14px; }
  .hub-search { margin: 14px 0 0; }
  .search { min-width: 0; }
  .search input { height: 38px; font-size: 14px; }
  .section-title { margin: 20px 2px 10px; font-size: 12px; }
  .dept-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dept-card { padding: 16px 10px 14px; border-radius: 18px; }
  .dept-card .tile { width: 48px; height: 48px; border-radius: 14px; margin-bottom: 8px; }
  .dept-card .tile .svg-ic { width: 24px; height: 24px; }
  .dept-card .t { font-size: 14.5px; }
  .dept-card .d { font-size: 11.5px; }
  .dept-card .n { margin-top: 8px; font-size: 11px; padding: 2px 10px; }
  .dept-add { min-height: 140px; }
  .dept-head { gap: 12px; margin: 6px 0 14px; }
  .dept-head .tile { width: 52px; height: 52px; border-radius: 15px; }
  .dept-head .tile .svg-ic { width: 26px; height: 26px; }
  .dept-head h1 { font-size: 21px; }
  .dept-head p { font-size: 13px; margin-top: 2px; }
  .dept-head .grow { min-width: 0; }
  .dept-search { gap: 8px; margin-bottom: 12px; }
  .dept-search .search { max-width: none; flex: 1 1 100%; }
  .hub-grid { grid-template-columns: 1fr; gap: 10px; }
  .hub-card { padding: 12px 14px; gap: 12px; min-height: 0; border-radius: 16px; }
  .hub-card .tile { width: 44px; height: 44px; border-radius: 12px; }
  .hub-card .tile .svg-ic { width: 22px; height: 22px; }
  .hub-card .t { font-size: 15px; }
  .hub-card .d { font-size: 12.5px; -webkit-line-clamp: 1; }
  .hub-card.admin { padding-top: 40px; }
  .hub-add { min-height: 64px; }
  .footer { padding: 28px 0 22px; }
  .admin-bar .wrap { height: 36px; font-size: 12px; }
  .page-head h1 { font-size: 24px; }
  .topbar .wrap { height: 54px; }
  .pills { width: 100%; }
  .pill { padding: 0 12px; font-size: 13px; }
  .toolbar { margin: 12px 0; gap: 8px; }
  .food-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .week-row { padding: 12px; gap: 10px; }
  .week-row .cal { width: 44px; height: 44px; }
  .ed-item .nm { max-width: 120px; font-size: 13px; }
  .card-pad { padding: 14px; }
}

/* ---------- System cards (no icon) ---------- */
.hub-card.plain { padding: 18px 18px 16px 20px; align-items: center; }
.hub-card.plain .t { font-size: 16.5px; font-weight: 600; }
.hub-card.plain .d { -webkit-line-clamp: 3; color: #48484a; font-size: 13.5px; margin-top: 4px; line-height: 1.45; }
.hub-card.plain .u { margin-top: 8px; }
.hub-card .tag { font-size: 11.5px; font-weight: 600; margin-bottom: 2px; }
.hub-card.plain.admin { padding-top: 42px; }
@media (max-width: 600px) {
  .hub-card.plain { padding: 13px 14px 12px 16px; }
  .hub-card.plain .t { font-size: 15.5px; }
  .hub-card.plain .d { -webkit-line-clamp: 3; font-size: 13px; }
  .hub-card.plain .u { margin-top: 6px; }
  .hub-card.plain.admin { padding-top: 42px; }
}

/* ---------- Food: public submit + pending ---------- */
.sub-row { display: grid; grid-template-columns: 96px 1fr 36px; gap: 14px; align-items: start; margin-bottom: 12px; }
.sub-row.done { opacity: .75; }
.sub-ph { width: 96px; height: 96px; border-radius: 16px; background: var(--soft); border: 2px dashed #d0d0d5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 12px; cursor: pointer; overflow: hidden; }
.sub-ph.has { border: 0; }
.sub-ph img { width: 100%; height: 100%; object-fit: cover; }
.sub-fields { display: grid; gap: 8px; min-width: 0; }
.sub-fields .input { height: 40px; }
.sub-st { font-size: 13px; font-weight: 500; }
.sub-st.ok { color: #1f8a3c; }
.sub-st.err { color: var(--red); }
.pend-list { display: grid; gap: 12px; }
.pend-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 14px; padding: 14px; align-items: start; }
.pend-row .ph { width: 110px; height: 110px; border-radius: 14px; background: var(--soft); overflow: hidden; display: grid; place-items: center; color: var(--faint); }
.pend-row .ph img { width: 100%; height: 100%; object-fit: cover; }
.pend-row .pf { display: grid; gap: 8px; min-width: 0; }
.pend-row .pf .input { height: 38px; }
.pend-row .pd { font-size: 13px; color: var(--muted); }
.pend-row .pm { font-size: 12px; color: var(--faint); }
.pend-row .pa { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 600px) {
  .sub-row { grid-template-columns: 76px 1fr; }
  .sub-row > :last-child { grid-column: 2; justify-self: end; }
  .sub-ph { width: 76px; height: 76px; }
  .pend-row { grid-template-columns: 80px 1fr; }
  .pend-row .ph { width: 80px; height: 80px; }
  .pend-row .pa { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
}

/* ---------- Placeholder image ---------- */
.ph-gen { width: 100%; height: 100%; display: grid; place-items: center; font-weight: 700; font-size: 38px; line-height: 1; }

/* ---------- Calendar (ปฏิทินเมนู) ---------- */
.cal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 18px 0 14px; }
.cal-nav { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 280px; }
.cal-title { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0 4px; }
.cal-title b { font-size: 19px; font-weight: 700; line-height: 1.25; }
.cal-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.cal-tools .input { height: 36px; width: auto; background: var(--card); box-shadow: 0 0 0 1px var(--line) inset; font-size: 13px; padding: 0 10px; border-radius: 10px; }
.cal-layout { display: grid; grid-template-columns: 1fr 260px; gap: 14px; align-items: start; }
.cal-scroll { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.cal { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; min-width: calc(96px + var(--days) * 136px); }
.cal th, .cal td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; }
.cal tr > :last-child { border-right: 0; }
.cal tbody tr:last-child > * { border-bottom: 0; }
.cal .corner { width: 96px; background: var(--soft); }
.cal .dh { padding: 0 8px 8px; text-align: left; font-weight: 400; background: #fff; position: relative; }
.cal .dh .bar { height: 5px; margin: 0 -8px 8px; }
.cal .dh .dn { font-weight: 700; font-size: 15px; }
.cal .dh .dd { font-size: 12px; color: var(--muted); }
.cal .dh.today { background: var(--blue-soft); }
.cal .dh.today .dd { color: var(--blue); font-weight: 600; }
.cal .hol-btn { margin-top: 6px; border: 0; background: var(--soft); color: var(--muted); font-size: 11px; height: 22px; padding: 0 9px; border-radius: 999px; cursor: pointer; }
.cal .hol-btn.on { background: #ffeceb; color: var(--red); font-weight: 600; }
.cal .rh { width: 96px; background: var(--soft); text-align: left; padding: 10px; font-size: 13px; font-weight: 700; position: sticky; left: 0; z-index: 2; }
.cal .slot-main .rh { color: #b86e00; }
.cal .slot-side .rh { color: #1f8a3c; }
.cal .slot-snack .rh { color: #c2185b; }
.cal .slot-note .rh { color: var(--muted); font-weight: 600; }
.cal .cell { padding: 6px; min-height: 64px; transition: background .12s; }
.cal .slot-main .cell { background: #fffaf2; }
.cal .cell.over { background: var(--blue-soft) !important; box-shadow: 0 0 0 2px var(--blue) inset; }
.cal .cell.note { padding: 6px; }
.cal .cell.note textarea { width: 100%; min-height: 48px; font-size: 12.5px; padding: 6px 8px; resize: vertical; border-radius: 10px; }
.cal .cell.hol { background: repeating-linear-gradient(135deg, #fafafa, #fafafa 8px, #f2f2f5 8px, #f2f2f5 16px); vertical-align: middle; }
.hol-box { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--red); padding: 10px 4px; text-align: center; }
.hol-box b { font-size: 16px; }
.hol-box .input { height: 34px; font-size: 12px; text-align: center; background: #fff; }
.chip-food { display: flex; align-items: center; gap: 6px; background: #fff; border-radius: 10px; box-shadow: 0 0 0 1px var(--line) inset; padding: 4px 4px 4px 4px; margin-bottom: 5px; cursor: grab; position: relative; }
.chip-food:active { cursor: grabbing; }
.cf-ph { width: 30px; height: 30px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--soft); }
.cf-ph img { width: 100%; height: 100%; object-fit: cover; }
.cf-ph .ph-gen { font-size: 15px; }
.cf-n { font-size: 12.5px; font-weight: 500; line-height: 1.25; flex: 1; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cf-x { border: 0; background: transparent; color: var(--faint); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.cf-x:hover { background: #ffeceb; color: var(--red); }
.cell-add { width: 100%; height: 30px; border: 1.5px dashed #d0d0d5; background: transparent; border-radius: 10px; color: var(--muted); font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.cell-add:hover { border-color: var(--blue); color: var(--blue); background: #fff; }
body.dragging .cell[data-di] { outline: 1px dashed #c7c7cc; outline-offset: -3px; }
.cal-panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; position: sticky; top: 74px; max-height: calc(100vh - 170px); display: flex; flex-direction: column; gap: 8px; }
.cal-panel .cp-head b { display: block; font-size: 15px; }
.cal-panel .cp-head small { color: var(--muted); font-size: 12px; }
.cal-panel .search { min-width: 0; max-width: none; }
.cal-panel .search input { height: 34px; font-size: 13px; background: var(--soft); box-shadow: none; }
.cp-list { overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.cp-cat { font-size: 12px; font-weight: 700; color: var(--muted); margin: 10px 0 4px; display: flex; align-items: center; gap: 6px; }
.cp-item { display: flex; align-items: center; gap: 8px; padding: 5px; border-radius: 10px; font-size: 13px; cursor: grab; }
.cp-item:hover { background: var(--soft); }
.cal-extra { margin-top: 14px; }
.cal-extra .field { margin-bottom: 0; }
@media (max-width: 1000px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-panel { display: none; }
}
@media (max-width: 600px) {
  .cal-head { margin: 12px 0 10px; }
  .cal-nav { min-width: 0; width: 100%; }
  .cal-title b { font-size: 16px; }
  .cal-tools { width: 100%; }
  .cal-tools .input { flex: 1; min-width: 0; }
  .cal { min-width: calc(74px + var(--days) * 132px); }
  .cal .corner, .cal .rh { width: 74px; }
  .cal .rh { font-size: 12px; padding: 8px 6px; }
  .cf-n { font-size: 12px; }
}

/* ---------- Library (แบบแอปสั่งอาหาร) ---------- */
.cat-bar { position: sticky; top: 60px; z-index: 20; background: rgba(236,236,236,.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); margin: 0 -20px 6px; padding: 8px 20px; }
.cat-bar .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.cat-bar .chips::-webkit-scrollbar { display: none; }
.cat-bar .chip small { color: var(--faint); font-weight: 600; }
.lib-sec { scroll-margin-top: 120px; margin-bottom: 22px; }
.lib-sec h3 { font-size: 19px; font-weight: 700; margin: 14px 2px 12px; display: flex; align-items: center; gap: 8px; }
.lib-sec h3 small { font-size: 12px; font-weight: 500; color: var(--muted); background: var(--card); padding: 2px 10px; border-radius: 999px; }
.grab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.grab-card { display: flex; gap: 14px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 12px; cursor: pointer; transition: transform .15s, box-shadow .15s; align-items: center; }
.grab-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 12px 30px rgba(0,0,0,.1); }
.grab-card.off { opacity: .55; }
.gc-ph { width: 88px; height: 88px; border-radius: 14px; overflow: hidden; flex-shrink: 0; background: var(--soft); }
.gc-ph img { width: 100%; height: 100%; object-fit: cover; }
.gc-info { min-width: 0; flex: 1; }
.gc-n { font-weight: 600; font-size: 15.5px; line-height: 1.3; }
.gc-d { color: var(--muted); font-size: 13px; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.food-card .ph .ph-gen { font-size: 44px; }
@media (max-width: 600px) {
  .cat-bar { top: 54px; margin: 0 -14px 4px; padding: 8px 14px; }
  .grab-grid { grid-template-columns: 1fr; gap: 10px; }
  .gc-ph { width: 72px; height: 72px; }
  .lib-sec h3 { font-size: 17px; }
}
