/* ═══════════════════════════════════════════════
   급식뭐지 — Soft Organic Design System
   Warm, human, not-AI-feeling
   ═══════════════════════════════════════════════ */

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

:root {
  --green: #4CAF50;
  --green-dark: #3d9141;
  --green-soft: #e8f5e9;
  --green-bg: #f1f8e9;
  --green-accent: #66bb6a;

  --bg: #fafbfc;
  --card: #ffffff;
  --card-hover: #f8faf8;

  --text: #2c3e2d;
  --text-2: #5a6e5c;
  --text-3: #8fa191;
  --text-placeholder: #b8c9ba;

  --border: #e8ede9;
  --shadow-sm: 0 2px 8px rgba(76,175,80,.06);
  --shadow-md: 0 4px 20px rgba(76,175,80,.08);
  --shadow-lg: 0 8px 32px rgba(76,175,80,.1);
  --shadow-card: 0 2px 12px rgba(0,0,0,.04);

  --amber: #ff9800;
  --red: #e53935;
  --blue: #42a5f5;
  --pink: #ec407a;
  --purple: #ab47bc;
  --cyan: #26c6da;

  --r: 16px;
  --r-lg: 24px;
  --r-xl: 32px;

  --ease: cubic-bezier(.25,.8,.25,1);
  --bounce: cubic-bezier(.34,1.56,.64,1);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select { font-family: inherit; }
.text-accent { color: var(--green); }

/* ═══ APP SHELL ═══ */
#app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
  pointer-events: none;
  z-index: 0;
}
.screen.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
  z-index: 1;
}

/* ═══════════════════════════════════
   AUTH SCREEN
   ═══════════════════════════════════ */
#auth-screen {
  background: #fff;
}

.auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}
.auth-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: .35;
}
.auth-glow.g1 {
  width: 360px; height: 360px;
  top: -80px; right: -120px;
  background: #c8e6c9;
  animation: gFloat 12s ease-in-out infinite;
}
.auth-glow.g2 {
  width: 260px; height: 260px;
  bottom: 20px; left: -80px;
  background: #dcedc8;
  animation: gFloat 15s ease-in-out infinite reverse;
}
@keyframes gFloat {
  0%,100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(15px,-15px) scale(1.08); }
}

.auth-content {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 28px;
  overflow-y: auto;
}

.auth-logo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 72px;
  margin-bottom: 40px;
}
.auth-mascot {
  width: 88px;
  height: 88px;
  margin-bottom: 20px;
  animation: mascotBounce .7s var(--bounce);
}
.auth-mascot img { width: 100%; height: 100%; object-fit: contain; }
.mascot-fallback {
  width: 88px; height: 88px;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
  background: var(--green-soft);
  border-radius: 50%;
}
@keyframes mascotBounce {
  from { transform: scale(.3); opacity: 0; }
  60% { transform: scale(1.06); opacity: 1; }
  to { transform: scale(1); }
}

.auth-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
}
.auth-title span { color: var(--green); }
.auth-sub {
  font-size: 14px;
  color: var(--text-3);
  margin-top: 6px;
}

.auth-form {
  width: 100%;
  max-width: 360px;
}

.auth-input-group {
  margin-bottom: 18px;
}
.auth-input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 7px;
}
.auth-input-group input,
.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  background: #fff;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.auth-input-group input:focus,
.form-input:focus {
  border-color: var(--green-accent);
  box-shadow: 0 0 0 4px rgba(76,175,80,.1);
}

#signup-admin-code-group {
  animation: slideDown 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-input-group input::placeholder,
.form-input::placeholder { color: var(--text-placeholder); }

.role-selector {
  display: flex;
  gap: 10px;
}
.role-btn {
  flex: 1;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
  transition: all .25s var(--ease);
}
.role-btn.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 700;
}

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  margin-top: 24px;
  padding-bottom: 48px;
}
.auth-switch button {
  background: none;
  border: none;
  color: var(--green);
  font-weight: 700;
  font-size: 13px;
}

/* ═══ BUTTONS ═══ */
.btn-primary {
  width: 100%;
  padding: 16px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
  box-shadow: 0 4px 16px rgba(76,175,80,.25);
  transition: all .25s var(--ease);
}
.btn-primary:active {
  transform: scale(.97);
  box-shadow: 0 2px 8px rgba(76,175,80,.2);
}

