:root {
  --bg: #f6f7f9;
  --panel: #fff;
  --text: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --primary: #146c63;
  --soft: #e8f3f1;
  --danger: #b3261e;
  --warn: #8a5a00;
  --ok: #137333;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }

.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: 0 14px 36px rgba(17, 24, 39, .12); }
.auth-card img { display: block; width: 84px; height: 84px; border-radius: 22px; margin: 0 auto 12px; }
.auth-card h1 { text-align: center; }
.auth-card p { margin: 8px 0 18px; text-align: center; color: var(--muted); }
.auth-card .btn { width: 100%; margin-top: 10px; }
.auth-card label { margin-top: 10px; }
.auth-separator { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; color: var(--muted); font-size: 13px; }
.auth-separator::before, .auth-separator::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.auth-help { margin-top: 10px; text-align: center; }
.btn.google { background: #fff; color: var(--text); border: 1px solid var(--line); }

header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(246, 247, 249, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }
.app-icon { display: flex; justify-content: center; margin-bottom: 10px; }
.app-icon img { width: 72px; height: 72px; border-radius: 20px; box-shadow: 0 8px 22px rgba(17, 24, 39, .14); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top-actions { display: flex; align-items: flex-end; flex-direction: column; gap: 6px; }
h1 { margin: 0; font-size: 28px; line-height: 1.05; }
.sub { margin-top: 3px; color: var(--muted); font-size: 14px; }
.pill { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 8px 10px; font-size: 12px; }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.tab { min-height: 48px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 800; }
.tab.active { background: #fff; border-color: var(--line); color: var(--text); }

main { max-width: 720px; margin: 0 auto; padding: 16px 16px 128px; }
.view { display: none; }
.view.active { display: block; }
.panel, details { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
summary { cursor: pointer; font-weight: 800; }
label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 14px; }
input, select { width: 100%; min-height: 56px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; font-size: 16px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.today-panel { padding: 14px; }
.today-fields input { min-height: 50px; padding: 10px 11px; }
.form-gap { margin-top: 10px; }
.form-action { margin-top: 10px; width: 100%; }
.people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.person { min-height: 64px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-size: 18px; }
.person.selected { border-color: var(--primary); background: var(--soft); color: var(--primary); font-weight: 800; }

.notice { border-left: 4px solid var(--primary); background: var(--soft); color: #0f514b; border-radius: 8px; padding: 12px; margin-top: 12px; }
.notice.error { border-color: var(--danger); background: #fce8e6; color: var(--danger); }
.btn { border: 0; border-radius: 10px; min-height: 58px; padding: 13px 14px; background: var(--primary); color: #fff; font-weight: 800; cursor: pointer; font-size: 18px; }
.btn.secondary { background: #eef1f5; color: var(--text); border: 1px solid var(--line); }
.btn.activate { background: var(--ok); }
.btn.danger { background: var(--danger); }
.btn.compact { min-height: 40px; padding: 8px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.actions { position: sticky; bottom: 0; z-index: 4; background: rgba(246, 247, 249, .96); border-top: 1px solid var(--line); padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px rgba(17, 24, 39, .08); }
.actions .wrap { padding: 0; display: grid; grid-template-columns: 1fr; gap: 10px; }

.row { display: grid; grid-template-columns: 1.2fr .8fr .8fr; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 12px; margin-bottom: 10px; }
.lunch-row { grid-template-columns: 1.1fr .8fr .8fr auto; }
.row strong { display: block; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.small { color: var(--muted); font-size: 13px; }
.badge { display: inline-flex; width: max-content; border-radius: 999px; padding: 4px 9px; background: #eef1f5; color: var(--muted); font-size: 12px; }
.badge.ok { background: #e6f4ea; color: var(--ok); }
.badge.warn { background: #fff4d8; color: var(--warn); }
.badge.err { background: #fce8e6; color: var(--danger); }
.individual-row { display: grid; grid-template-columns: 1fr 120px; gap: 8px; align-items: center; margin-top: 8px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.checks input { width: auto; min-height: auto; }
.empty { padding: 18px; text-align: center; color: var(--muted); }
.hidden { display: none; }
.app-icon { width: 72px; height: 72px; display: block; margin: 0 auto 10px; border-radius: 20px; box-shadow: 0 8px 22px rgba(17, 24, 39, .14); }
.brand-with-icon { display: flex; align-items: center; gap: 9px; }
.header-icon { width: 34px; height: 34px; border-radius: 9px; }
.actions-inline { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions-inline .btn { flex: 1 1 180px; }
.text-button { border: 0; background: transparent; color: var(--primary); padding: 10px 0; font-weight: 700; cursor: pointer; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-panel { width: min(100%, 420px); }
.auth-panel input, .auth-panel .btn { margin-top: 10px; }
.error-text { color: var(--danger); }
#groupSelect { margin-top: 12px; }
.tabs { grid-template-columns: repeat(5, 1fr); }

@media (max-width: 640px) {
  .wrap { padding: 12px; }
  main { padding: 12px 12px 132px; }
  .app-icon { margin-bottom: 8px; }
  .app-icon img { width: 62px; height: 62px; border-radius: 18px; }
  .top { align-items: flex-start; }
  .top-actions { align-items: flex-end; }
  .grid2, .row, .lunch-row { grid-template-columns: 1fr; }
  .today-panel { padding: 12px; }
  .today-fields { grid-template-columns: minmax(138px, .9fr) minmax(0, 1fr); gap: 8px; }
  .today-fields label { font-size: 12px; }
  .today-fields input { min-height: 48px; padding: 9px 10px; font-size: 15px; }
  .tabs { gap: 5px; }
  .tab { min-height: 46px; font-size: 12px; padding: 6px 3px; }
  .panel, details { padding: 16px; margin-bottom: 14px; }
  input, select { font-size: 18px; }
  .individual-row, .checks { grid-template-columns: 1fr; }
  .section-head { align-items: stretch; flex-direction: column; }
  .inline-actions { justify-content: flex-start; }
}
