:root {
  --bg: #f5f6f4;
  --card: #ffffff;
  --ink: #1f2421;
  --muted: #6b7280;
  --green: #2f6f4f;
  --red: #b4452f;
  --amber: #b8860b;
  --line: #e3e6e1;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}
/* The whole top region sticks as one unit, so the tabs always sit flush under
   whatever is above them (no gap when the "signed in as" bar is hidden). */
#topbar { position: sticky; top: 0; z-index: 5; }
header {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem; background: var(--green); color: #fff;
}
header h1 { font-size: 1.2rem; margin: 0; flex: 1; }
header select { padding: .35rem; border-radius: 6px; border: 0; }
header .ghost { background: rgba(255,255,255,.18); color: #fff; border: 0; padding: .35rem .7rem; border-radius: 6px; cursor: pointer; font-size: .9rem; }
#actorbar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .5rem 1rem; background: #eef1ee; border-bottom: 1px solid var(--line);
  font-size: .85rem;
}
#actorbar select, #actorbar input { padding: .3rem; border-radius: 6px; border: 1px solid var(--line); font: inherit; }
#actorbar input { width: 8rem; }
nav#tabs {
  display: flex; overflow-x: auto; gap: .25rem;
  padding: .5rem; background: var(--card); border-bottom: 1px solid var(--line);
}
nav#tabs button {
  flex: 0 0 auto; border: 0; background: transparent; color: var(--muted);
  padding: .5rem .8rem; border-radius: 999px; font-size: .95rem; cursor: pointer;
}
nav#tabs button.active { background: var(--green); color: #fff; }
main { padding: 1rem; max-width: 640px; margin: 0 auto; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: .8rem 1rem; margin-bottom: .6rem;
}
.card h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.row { display: flex; align-items: center; gap: .5rem; }
.row .grow { flex: 1; }
.muted { color: var(--muted); font-size: .9rem; }
.pill { font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; color: #fff; }
.pill.overdue { background: var(--red); }
.pill.soon { background: var(--amber); }
.pill.ok { background: var(--green); }
button.act {
  border: 1px solid var(--green); color: var(--green); background: #fff;
  border-radius: 8px; padding: .35rem .7rem; cursor: pointer; font-size: .85rem;
}
button.act.primary { background: var(--green); color: #fff; }
button.del { border: 0; background: transparent; color: var(--red); cursor: pointer; }
form.add { background: var(--card); border: 1px dashed var(--line); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; }
form.add label { display: block; font-size: .8rem; color: var(--muted); margin-top: .5rem; }
form.add input, form.add select, form.add textarea {
  width: 100%; padding: .45rem; border: 1px solid var(--line); border-radius: 7px; font: inherit;
}
form.add .submit { margin-top: .8rem; width: 100%; padding: .6rem; }
h2.section { font-size: 1rem; color: var(--muted); margin: .5rem 0; }
.card.gone { opacity: .55; border-style: dashed; }
.tag { font-size: .7rem; padding: .1rem .45rem; border-radius: 5px; background: #eef1ee; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tag.create { color: var(--green); }
.tag.delete, .tag.hard_delete { color: var(--red); }
.tag.update, .tag.restore { color: var(--amber); }
.toggle { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--muted); margin-bottom: .6rem; cursor: pointer; }
.actions { display: flex; gap: .4rem; margin-top: .5rem; align-items: center; }
.photos { margin-top: .6rem; }
.thumbs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .4rem; }
.thumb { position: relative; width: 66px; height: 66px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #eef1ee; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.thumb-del { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; padding: 0; line-height: 16px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 13px; cursor: pointer; }
button.photo-add { font-size: .82rem; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
