:root {
  --bg: #faf7f0;
  --card: #fff;
  --ink: #1f1b16;
  --muted: #7a6f64;
  --line: #e9e0d2;
  --accent: #b45309;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.topbar {
  background: #1f1b16;
  color: #fdf8ef;
  padding: 20px 0;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar h1 { margin: 0; font-size: 28px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.logout-btn { background: transparent; color: #fdf8ef; border: 1px solid #cbbfae; }
.profile-btn, .profile-menu { display: none; }
.muted { color: var(--muted); }
.topbar .muted { color: #cbbfae; margin: 2px 0 0; }
.container { max-width: 1080px; margin: 0 auto; padding: 20px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.keybar label, .field label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}
.keybar-row { display: flex; gap: 8px; }
input, select, button {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 9px 12px;
}
input { flex: 1; min-width: 0; background: #fff; }
button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}
button:disabled { opacity: 0.45; cursor: default; }
button.ghost { background: transparent; color: var(--ink); }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.error { color: #b91c1c; font-size: 14px; }
.hidden { display: none !important; }
.filters-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; }
.grow-search { flex: 3 1 320px; }
.grow-flavor { flex: 2 1 240px; }
.field-group { display: flex; gap: 12px; min-width: 0; max-width: 100%; flex: 1 1 260px; }
.field-group .field { flex: 1 1 0; min-width: 0; }
.field-group input { width: 100%; }
.field-btn { justify-content: flex-end; margin-left: auto; }
.badge {
  background: #fbbf24;
  color: #1f1b16;
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 14px;
}
.status { margin: 6px 2px 14px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}
.beer {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.beer img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  object-position: center;
  background: #eee;
  display: block;
}
.beer .no-photo {
  height: 190px;
  display: grid;
  place-items: center;
  background: #f3ede1;
  font-size: 44px;
}
.beer .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.beer h3 { margin: 0; font-size: 17px; }
.meta { font-size: 13px; color: var(--muted); }
.rating { font-weight: 700; color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 12px;
  color: #78350f;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 1px 9px;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 18px 0 8px;
}
.pager button { min-width: 220px; }

@media (max-width: 640px) {
  .topbar { padding: 12px 0 0; }
  .topbar-inner { flex-direction: row; align-items: center; padding: 0 14px 12px; }
  .topbar h1 { font-size: 22px; }
  .brand { flex: 1; min-width: 0; }
  .brand #userLine { display: none; }
  .topbar-right { display: none; }
  .profile-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: transparent; color: #fdf8ef; border: 1px solid #cbbfae;
    border-radius: 999px; padding: 6px 12px; font-size: 14px;
    max-width: 55vw; cursor: pointer; white-space: nowrap;
  }
  .profile-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .profile-menu { display: block; border-top: 1px solid #3a332b; padding: 10px 14px 14px; }
  .profile-menu p { margin: 0 0 10px; font-size: 13px; color: #cbbfae; overflow-wrap: anywhere; }
  .profile-menu-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .badge { white-space: nowrap; font-size: 13px; padding: 5px 12px; }
  .container { padding: 14px; }
}
dialog { border: 1px solid var(--line); border-radius: 16px; max-width: 560px; width: 92vw; padding: 0; }
dialog article { padding: 18px; }
dialog img { width: 100%; max-height: 320px; object-fit: cover; object-position: center; border-radius: 12px; }
dialog a:has(img) { display: block; }
.dialog-actions { padding: 0 18px 18px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
a.btn {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 9px 12px;
  text-decoration: none;
  white-space: nowrap;
}
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.chip {
  background: #1f1b16;
  border-color: #1f1b16;
  color: #fdf8ef;
  border-radius: 999px;
  font-size: 13px;
  padding: 4px 12px;
}
.filter-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 12px 0 8px; }
.filter-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-btns button {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  padding: 5px 12px;
}
.filter-btns button:hover, .tag-btn:hover { border-color: var(--accent); color: var(--accent); }
.tag-btn { cursor: pointer; font: inherit; color: #78350f; }