.btn-sm {
  padding: 9px 18px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  transition: transform .15s;
}
.btn-sm:active { transform: scale(.95); }

.btn-outline-sm {
  padding: 8px 16px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  transition: all .2s;
  display: inline-block;
}
.btn-outline-sm:hover { border-color: var(--green); color: var(--green); }
.btn-danger-outline { border-color: var(--red); color: var(--red); }

.link-btn {
  background: none;
  border: none;
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
}

/* ═══ STATUS BAR (hidden) ═══ */
.status-bar, .status-right { display: none; }

/* ═══ APPBAR ═══ */
.appbar {
  height: 56px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid rgba(0,0,0,.04);
  flex-shrink: 0;
  z-index: 50;
}
.appbar-left { display: flex; align-items: center; gap: 10px; }
.appbar-mascot {
  width: 32px; height: 32px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--green-soft);
  display: flex; align-items: center; justify-content: center;
}
.appbar-mascot img { width: 100%; height: 100%; object-fit: cover; }
.appbar-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
}
.appbar-title b { color: var(--green); font-weight: 800; }
.appbar-right { display: flex; gap: 8px; }
.appbar-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: none;
  background: var(--green-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-dark);
  transition: all .2s var(--ease);
  position: relative;
}
.appbar-btn:active { transform: scale(.88); }
.bell-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--green-soft);
}

.appbar-detail { display: none; }
.appbar-detail.show { display: flex; }
.back-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  border: none;
  background: var(--green-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--green-dark);
  transition: transform .15s;
}
.back-btn:active { transform: scale(.88); }
#detail-bar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-left: 12px;
  flex: 1;
}

/* ═══ MAIN SCROLL ═══ */
.main-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.main-scroll::-webkit-scrollbar { width: 0; }

.page {
  display: none;
  animation: pageSlide .4s var(--ease);
}
.page.active { display: block; }
@keyframes pageSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════
   HOME PAGE
   ═══════════════════════════════════ */
.home-welcome {
  padding: 20px 20px 8px;
}
.welcome-hi {
  font-size: 14px;
  color: var(--text-3);
  font-weight: 400;
}
.home-welcome h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
  margin-top: 2px;
}

/* Tabs */
.tab-bar {
  display: flex;
  padding: 4px 20px 0;
  gap: 8px;
}
.tab {
  flex: 1;
  padding: 12px 0;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-3);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  transition: all .25s var(--ease);
}
.tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

