:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --text: #1b1b1b;
  --muted: #6b6b6b;
  --line: #e2e2de;
  --accent: #d0312d;
  --accent-text: #ffffff;
  --chip: #ecece8;
  --chip-on: #1b1b1b;
  --chip-on-text: #ffffff;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --card: #1f1f1f;
    --text: #ececec;
    --muted: #9a9a9a;
    --line: #333;
    --accent: #e5484d;
    --chip: #2a2a2a;
    --chip-on: #ececec;
    --chip-on-text: #141414;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
header, main, footer { max-width: 640px; margin: 0 auto; padding: 0 16px; }
header { display: flex; align-items: baseline; justify-content: space-between; padding-top: 16px; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 20px; margin: 0 0 12px; }

form#add-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 10px;
}
form#add-form[hidden] { display: none; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, button {
  font: inherit;
  font-size: 16px; /* prevents iOS zoom */
  color: var(--text);
}
input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  min-height: 44px;
}
.row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }
.row:has(#seen-at) { grid-template-columns: 1fr 1fr; }

button {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.ghost { min-height: 32px; padding: 4px 10px; font-size: 13px; color: var(--muted); background: transparent; }
button.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--muted); text-decoration: underline; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }

.inline-add {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.inline-add[hidden], #manual-store[hidden] { display: none; }
#manual-store { display: grid; gap: 8px; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.error { margin: 0; color: var(--accent); font-size: 14px; }
.error[hidden] { display: none; }

gmp-place-autocomplete {
  width: 100%;
  --gmp-mat-color-surface: var(--bg);
  --gmp-mat-color-on-surface: var(--text);
  --gmp-mat-color-outline: var(--line);
}

#filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 8px; }
#filters:empty { margin: 8px 0; }
.chip {
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 0;
  background: var(--chip);
  font-size: 14px;
}
.chip.on { background: var(--chip-on); color: var(--chip-on-text); }

#feed { padding-bottom: 24px; }
.day { margin: 14px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.entry {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
}
.entry .head { font-weight: 600; }
.entry .head a { color: inherit; }
.entry .meta { color: var(--muted); font-size: 14px; grid-column: 1; }
.entry .del {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  min-height: 32px;
  padding: 2px 8px;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: 0;
}
.entry .note { grid-column: 1 / -1; font-size: 14px; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }

footer { color: var(--muted); font-size: 13px; padding-bottom: 32px; }

dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  padding: 20px;
  width: min(92vw, 360px);
}
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog form { display: grid; gap: 12px; }
