:root {
  --bg: #f4f4f4; --card: #fff; --ink: #111; --muted: #666; --line: #e3e3e3; --accent: #111;
  --meal: #ffe3b3; --drink: #cfe8ff; --mood: #e7d6ff; --activity: #d4f5d0; --symptom: #ffd0d0;
  --sleep: #dcdcf5; --med: #ffe9f3; --note: #eee; --other: #eee;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: inherit; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.top { background: #111; color: #fff; }
.top .wrap { height: 52px; }
.brand { font-weight: 700; letter-spacing: .3px; text-decoration: none; margin-right: auto; }
.top nav a { color: #ddd; text-decoration: none; margin-left: 16px; }
.top nav a:hover { color: #fff; }
main { padding: 18px 16px 40px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 0 0 14px; }
.card.narrow { max-width: 380px; margin: 60px auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }
.daynav { justify-content: space-between; margin-bottom: 14px; }
.daynav h1 { flex: 1; text-align: center; }
.btn, button { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer; text-decoration: none; }
.btn.ghost { background: #fff; color: #111; border: 1px solid var(--line); }
button.link { background: none; color: var(--muted); padding: 0; text-decoration: underline; font-size: 13px; }
button.danger { background: #b00020; }
input[type=text], input[type=password], input[type=time], select {
  font: inherit; padding: 8px 10px; border: 1px solid #ccc; border-radius: 8px; background: #fff; }
input[type=text], input[type=password] { width: 100%; }
label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 4px; }
.card.narrow button { width: 100%; margin-top: 12px; }
.quick { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; }
@media (max-width: 720px) { .quick { grid-template-columns: 1fr 1fr; } .quick input[type=text] { grid-column: 1 / -1; } }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--note); white-space: nowrap; }
.kind-meal { background: var(--meal); } .kind-drink { background: var(--drink); } .kind-mood { background: var(--mood); }
.kind-activity { background: var(--activity); } .kind-symptom { background: var(--symptom); } .kind-sleep { background: var(--sleep); }
.kind-med { background: var(--med); } .kind-other { background: var(--other); }
.events { list-style: none; margin: 0; padding: 0; }
.event { padding: 9px 0; border-top: 1px solid var(--line); }
.event:first-child { border-top: 0; }
.event .time { font-variant-numeric: tabular-nums; color: var(--muted); width: 48px; }
.event .text { flex: 1 1 300px; }
.edit { display: grid; grid-template-columns: 1fr auto auto auto auto; gap: 8px; margin-top: 8px; }
@media (max-width: 720px) { .edit { grid-template-columns: 1fr 1fr; } .edit input[type=text] { grid-column: 1 / -1; } }
.hidden { display: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.kv span { color: var(--muted); }
.empty { color: var(--muted); margin: 6px 0; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.error { color: #b00020; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.foot { color: var(--muted); font-size: 12px; padding-bottom: 20px; }