/* Kcal banner */
.kcal-banner {
  background: linear-gradient(135deg, var(--green) 0%, #66bb6a 100%);
  margin: 12px 20px;
  border-radius: var(--r-lg);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  box-shadow: 0 6px 24px rgba(76,175,80,.2);
}
.kcal-left { display: flex; align-items: baseline; gap: 6px; }
.kcal-number {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.03em;
}
.kcal-unit { font-size: 13px; opacity: .6; }
.kcal-desc { font-size: 12px; opacity: .7; }

/* Menu grid — category card style */
.menu-grid {
  padding: 16px 20px 20px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.menu-card {
  background: var(--card);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
  -webkit-tap-highlight-color: transparent;
  animation: cardIn .4s var(--ease) both;
}
.menu-card:nth-child(1) { animation-delay: 0s; }
.menu-card:nth-child(2) { animation-delay: .06s; }
.menu-card:nth-child(3) { animation-delay: .12s; }
.menu-card:nth-child(4) { animation-delay: .18s; }
.menu-card:nth-child(5) { animation-delay: .24s; }
.menu-card:nth-child(6) { animation-delay: .3s; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.menu-card:active { transform: scale(.96); }
.menu-card:hover { box-shadow: var(--shadow-md); }

.mc-visual {
  aspect-ratio: 1.1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
/* Pastel backgrounds per card */
.menu-card:nth-child(1) .mc-visual { background: #e8f5e9; }
.menu-card:nth-child(2) .mc-visual { background: #fff3e0; }
.menu-card:nth-child(3) .mc-visual { background: #e3f2fd; }
.menu-card:nth-child(4) .mc-visual { background: #fce4ec; }
.menu-card:nth-child(5) .mc-visual { background: #f3e5f5; }
.menu-card:nth-child(6) .mc-visual { background: #e0f7fa; }
.menu-card:nth-child(7) .mc-visual { background: #fff8e1; }
.menu-card:nth-child(8) .mc-visual { background: #efebe9; }

.mc-ring {
  width: 64px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255,255,255,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .3s var(--bounce);
}
.menu-card:hover .mc-ring { transform: scale(1.1) rotate(5deg); }
.mc-emoji { font-size: 34px; }
.mc-allergy-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid #fff;
}

.mc-info {
  padding: 12px 14px 14px;
}
.mc-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.mc-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 3px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-3);
}
.empty-mascot { margin-bottom: 14px; }
.empty-state p { font-size: 15px; font-weight: 600; color: var(--text-2); }
.empty-state small { font-size: 12px; }

/* Section card */
.section-card {
  margin: 0 20px 16px;
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.section-card-head {
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
}
.teaser-empty {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-3);
  background: var(--green-bg);
}

/* ═══ DETAIL PAGE ═══ */
.detail-hero {
  padding: 32px 20px 24px;
  text-align: center;
}
.detail-circle {
  width: 110px; height: 110px;
  border-radius: 50%;
  background: var(--green-soft);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 4px 20px rgba(76,175,80,.12);
  animation: detailPop .5s var(--bounce);
}
@keyframes detailPop {
  from { transform: scale(.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.detail-circle span { font-size: 46px; }
.detail-hero h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.detail-sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }

.detail-body { padding: 8px 20px 32px; }
.section-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .06em; color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 10px; margin-top: 16px;
}
.detail-card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 6px;
}

.ing-row {
  display: flex; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px; font-size: 14px;
  animation: ingFade .3s var(--ease) both;
}
.ing-row:last-child { border-bottom: none; }
.ing-row:nth-child(1) { animation-delay: .05s; }
.ing-row:nth-child(2) { animation-delay: .1s; }
.ing-row:nth-child(3) { animation-delay: .15s; }
@keyframes ingFade {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}
.ing-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.ing-dot.warn { background: var(--amber); }
.ing-name { flex: 1; }
.ing-badge { font-size: 10px; padding: 4px 12px; border-radius: 999px; font-weight: 700; }
.badge-ok { background: var(--green-soft); color: var(--green-dark); }
.badge-warn { background: #fff3e0; color: var(--amber); }

.bar-group { padding: 16px; }
.bar-item { margin-bottom: 12px; }
.bar-item:last-child { margin-bottom: 0; }
.bar-meta { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
.bar-label { color: var(--text-2); font-weight: 500; }
.bar-value { color: var(--text-3); }
.bar-track { height: 6px; background: #f0f2f0; border-radius: 3px; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 3px;
  background: var(--green);
  width: 0;
  transition: width .9s var(--ease);
}
.bar-fill.warn { background: var(--amber); }

.source-note { font-size: 11px; color: var(--text-3); text-align: center; padding: 14px 0 24px; opacity: .6; }

/* ═══ CALENDAR ═══ */
.page-top {
  padding: 20px 20px 16px;
}
.page-top h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.sub-text { font-size: 12px; color: var(--text-3); margin-top: 3px; }

.week-strip {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  overflow-x: auto;
}
.week-strip::-webkit-scrollbar { display: none; }
.week-day {
  min-width: 60px;
  padding: 12px 10px;
  border-radius: var(--r);
  background: var(--card);
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: var(--shadow-sm);
  transition: all .25s var(--ease);
  flex-shrink: 0;
}
.week-day.active {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: 0 4px 16px rgba(76,175,80,.12);
}
.week-day:active { transform: scale(.94); }
.week-day small { display: block; font-size: 11px; color: var(--text-3); font-weight: 600; }
.week-day strong { display: block; font-size: 22px; font-weight: 800; margin-top: 3px; color: var(--text); }
.week-day.active strong { color: var(--green); }

#cal-detail {
  margin: 4px 20px 20px;
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
#cal-detail h4 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
#cal-list { list-style: none; }
#cal-list li {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px; color: var(--text-2);
  display: flex; align-items: center; gap: 10px;
}
#cal-list li:last-child { border-bottom: none; }

/* ═══ PHOTO FEED ═══ */
.feed-list { padding: 8px 20px 90px; display: flex; flex-direction: column; gap: 16px; }

.feed-card {
  background: var(--card);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  animation: feedIn .45s var(--ease) both;
}
.feed-card:nth-child(1) { animation-delay: .05s; }
.feed-card:nth-child(2) { animation-delay: .12s; }
@keyframes feedIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.feed-photo {
  height: 160px;
  background: linear-gradient(135deg, #a5d6a7, #c8e6c9);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; position: relative;
}
.feed-date-tag {
  position: absolute; top: 14px; left: 16px;
  background: rgba(76,175,80,.85);
  color: #fff; font-size: 11px; font-weight: 700;
  padding: 5px 14px; border-radius: 999px;
}
.feed-photo-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.feed-photo small { font-size: 11px; color: rgba(255,255,255,.7); }

.feed-body { padding: 16px 18px; }
.feed-menus { font-size: 13px; color: var(--text-2); line-height: 1.8; }
.feed-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.feed-author { display: flex; align-items: center; gap: 10px; }
.feed-avatar {
  width: 28px; height: 28px;
  border-radius: 50%; overflow: hidden;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
}
.feed-avatar img { width: 100%; height: 100%; object-fit: cover; }
.feed-author-name { font-size: 12px; color: var(--text-3); }
.feed-like {
  font-size: 13px; color: var(--text-3);
  background: none; border: none;
  display: flex; align-items: center; gap: 5px;
  transition: color .2s;
}
.feed-like:active { color: var(--red); }

/* FAB */
.fab {
  position: fixed;
  bottom: 80px; right: 24px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--green);
  color: #fff; border: none;
  box-shadow: 0 6px 20px rgba(76,175,80,.3);
  display: flex; align-items: center; justify-content: center;
  z-index: 20;
  transition: transform .2s var(--bounce);
}
.fab:active { transform: scale(.85); }

/* ═══ NUTRITION ═══ */
.nut-hero {
  padding: 20px 20px 20px;
}
.nut-hero h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.nut-numbers { display: flex; gap: 32px; margin-top: 16px; }
.nut-num-item { display: flex; flex-direction: column; }
.nut-num-item strong { font-size: 36px; font-weight: 800; line-height: 1; color: var(--text); letter-spacing: -.03em; }
.nut-num-item small { font-size: 12px; color: var(--text-3); }
.nut-num-item span { font-size: 10px; color: var(--text-3); margin-top: 4px; }

.insight-card {
  margin: 12px 20px;
  background: var(--green-soft);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex; align-items: flex-start; gap: 14px;
  border: 1px solid #c8e6c9;
}
.insight-mascot { flex-shrink: 0; }
.insight-body { font-size: 12px; color: var(--green-dark); line-height: 1.8; }
.insight-body strong { font-weight: 700; display: block; margin-bottom: 2px; font-size: 13px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 20px;
  margin-bottom: 14px;
}
.stat-cell {
  background: var(--card);
  border-radius: var(--r);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-val { font-size: 18px; font-weight: 800; color: var(--green); }
.stat-val.lo { color: var(--amber); }
.stat-lbl { font-size: 10px; color: var(--text-3); margin-top: 4px; display: block; }

/* ═══ ALLERGY ═══ */
.allergy-tags { display: flex; gap: 8px; padding: 16px 20px; flex-wrap: wrap; }
.allergy-tag {
  padding: 6px 16px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 5px;
}
.tag-warn { background: #fff3e0; color: var(--amber); border: 1px solid #ffe0b2; }
.tag-safe { background: var(--green-soft); color: var(--green-dark); border: 1px solid #c8e6c9; }

#allergy-cards { padding: 0 20px 24px; display: flex; flex-direction: column; gap: 10px; }
.allergy-item {
  background: var(--card);
  border-radius: var(--r);
  padding: 16px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm);
}
.allergy-emoji { font-size: 28px; flex-shrink: 0; }
.allergy-info { flex: 1; }
.allergy-name { font-size: 15px; font-weight: 700; }
.allergy-detail { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.allergy-badge { font-size: 10px; padding: 5px 12px; border-radius: 999px; font-weight: 700; flex-shrink: 0; }
.ab-safe { background: var(--green-soft); color: var(--green-dark); }
.ab-warn { background: #fff3e0; color: var(--amber); }

/* ═══ BOTTOM NAV ═══ */
.bottom-nav {
  height: 64px;
  background: #fff;
  border-top: 1px solid rgba(0,0,0,.05);
  display: flex;
  flex-shrink: 0;
  z-index: 30;
  box-shadow: 0 -2px 12px rgba(0,0,0,.03);
}
.nav-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  background: none; border: none;
  font-size: 10px; font-weight: 500;
  color: var(--text-3);
  transition: color .2s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.nav-item.active {
  color: var(--green);
}
.nav-item.active::after {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 24px; height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--green);
}
.nav-item svg { stroke: currentColor; }
.nav-item:active { transform: scale(.88); }

/* ═══ TOAST ═══ */
.toast {
  position: fixed;
  bottom: 100px; left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--text);
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  opacity: 0;
  transition: all .35s var(--ease);
  z-index: 300;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ═══ MODAL ═══ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.show { display: flex; }

.modal-sheet {
  background: var(--bg);
  width: 100%; max-width: 540px;
  max-height: 85vh;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  overflow-y: auto;
  animation: sheetUp .35s var(--ease);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle { width: 40px; height: 5px; border-radius: 3px; background: #ddd; margin: 12px auto 0; }
.modal-header {
  padding: 16px 22px;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 17px; font-weight: 800; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #f0f0f0; border: none;
  font-size: 13px; color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
}
.modal-body { padding: 0 22px 36px; }

.upload-drop {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 2px dashed var(--border);
  aspect-ratio: 4/3;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; cursor: pointer;
  margin-bottom: 18px;
  transition: border-color .2s, background .2s;
}
.upload-drop:hover { border-color: var(--green); background: var(--green-soft); }
.upload-drop p { font-size: 14px; font-weight: 600; color: var(--text-2); }
.upload-drop small { font-size: 11px; color: var(--text-3); }

#upload-preview { margin-bottom: 18px; border-radius: var(--r-lg); overflow: hidden; }
#upload-preview img { width: 100%; display: block; }

.form-label { font-size: 12px; font-weight: 700; color: var(--text-3); display: block; margin-bottom: 6px; }
.form-input { margin-bottom: 14px; }

/* ═══════════════════════════════════
   ADMIN PAGE
   ═══════════════════════════════════ */
.body-admin { overflow: auto; background: var(--bg); }

.admin-auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--green-soft), #dcedc8);
}
.admin-auth-card {
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 36px 32px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.admin-auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.admin-auth-logo h1 { font-size: 22px; font-weight: 800; letter-spacing: -.03em; }
.admin-auth-logo small { font-size: 12px; color: var(--text-3); font-weight: 500; margin-left: 4px; }
.admin-auth-note { font-size: 12px; color: var(--text-3); text-align: center; margin-top: 20px; }

.admin-panel { min-height: 100vh; }
.admin-topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  flex-wrap: wrap; gap: 10px;
}
.admin-topbar-left { display: flex; align-items: center; gap: 12px; }
.admin-topbar-left h1 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.admin-topbar-left small { font-size: 12px; color: var(--text-3); font-weight: 500; margin-left: 4px; }
.admin-topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-user { font-size: 13px; color: var(--text-3); font-weight: 600; }

.admin-main { max-width: 800px; margin: 0 auto; padding: 24px 20px 60px; }

.admin-card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.admin-card h3 { font-size: 17px; font-weight: 800; margin-bottom: 14px; }
.admin-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.admin-card-header h3 { margin-bottom: 0; }

.menu-editor { display: flex; flex-direction: column; gap: 10px; }
.editor-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; animation: edIn .2s var(--ease); }
@keyframes edIn { from { opacity: 0; transform: translateY(-4px); } }
.fi-emoji { width: 60px; flex-shrink: 0; text-align: center; font-size: 20px; padding: 12px 8px; }
.fi-name { flex: 1; min-width: 100px; }
.fi-kcal { width: 72px; flex-shrink: 0; }
.fi-allergy { width: 130px; flex-shrink: 0; }
.btn-del-row {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--red); color: #fff;
  border: none; font-size: 13px; flex-shrink: 0;
}

.empty-editor { text-align: center; padding: 28px; font-size: 13px; color: var(--text-3); }

.admin-actions { display: flex; gap: 12px; margin-bottom: 16px; }
.admin-actions .btn-primary, .admin-actions .btn-outline-sm { flex: 1; }
.btn-lg { padding: 16px; font-size: 15px; }

.saved-table { display: flex; flex-direction: column; }
.saved-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.saved-row:last-child { border-bottom: none; }
.saved-date { font-size: 14px; font-weight: 700; min-width: 100px; color: var(--green); }
.saved-menus { flex: 1; font-size: 12px; color: var(--text-2); line-height: 1.8; }
.saved-menus strong { color: var(--text); }
.btn-del-saved { background: none; border: none; font-size: 18px; cursor: pointer; padding: 4px; }

.empty-note { text-align: center; padding: 24px; font-size: 13px; color: var(--text-3); }

.user-table { margin-top: 10px; }
.ut-head { display: grid; grid-template-columns: 1fr 1fr 1fr; font-size: 11px; font-weight: 700; color: var(--text-3); padding: 10px 0; border-bottom: 1px solid var(--border); }
.ut-row { display: grid; grid-template-columns: 1fr 1fr 1fr; font-size: 13px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: center; }
.role-tag { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 8px; display: inline-block; width: fit-content; }
.role-admin { background: #fff3e0; color: var(--amber); }
.role-student { background: var(--green-soft); color: var(--green-dark); }

@media (max-width: 600px) {
  .editor-row { flex-wrap: wrap; }
  .fi-allergy { width: 100%; }
}

/* ═══════════════════════════════════
   DESKTOP RESPONSIVE
   ═══════════════════════════════════ */
@media (min-width: 768px) {
  .auth-content { max-width: 420px; margin: 0 auto; }
  .auth-logo-area { padding-top: 100px; }
  .appbar { padding: 0 32px; }
  .home-welcome { padding: 20px 32px 8px; }
  .tab-bar { justify-content: center; gap: 12px; }
  .tab { flex: none; min-width: 140px; }
  .kcal-banner { margin: 12px 32px; justify-content: center; gap: 32px; }
  .menu-grid { grid-template-columns: repeat(3, 1fr); max-width: 720px; margin: 0 auto; padding: 18px 32px; }
  .section-card { max-width: 680px; margin-left: auto; margin-right: auto; }
  .detail-body, #cal-detail, .feed-list, .stat-grid, .insight-card, #allergy-cards { max-width: 640px; margin-left: auto; margin-right: auto; }
  .page-top { padding: 20px 32px; }
  .week-strip { justify-content: center; gap: 12px; }
  .nut-hero { text-align: center; }
  .nut-numbers { justify-content: center; gap: 48px; }
  .stat-grid { grid-template-columns: repeat(6, 1fr); }
  .allergy-tags { justify-content: center; }
  .bottom-nav { justify-content: center; }
  .nav-item { flex: none; min-width: 90px; }
}

@media (min-width: 1024px) {
  .auth-content { max-width: 440px; }
  .auth-title { font-size: 38px; }
  .auth-mascot { width: 100px; height: 100px; }
  .appbar { padding: 0 48px; height: 60px; }
  .appbar-title { font-size: 20px; }
  .home-welcome h2 { font-size: 28px; }
  .menu-grid { grid-template-columns: repeat(4, 1fr); max-width: 900px; gap: 14px; }
  .section-card, .detail-body, #cal-detail, .feed-list, .stat-grid, .insight-card, #allergy-cards { max-width: 760px; }
  .kcal-banner { margin: 16px auto; max-width: 760px; }
  .page-top h2 { font-size: 26px; }
  .nav-item { min-width: 110px; gap: 4px; }
  .nav-item span { font-size: 11px; }
}

@media (min-width: 1400px) {
  .menu-grid { grid-template-columns: repeat(5, 1fr); max-width: 1100px; }
  .section-card, .detail-body, #cal-detail, .feed-list, .stat-grid, .insight-card, #allergy-cards { max-width: 900px; }
  .kcal-banner { max-width: 900px; }
}
