:root {
  --accent: #0b6e63;
  --accent-2: #14a38f;
  --accent-soft: #e3f2ef;
  --bg: #f3f6f5;
  --card: #ffffff;
  --ink: #15201e;
  --muted: #66736f;
  --line: #e5ebe9;
  --warn: #c2410c;
  --warn-soft: #fdf0e8;
  --danger: #d93025;
  --radius: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

#app { max-width: 640px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }

.hero {
  margin: 0 -16px 18px;
  padding: calc(22px + env(safe-area-inset-top)) 20px 26px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  border-radius: 0 0 28px 28px;
}
.hero .eyebrow { opacity: .85; font-size: 14px; }
.hero h1 { margin: 4px 0 14px; font-size: 28px; letter-spacing: -.3px; }
.hero .stats { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .stat { background: rgba(255,255,255,.16); border-radius: 14px; padding: 10px 12px; min-width: 96px; }
.hero .stat b { display: block; font-size: 22px; }
.hero .stat span { font-size: 12px; opacity: .9; }
.topbar { display: flex; justify-content: space-between; align-items: center; }
.topbar button { background: rgba(255,255,255,.18); border: 0; color: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; }

h2 { font-size: 17px; margin: 22px 4px 10px; display: flex; justify-content: space-between; align-items: baseline; }
h2 .link { font-size: 14px; font-weight: 500; color: var(--accent); background: none; border: 0; padding: 0; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 2px rgba(16,40,36,.05), 0 6px 20px rgba(16,40,36,.04); }
.card + .card { margin-top: 10px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.row .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.row.tap { cursor: pointer; }
.chev { color: #b9c4c1; }

.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.allergy { color: var(--danger); font-weight: 600; margin-top: 8px; }

.time { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.btn { border: 0; border-radius: 12px; padding: 9px 14px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); padding: 9px 8px; }
.btn.block { width: 100%; padding: 14px; font-size: 16px; }
.btn:disabled { opacity: .5; }
.done { color: var(--accent); font-size: 13px; font-weight: 600; }
.late { color: var(--warn); font-size: 12px; }

.alert { display: flex; gap: 10px; align-items: center; padding: 8px 0; color: var(--warn); font-size: 14px; }
.alert + .alert { border-top: 1px solid var(--line); }

.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex; gap: 4px; background: rgba(255,255,255,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: 999px; padding: 6px; box-shadow: 0 8px 30px rgba(16,40,36,.16);
}
.tabbar button { white-space: nowrap; border: 0; background: transparent; border-radius: 999px; padding: 9px 16px; font-size: 13px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabbar button.on { background: var(--accent-soft); color: var(--accent); }
.tabbar .icon { font-size: 19px; line-height: 1; }

.back { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 18px 0 6px; font-size: 16px; }
.page-title { font-size: 26px; margin: 4px 4px 12px; }

label.field { display: block; margin: 12px 0; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px 2px; }
input[type=text], input[type=number], input[type=datetime-local], textarea, select {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px; font-size: 16px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 110px; resize: vertical; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(10,25,22,.35); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; border-radius: 24px 24px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; }
.sheet h3 { margin: 4px 0 8px; font-size: 20px; }
.sheet .actions { display: flex; gap: 10px; margin-top: 14px; }
.sheet .actions .btn { flex: 1; padding: 13px; }

.welcome { padding: calc(40px + env(safe-area-inset-top)) 8px 20px; }
.welcome img { width: 72px; height: 72px; border-radius: 18px; }
.welcome h1 { font-size: 30px; margin: 18px 0 8px; }
.welcome p { color: var(--muted); line-height: 1.5; }
.error { color: var(--danger); font-size: 14px; margin-top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.photos { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; }
.photos img { height: 140px; border-radius: 12px; }
.sync { font-size: 12px; opacity: .85; margin-top: 10px; }
.empty { text-align: center; color: var(--muted); padding: 20px 8px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.brief { white-space: pre-wrap; line-height: 1.5; }
