:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --surface: #ffffff;
  --ink: #152421;
  --muted: #63726e;
  --line: #d8e1df;
  --green: #176b5b;
  --green-dark: #105044;
  --coral: #c84f3d;
  --shadow: 0 12px 30px rgba(20, 50, 44, 0.09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: "Segoe UI", "Microsoft JhengHei", sans-serif; letter-spacing: 0; }
button, input, select { font: inherit; min-height: 44px; }
button, a { -webkit-tap-highlight-color: transparent; }
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #e8f0ee; }
.login-panel { width: min(100%, 380px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 28px; box-shadow: var(--shadow); }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; background: var(--green); color: white; font-size: 24px; font-weight: 800; border-radius: 6px; }
.login-panel h1 { margin: 18px 0 4px; font-size: 28px; }
.login-panel p { margin: 0 0 24px; color: var(--muted); }
.login-panel label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 14px; }
.login-panel input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 0 12px; font-size: 20px; }
.login-panel button { width: 100%; margin-top: 16px; border: 0; border-radius: 6px; background: var(--green); color: white; font-weight: 700; }
.form-error { min-height: 20px; color: var(--coral); margin-top: 10px; font-size: 14px; }
.app-shell { width: min(100%, 1180px); margin: 0 auto; padding: 18px 20px 80px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 0 14px; }
.topbar h1 { margin: 2px 0 0; font-size: 30px; }
.eyebrow { margin: 0; color: var(--green); font-size: 12px; font-weight: 800; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.save-state, .muted { color: var(--muted); font-size: 14px; }
.tabs { position: sticky; top: 0; z-index: 10; display: flex; gap: 4px; padding: 8px 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.tab { border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); padding: 0 18px; font-weight: 700; }
.tab.active { color: var(--green); border-bottom-color: var(--green); }
.panel { display: none; padding: 24px 0; }
.panel.active { display: block; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading h2 { margin: 3px 0 0; font-size: 24px; }
.time-control { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
select { border: 1px solid var(--line); background: white; border-radius: 6px; padding: 0 36px 0 12px; color: var(--ink); }
.schedule-list { display: grid; gap: 22px; }
.schedule-week { display: grid; gap: 10px; }
.schedule-week-next { border-top: 3px solid var(--green); padding-top: 22px; }
.week-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; color: var(--green-dark); }
.week-heading span { font-size: 13px; font-weight: 800; text-transform: uppercase; }
.week-heading strong { font-size: 15px; }
.week-days { display: grid; gap: 10px; }
.day-row { display: grid; grid-template-columns: 150px minmax(200px, 1fr) minmax(200px, 1fr); align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.day-date strong { display: flex; align-items: baseline; gap: 8px; font-size: 17px; }
.day-date strong span:last-child { color: var(--green-dark); }
.day-date small { display: block; color: var(--muted); font-size: 12px; }
.meal-field label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.meal-field select { width: 100%; }
.sticky-save { position: sticky; bottom: 0; display: flex; justify-content: flex-end; padding: 16px 0; background: rgba(244, 247, 248, 0.96); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 6px; padding: 0 16px; border: 1px solid transparent; text-decoration: none; cursor: pointer; font-weight: 700; }
.button.primary { background: var(--green); color: white; }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.button:disabled { opacity: 0.55; cursor: wait; }
.menu-frame { min-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.menu-frame img { display: block; width: 100%; height: auto; }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.status-item, .result-block { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.status-item span { display: block; color: var(--muted); font-size: 13px; }
.status-item strong { display: block; margin-top: 6px; color: var(--green); }
.result-block { margin: 18px 0; }
.result-block h3 { margin: 0 0 10px; }
.result-success { color: var(--green); }
.result-failure { color: var(--coral); }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 120px); max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 6px; background: #152421; color: white; box-shadow: var(--shadow); transition: transform 180ms ease; z-index: 30; }
.toast.show { transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .app-shell { padding: 10px 12px 88px; }
  .topbar { align-items: flex-start; }
  .topbar h1 { font-size: 25px; }
  .save-state { display: none; }
  .tabs { overflow-x: auto; }
  .tab { flex: 1 0 auto; padding: 0 14px; }
  .section-heading { align-items: flex-start; }
  .day-row { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
  .week-heading { align-items: flex-start; flex-direction: column; gap: 3px; }
  .day-date { display: block; }
  .day-date strong { font-size: 19px; }
  .sticky-save { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .sticky-save .button { width: 100%; }
  .status-grid { grid-template-columns: 1fr; }
  .menu-frame { min-height: 240px; }
}
