/* Option A: clean tiles. Plain colors, thin borders, lots of white space. */

:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --text: #1f1f1d;
  --muted: #6b6a66;
  --border: #e4e2dc;
  --accent: #2f6f5e;     /* calm green for main buttons */
  --accent-text: #ffffff;
  --danger: #a32d2d;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

@media (prefers-color-scheme: dark) {
  :root { --bg: #161615; --card: #1f1f1e; --text: #ecebe7; --muted: #a09f9a; --border: #33332f; --accent: #5dcaa5; --accent-text: #08261d; --danger: #f09595; }
}

* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
main.narrow { max-width: 360px; padding-top: 15vh; }
h1 { font-size: 26px; font-weight: 600; margin: 0; }
h2 { font-size: 18px; font-weight: 600; margin: 40px 0 12px; }
.muted { color: var(--muted); margin: 4px 0 0; }
.small { font-size: 13px; }
.error { color: var(--danger); min-height: 1.2em; font-size: 14px; }

/* Buttons and inputs */
button {
  font: inherit; font-size: 14px; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
}
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.link { border: none; background: none; padding: 0; color: var(--muted); text-decoration: underline; font-size: 13px; }
label { display: block; font-size: 14px; margin: 14px 0 6px; }
label.check { display: flex; gap: 8px; align-items: center; }
input:not([type=checkbox]) {
  width: 100%; font: inherit; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
}
#login-form button { width: 100%; margin-top: 16px; }

/* Header */
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.top-actions { display: flex; gap: 8px; }

/* The tile grid: as many 220px-wide columns as fit the screen */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }

.tile {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.tile .pic {
  aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg); display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px;
}
.tile .pic img { width: 100%; height: 100%; object-fit: contain; }
.tile .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tile .title { font-weight: 600; font-size: 15px; margin: 0; }
.tile .title a { color: inherit; text-decoration: none; }
.tile .title a:hover { text-decoration: underline; }
.tile .site, .tile .note, .tile .date { font-size: 13px; color: var(--muted); margin: 0; }
.tile .row { display: flex; justify-content: space-between; align-items: baseline; margin-top: auto; padding-top: 8px; }
.tile .price { font-weight: 600; }
.tile .actions { display: flex; gap: 8px; margin-top: 10px; }
.tile .actions button { flex: 1; }
.tile .badge {
  display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px;
  background: var(--bg); color: var(--muted); width: fit-content;
}
.tile.got { opacity: 0.85; }
.tile .got-line { font-size: 13px; margin: 0; }

/* Pop-ups */
dialog {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px;
  width: min(440px, 92vw); background: var(--card); color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
dialog h2 { margin-top: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.picture-row { display: flex; gap: 12px; align-items: center; }
#f-preview { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
