:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  color: #17212b;
  background: #f4f6f8;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }

.page-shell { max-width: 1080px; margin: 0 auto; padding: 20px 16px 48px; }
.topbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.topbar h1 { margin: 0; font-size: 1.45rem; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.muted { color: #68737d; }
.small { font-size: .88rem; }

.card { background: #fff; border: 1px solid #e4e8ec; border-radius: 14px; padding: 18px; box-shadow: 0 2px 10px rgba(20,35,50,.04); }
.card + .card { margin-top: 16px; }
.card h2, .card h3 { margin-top: 0; }
.section-head { display: flex; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 12px; }

.btn { border: 0; border-radius: 10px; padding: 10px 14px; background: #273444; color: #fff; font-weight: 650; }
.btn:hover { filter: brightness(.96); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: #e9edf1; color: #25313d; }
.btn.danger { background: #a93636; }
.btn.ghost { background: transparent; color: #354350; border: 1px solid #d9dfe5; }

.status { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 7px 11px; font-size: .9rem; font-weight: 700; }
.status.open { background: #e7f6ec; color: #176532; }
.status.closed { background: #f5eaea; color: #8a2d2d; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.form-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .88rem; font-weight: 650; color: #4d5965; }
input, textarea { width: 100%; border: 1px solid #cfd6dc; border-radius: 9px; padding: 10px 11px; background: #fff; color: #17212b; }
input:focus, textarea:focus { outline: 2px solid #b6c9dc; border-color: #8ca8c2; }
textarea { min-height: 72px; resize: vertical; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.login-card { width: min(430px, 100%); }
.login-card h1 { margin-bottom: 4px; }
.login-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #edf0f3; border-radius: 10px; padding: 4px; margin: 20px 0; }
.login-tab { border: 0; background: transparent; border-radius: 8px; padding: 9px; font-weight: 650; color: #5b6670; }
.login-tab.active { background: #fff; color: #18222c; box-shadow: 0 1px 4px rgba(20,35,50,.08); }
.login-form { display: grid; gap: 12px; }
.login-form .btn { margin-top: 4px; }
.message { min-height: 22px; margin: 10px 0 0; font-size: .92rem; }
.message.error { color: #a12828; }
.message.success { color: #176532; }

.week-title { margin: 0 0 16px; font-size: 1.15rem; }
.day-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.day-card { background: #fff; border: 1px solid #e4e8ec; border-radius: 14px; overflow: hidden; }
.day-title { margin: 0; padding: 13px 15px; background: #eef2f5; font-size: 1rem; }
.meal-row { padding: 14px 15px; border-top: 1px solid #edf0f2; }
.meal-row:first-of-type { border-top: 0; }
.meal-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 6px; }
.meal-label { font-weight: 750; }
.menu-text { white-space: pre-wrap; line-height: 1.5; color: #34414d; min-height: 1.5em; }
.menu-empty { color: #929aa2; }
.skip-control { display: inline-flex; align-items: center; gap: 7px; font-weight: 650; color: #8b3131; user-select: none; }
.skip-control input { width: 18px; height: 18px; accent-color: #9a3838; }
.readonly-skip { font-size: .88rem; font-weight: 700; color: #8b3131; }
.readonly-eat { font-size: .88rem; color: #65717b; }

.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.control-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.warning-box { background: #fff6e5; border: 1px solid #efd7a8; border-radius: 10px; padding: 11px 12px; color: #71531d; font-size: .9rem; }

.menu-editor { display: grid; gap: 15px; }
.editor-day { border: 1px solid #e2e7eb; border-radius: 12px; padding: 13px; }
.editor-day h3 { margin: 0 0 10px; font-size: 1rem; }
.editor-meals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.editor-meals.two { grid-template-columns: repeat(2, 1fr); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 10px 9px; border-bottom: 1px solid #e8ecef; text-align: left; vertical-align: top; }
th { font-size: .82rem; text-transform: none; color: #64707a; background: #f8f9fa; }
td.number, th.number { text-align: right; white-space: nowrap; }
.eat-count { font-weight: 800; font-size: 1.05rem; }
.skip-list { max-width: 360px; color: #7b3434; }

.user-list { display: grid; gap: 9px; margin-top: 14px; }
.user-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) auto auto; gap: 8px; align-items: center; }
.user-row input { min-width: 0; }

.toast { position: fixed; right: 18px; bottom: 18px; z-index: 20; background: #17212b; color: #fff; border-radius: 10px; padding: 11px 14px; box-shadow: 0 8px 28px rgba(0,0,0,.18); max-width: 330px; }

@media (max-width: 760px) {
  .page-shell { padding: 14px 10px 36px; }
  .day-grid, .admin-grid { grid-template-columns: 1fr; }
  .editor-meals, .editor-meals.two { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: 1fr 1fr; }
  .user-row .btn { width: 100%; }
  .topbar { align-items: flex-start; }
}

.language-control { display: inline-flex; align-items: center; gap: 7px; color: #5f6b75; font-size: .88rem; font-weight: 650; }
.language-select { width: auto; min-width: 108px; border: 1px solid #d9dfe5; border-radius: 9px; padding: 8px 30px 8px 9px; background: #fff; color: #25313d; }
.language-select:focus { outline: 2px solid #b6c9dc; border-color: #8ca8c2; }

@media (max-width: 560px) {
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .language-control > span { display: none; }
  .language-select { min-width: 116px; }
}
